This is a simple and scalable ToDo API built with Python FastAPI and PostgreSQL for storage, containerized using Docker, deployed on Kubernetes using Helm or Kustomizer.
-
🐍 Python FastAPI – Lightweight, high-performance REST API
-
🐘 PostgreSQL – Relational database for persistent ToDo storage
-
🐳 Docker – Containerization for easy deployment
-
☸️ Kubernetes – Container orchestration
-
🚀 Argo CD – GitOps-based continuous delivery
-
🛠️ Helm – Kubernetes manifest templating
.
├── src/
│ ├── main.py # App code starting point
│ ├── Dockerfile # Docker setup for the app
│ └── requirements.txt
├── .github/ # GitHub Actions folder
├── kustomization/ # Kubernetes deployment and service YAMLs
├── helm/ # Helm charts
├── charts/ # Helm charts repo
├── docker-compose/ # Docker compose file for the app
├── helmfile.yaml # Helmfile to deploy helm charts using repo URL
├── helmfileGit.yaml # Helmfile to deploy helm charts using git URL
├── README.md-
RESTful API endpoints for create, read, update, delete ToDo items
-
Persistent storage using PostgreSQL
-
Dockerized for easy local and cloud deployment
-
Kubernetes manifests for both API and DB
-
Auto-generated Swagger UI documentation
docker compose upAccess the app at: http://localhost:8000
kubectl apply -k kustomization/overlays/devUse below command to run using ARGO CD or via GUI.
argocd app create fast-api-rest-prod \
--repo https://github.com/soumiknandi/fast-api-rest.git \
--path kustomization/overlays/prod \
--dest-server https://kubernetes.default.svc \
--dest-namespace fast-api-rest-prod \
--sync-option CreateNamespace=true \
--sync-policy automated
Steps to follow
-
Run helm package command
cd helm helm dependency update fastapi-postgres -
Run below command from project root based on the environment
-
Base
helm install release-fast-api helm/ --values helm/values.yaml -n fast-api-rest --create-namespace
-
Dev
helm install release-fast-api helm/ --values helm/values.yaml -f helm/values-dev.yaml -n fast-api-rest-dev --create-namespace
-
Prod
helm install release-fast-api helm/ --values helm/values.yaml -f helm/values-prod.yaml -n fast-api-rest-prod --create-namespace
-
-
Create helm package
helm package ./helm --destination ./charts
-
Generate index.yaml
cb charts helm repo index . --url https://soumiknandi.github.io/fast-api-rest/charts
Note
Github pages needs to be enabled in order to access the chart/repo URL.
- Add the repo to helm
helm repo add fast-api-repo https://soumiknandi.github.io/fast-api-rest/charts- Run helm install
helm install release-fast-api-rest fast-api-chart/fast-api-rest-helm-chart -n fast-api-rest --create-namespaceTo run using helmfile use below command
helmfile syncFastAPI auto-generates:
- Swagger UI: http://<host>:<port>/docs
- ARGO CD
- GitHub Actions for CI
- Helm