MCPSERV.CLUB
What to Cook?

What to Cook?

Self-Hosted

Suggest recipes based on your pantry

Stale(53)
42stars
0views
Updated Dec 28, 2024

Overview

Discover what makes What to Cook? powerful

What To Cook? is a lightweight, self‑hosted recipe recommendation engine that tailors suggestions to the ingredients you currently have. From a developer’s standpoint, it is essentially a stateless service that exposes a small REST API for querying recipes and managing ingredient inventories. The application runs in a Docker container, making it straightforward to deploy behind reverse proxies or orchestrated with Kubernetes. The core logic is written in Go, leveraging the language’s static compilation and efficient concurrency model to keep resource usage low even under load.

Language & Runtime

Web Framework

Persistence

Data Model

Overview

What To Cook? is a lightweight, self‑hosted recipe recommendation engine that tailors suggestions to the ingredients you currently have. From a developer’s standpoint, it is essentially a stateless service that exposes a small REST API for querying recipes and managing ingredient inventories. The application runs in a Docker container, making it straightforward to deploy behind reverse proxies or orchestrated with Kubernetes. The core logic is written in Go, leveraging the language’s static compilation and efficient concurrency model to keep resource usage low even under load.

Technical Stack

  • Language & Runtime: Go 1.22 (or newer) – the entire codebase is a single binary, which simplifies deployment and eliminates runtime dependencies.
  • Web Framework: Standard net/http with minimal routing (gorilla/mux) for a clean, dependency‑free API surface.
  • Persistence: SQLite by default (file‑based) for ease of setup; the code also contains a PostgreSQL driver, allowing scaling to larger deployments.
  • Data Model: Relational schema with tables for recipes, ingredients, and a many‑to‑many join table (recipe_ingredients). The schema is generated via go generate and can be migrated with the built‑in CLI.
  • Testing: Go’s testing package plus httptest for integration tests; test data is stored in an in‑memory SQLite instance.

Core Capabilities

  • Recipe Suggestion API: GET /suggest accepts a comma‑separated list of available ingredients and returns the top matching recipes, ranked by ingredient overlap.
  • Ingredient CRUD: Endpoints for adding, updating, and deleting ingredients (/ingredients), allowing dynamic inventory management.
  • Recipe Management: Full CRUD on recipes, including nested ingredient lists; supports tags and metadata for richer queries.
  • Search & Filtering: Query parameters support filtering by cuisine, cooking time, and dietary restrictions.
  • Webhooks: Optional POST webhook support to notify external services when a new recipe is suggested or added.

Architecture & Deployment

The application follows a classic client‑server architecture: the Go server serves JSON over HTTP, while clients (web UI or mobile) consume these endpoints. Deployment is container‑centric:

  • Docker: A single Dockerfile builds a stateless image; the repository includes a ready‑to‑use docker-compose.yml that maps volumes for persistence and environment variables for configuration.
  • Kubernetes: Helm charts are not provided out of the box, but the container image is fully compatible with any OCI‑compliant orchestrator. StatefulSets can be used if PostgreSQL persistence is desired.
  • Scalability: Because the service is stateless, horizontal scaling is trivial—just spin up more replicas behind a load balancer. SQLite limits scaling to single‑node writes; switching to PostgreSQL removes this constraint.

Integration & Extensibility

  • Plugin System: The core is intentionally minimal, but developers can extend functionality by embedding the Go package into their own services. The api package exposes all handlers as functions, making it easy to mount additional routes.
  • External APIs: The project ships a simple CLI that can fetch recipes from public sources (e.g., Spoonacular) and populate the local database, enabling hybrid data stores.
  • Webhooks & Callbacks: Custom webhook URLs can be configured via environment variables, allowing integration with CI/CD pipelines or home‑automation systems.
  • OpenAPI Spec: The API is documented with Swagger/OpenAPI, facilitating automatic client generation in any language.

Developer Experience

  • Configuration: All settings are environment‑based (PORT, DATABASE_URL, WEBHOOK_URL), which aligns with Twelve‑Factor app principles.
  • Documentation: The README provides clear instructions for Docker Compose, and the source code is heavily commented. A separate docs/ folder contains the OpenAPI spec and migration scripts.
  • Community & Support: The project is hosted on GitHub with an active issue tracker. While the community is small, contributors are welcomed and pull requests are merged quickly.

Use Cases

  1. Smart Kitchen Dashboards: Embed the API into a Raspberry Pi‑based kitchen display to show daily recipe suggestions based on pantry inventory.
  2. Meal‑Planning Platforms: Integrate with existing meal‑planning tools to enrich recipe recommendations without duplicating data.
  3. IoT Automation: Trigger smart fridges or voice assistants when a new recipe is suggested, leveraging the webhook system.
  4. Educational Projects: Use the Go codebase as a teaching example for building RESTful services with minimal dependencies.

Advantages

  • Performance: Go’s compiled binaries and efficient concurrency make the service fast even with thousands of recipes.
  • Simplicity: A single Docker image and a SQLite database mean zero external dependencies for small deployments.
  • Licensing: The MIT license allows unrestricted use, modification, and redistribution—ideal for commercial or open‑source projects.
  • Extensibility: The API is intentionally small and well‑documented, enabling developers to build custom clients or extend the server with minimal friction.

What To Cook? offers a solid, production‑ready foundation for any developer looking to add intelligent recipe recommendation capabilities to their self

Open SourceReady to get started?

Join the community and start self-hosting What to Cook? today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
other
License
AGPL-3.0
Stars
42
Technical Specs
Pricing
Open Source
Docker
Dockerfile
Supported OS
LinuxDocker
Author
kassner
kassner
Last Updated
Dec 28, 2024