A production-ready microservices architecture built with FastAPI, PostgreSQL, and Docker.
| Service | Port | Description |
|---|---|---|
| User Service | 8001 | User registration and management |
| Product Service | 8002 | Product catalog with CRUD |
| Order Service | 8003 | Order placement with stock management |
- Framework — FastAPI
- Database — PostgreSQL 15
- ORM — SQLAlchemy 2.0 async
- Driver — psycopg3
- Gateway — Nginx
- Containerization — Docker + Docker Compose
- Package Manager — uv
- Docker Desktop
- Git
- Clone the repository
git clone <your-repo-url>
cd fastapi-microservices- Create environment file
cp .env.example .env- Start all services
docker-compose up --buildAll APIs are accessible through Nginx at http://localhost:
| Endpoint | Service |
|---|---|
/api/users/ |
User Service |
/api/products/ |
Product Service |
/api/orders/ |
Order Service |
| Service | URL |
|---|---|
| User Service | http://localhost:8001/docs |
| Product Service | http://localhost:8002/docs |
| Order Service | http://localhost:8003/docs |
Run only databases in Docker, services locally with hot reload:
# Terminal 1 - databases only
docker-compose up users-db products-db orders-db
# Terminal 2 - user service
cd user_service && uv run uvicorn main:app --reload --port 8001
# Terminal 3 - product service
cd product_service && uv run uvicorn main:app --reload --port 8002
# Terminal 4 - order service
cd order_service && uv run uvicorn main:app --reload --port 8003