Repository navigation
Add example services, shared libraries and ARCHITECTURE.md - #3
Merged
Merged
Conversation
- packages/contracts: shared pydantic models (Product, Order, OrderPlaced event) - packages/messaging: Broker interface with Redis and in-memory implementations - packages/servicekit: env settings, logging, FastAPI app factory with /health - apps/catalog-api, apps/orders-api (HTTP) and apps/notifier-worker (queue consumer), each with tests and its own Dockerfile - compose.yaml to run everything together with Redis - ARCHITECTURE.md with Mermaid diagrams for layout, dependencies, runtime flow, CI and deployment Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SE2PhLkfsDeyxNHA9ozBD7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Sovik · project thread
Summary
Adds a small "shop" example so the monorepo shows real services sharing real code.
Shared libraries (
packages/)contracts: pydantic models every service agrees on (Product,Order,OrderCreate,OrderPlacedevent).messaging:Brokerinterface with a Redis implementation (production) and an in-memory one (tests), plus typedpublish_event/receive_event.servicekit: env-var settings, one logging format, and (via thehttpextra) a FastAPI app factory with/health.Services (
apps/), each with tests and its own Dockerfilecatalog-api(HTTP): lists products and prices.orders-api(HTTP): accepts an order, prices it by callingcatalog-api, stores it, publishesOrderPlacedto Redis.notifier-worker(worker): consumesOrderPlacedand sends a confirmation (logged). No FastAPI in its image.Also
compose.yamlruns all three plus Redis locally (docker compose up --build).ARCHITECTURE.mdwith 7 Mermaid diagrams: repo layout, dependency graph, runtime sequence, inside-a-service, CI flow, container build, deployment.pyproject.tomlgets the new mypy paths / first-party names, the pydantic mypy plugin andfakeredisfor tests.Testing
pre-commit run --all-files(ruff, ruff format, mypy strict,uv lock --check) passes.pytest: 30 tests pass, and each member passes on its own as the CI matrix runs it.uv sync --no-dev --no-editable --package <app>): each venv contains only its own libraries (e.g. the worker has no fastapi/uvicorn).POST /ordersreturned 201 with the correct total, an unknown SKU returned 422, and the worker logged the notification.Generated by Claude Code