A microservices-based e-commerce platform built with Python, FastAPI, MySQL, MongoDB, Redis.
Designed with clean architecture principles — domain-driven design, generic repository pattern, and containerized deployments using Docker Compose.
| Service | Description | Status |
|---|---|---|
| Product Catalog | Categories and product management | Active |
| User Management | User registration and profiles | Planned |
| Cart & Checkout | Shopping cart and checkout flow | Planned |
| Order Management | Order processing and tracking | Planned |
| Payment | Payment gateway integration | Planned |
| Authentication | Auth and token management | Planned |
- Language: Python 3.14
- Framework: FastAPI (async)
- ORM: SQLAlchemy 2.0 (async, DeclarativeBase)
- Database: MySQL 8
- Migrations: Liquibase
- Containerization: Docker, Docker Compose
- Dependency Management: Poetry
- Architecture: Microservices, Generic Repository Pattern
- Zero-trust token authentication — every request is validated in two steps: local JWT signature verification via token-validator (no network call), then a session/revocation check against Auth Service.
- Generic repository pattern — a single async base repository handles CRUD for all SQLAlchemy models; new entities require zero data-access boilerplate.
- Service-per-domain decomposition — each microservice (Product, User, Cart, Order, Payment) is independently deployable with its own database, Makefile, and Docker Compose.
- Compose-based local orchestration —
make upfrom the mono-repo root starts all services, databases, and migrations with a single command; per-service shortcuts (make product-up) enable focused development. - Infrastructure-as-code observability — logs, traces, and metrics are injected via instrumentation-hub with zero observability code in business logic.
- Liquibase schema migrations — database changes are versioned YAML changesets applied automatically on container startup.
- Pydantic settings + environment-driven config — all secrets, ports, and feature flags are loaded from environment variables, making services 12-factor compliant.
services/
└── product_service/
├── .env # shared config (ports, db name, etc.)
└── components/
├── docker-compose.yaml # root compose (includes db + app)
├── Makefile # aggregate make targets
├── product_service_app/ # FastAPI application
│ ├── src/api/
│ │ ├── controllers/ # REST endpoints
│ │ ├── services/ # business logic
│ │ ├── repos/ # generic repository layer
│ │ ├── models/ # SQLAlchemy entities
│ │ ├── dtos/ # request/response schemas
│ │ └── exceptions/ # custom exceptions
│ └── smoke_tests/ # post-deploy smoke tests
└── product_service_db/ # database + Liquibase migrations
Prerequisites: VS Code, Docker Desktop, Dev Containers extension
- Clone this repo
- Configure
services/product_service/.envand export secrets:export PRODUCT_SERVICE_MYSQL_ROOT_PASSWORD=yourpassword export PRODUCT_SERVICE_SECRET_KEY=yourjwtsecret
- Open
micro-cart/in VS Code - Click Reopen in Container when prompted
- All services (Product API, MySQL, Liquibase, phpMyAdmin) start automatically
- Product API: http://localhost:3002/product-service/docs
Start OAAS and Auth Service first.
As new services are added, they are included in
docker-compose.yaml— no devcontainer changes needed.
Prerequisites: Docker & Docker Compose, Make
- Configure
services/product_service/.envand export secrets - Run from the repo root:
export PRODUCT_SERVICE_MYSQL_ROOT_PASSWORD=yourpassword export PRODUCT_SERVICE_SECRET_KEY=yourjwtsecret make up # starts ALL services make ps # check health
All commands run from the repo root (micro-cart/):
| Command | Description |
|---|---|
make up |
Start all services (creates network automatically) |
make stop |
Stop all services |
make down |
Stop + remove all services |
make clean |
Full teardown (containers, volumes, caches) |
make build |
Rebuild all images (no cache) |
make ps |
Show container status |
make logs |
Follow all logs |
make test |
Run tests for all services |
make fmt |
Format code (ruff) |
make lint |
Lint code (ruff) |
Per-service shortcuts: make product-up, make product-stop, make product-down, make product-test, etc.
| Service | URL |
|---|---|
| Product API | http://localhost:3002/product-service/docs |
| MySQL (Product) | localhost:3001 |
| phpMyAdmin (Product) | http://localhost:3003 |
Each microservice validates incoming requests in two steps:
- JWT signature + claims — validated locally using token-validator via the Auth Service JWKS endpoint (no network call to Auth Service API).
- Session / revocation check — calls Auth Service
POST /session-statusto confirm the token hasn’t been revoked.
See the Product Service README for configuration details.
| Layer | Scope |
|---|---|
| Unit | Service logic, controllers, decorators |
| Functional | Full request cycle via FastAPI TestClient |
| Smoke | Post-deploy HTTP tests against running containers |
make test # all services
make product-test # product service only| Repository | Purpose |
|---|---|
| Auth Service | JWT authentication and RBAC |
| OAAS | Observability stack (Grafana, Loki, Tempo, Prometheus) |
| Instrumentation Hub | Client library for OpenTelemetry instrumentation |
| Token Validator | RS256 JWT validation library with JWKS support |
MIT — Copyright © 2026 Dilip Kumar Sharma.