A demo microservices project showcasing a central backend service managing multiple services with centralized configuration, CLI deployment, and repository patterns.
This project runs 3 microservices:
-
Backend Service – The main service that:
- Manages configurations in MongoDB
- Provides REST aggregator endpoints
- Implements repository layer and protocol abstractions
- Includes CLI tools for environment management and deployment
-
Users Service – Handles user data and profiles.
-
Orders Service – Manages order data for users.
- Centralized configuration management via MongoDB
- CLI tools (
create-env,edit-env,list-envs,deploy) - Environment-aware deployments (
dev,demo,staging,prod) - Dockerized setup for local demo
- Repository and protocol pattern for clean code separation
-
Docker and Docker Compose installed
-
Python 3.12+ (for running CLI tools)
-
MongoDB is containerized via Docker (no local installation required)
-
A .env file must exist inside backend folder (imagine multi machines for staging, demo or testing) with the following values
- CONFIG_DB_URL=mongodb://mongo:27017
- CONFIG_DB_NAME=backend_config
- CONFIG_DB_COLLECTION=configs
- ENV=dev
- Clone the repository:
git clone <repo_url>
cd FastApi_BE/backendpython -m venv .venv .venv\Scripts\activate # Windows
or
source .venv/bin/activate # Linux/macOS
docker compose up -d
This starts:
- Backend service
- Users service
- Orders service
- MongoDB
FastApi_BE/
├── backend/ # FastAPI backend service
│ ├── config_loader.py # Loads configuration from MongoDB or .env
│ ├── models.py # Pydantic models for Config & FeatureFlags
│ ├── repository/ # Mongo repository layer
│ ├── protocols.py # Protocol definitions for repo
│ ├── Dockerfile # Backend Dockerfile
│ └── main.py # FastAPI routes
├── docs # Documents Folder
├── docker-compose.yml # Docker Compose for all services
├── requirements.txt # Python dependencies
└── README.md # Project documentation