Skip to content

dhhyi/recipe-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Recipe DB

This project is intended to be a playground for a microservice architecture in the domain of a recipe collection.

As part of the exercise, I want to try as many different programming languages, frameworks and methods as possible.

This README is still a work in progress...

Getting Started

Required for running anything:

  • Node.js >= 18
  • docker or comparable container builder
  • docker compose

Run npm run generate-docker-compose and docker compose up. The project will be available on http://localhost. Traefik is listening on http://localhost:8080. Apollo GraphQL is available on http://localhost/graphql.

Required for development:

  • pnpm (npm i -g pnpm)
  • @devcontainers/cli (npm i -g @devcontainers/cli@latest)
  • VSCode

After project checkout, run pnpm install. This will generate all necessary files for development (config files for prettier and docker as well as VSCode devcontainers).

Technologies / Building Blocks

The project is organized in a mono repo. All individual projects provide docker images that can be built independently.

General Architecture

Every aspect in the Recipe DB is bundled in a microservice. Traefik is used to glue everything together. All individual backend services are made available to the frontend via Apollo GraphQL. For building all of the projects in the mono repo, Docker is used as a programming language agnostic builder.

Frontend

Even though the frontend parts have access to a unified GraphQL API, I want to implement the different parts with different solutions.

Parts with limited interaction (frontend)

For pages that are mostly static, Astro is a perfect implementation solution for speedy serving and caching.

Astro offers plugins for different languages for components, which I want to try all.

As most parts of any Astro page can be pre-rendered and cached and rerendered when the data changes, I plan on adding a cache purging solution from backend to frontend later. (Message Que, Websocket)

Heavy interaction

Parts with heavy interaction like the pages for adding and editing recipes will be implemented in a different solution.

Recipe Adding and Editing (recipes-edit)

Implemented in Vaadin via Kotlin. with Gradle build tool and Spring Boot for app startup.

Image Adding and Editing (images-edit)

Implemented in Elm using elm-graphql for GraphQL integration.

Style

If possible, consistent styling with Tailwind CSS.

Backend

The backend is organized in a variety of services where the only one actually necessary is the one holding recipe data. Each service exposes a REST API which is tested with a different integration testing framework.

Implemented using Golang, web framework Gin and Clover as document database.

Still open: versioning of recipe data and rollback of edits.

Integration testing done in Venom.

Implemented in IO with SQLite as relational database.

Integration testing in Karate.

Images (images)

Image server implemented in Julia using Genie and JuliaImages. Testing is part of the precompile/warm-up process.

Sources of inspiration web links for this recipe. Implemented in Lua using Milua for setting up REST API. Data stored as plain JSON File.

Testing is done using Venom with Tavern Executor

Utility Services

Services with utility character.

Link Extract (link-extract)

Extracts favicon, title, description and canonical link of URL.

Implemented in Deno using Denorest and AloeDB document database.

Image Inline (image-inline)

Convert an Image URL to an inlined image. Implemented in Perl using Dancer2 for the REST API setup.

Ideas for other services:

Tags

TBA, maybe graph database?

Specific tags for:

  • Country
  • Vegetarian/Vegan/Pescetarian
  • Main/Side/Appetizer/Dessert

Comments

graph-like data structure

Food diary

User can track when he had a certain recipe.

Relations

  • Variant of
  • Side dish

Collections

Add recipes to collections (public and private)

Recipe State

(should really be part of recipe data)

  • public
  • draft
  • idea

Cross Concerns

Authentication

Probably Google oAuth via traefik.

searching

Maybe with OpenSearch or Quickwit.

  • by name
  • by rating for user
  • recipes containing ingredient/tag

Caching and updating

Message queue notify on update -> pre-render and cache page again.

Resilience

Maybe later.

Dev Support

  • VSCode devcontainers for easy setup
  • custom precommit
  • prettier as formatter for general
  • testing with integration test projects
  • demo-data project

List of possible REST API testing frameworks

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages