Production-ready full-stack microservice template with Docker, Kubernetes, and CI/CD baked in.
A hybrid DevOps + full-stack reference architecture demonstrating how to ship a real service from local dev to Kubernetes.
| Layer | Stack |
|---|---|
| API | FastAPI (Python 3.12) |
| Frontend | Next.js 15 (TypeScript) |
| Database | PostgreSQL 16 |
| Cache | Redis 7 |
| Containers | Docker multi-stage builds |
| Orchestration | Kubernetes manifests + Helm chart |
| CI/CD | GitHub Actions (lint, test, build, push) |
┌─────────────┐ ┌─────────────┐ ┌──────────────┐
│ Next.js │────▶│ FastAPI │────▶│ PostgreSQL │
│ (port 3000)│ │ (port 8000)│ │ (port 5432) │
└─────────────┘ └──────┬──────┘ └──────────────┘
│
┌──────▼──────┐
│ Redis │
│ (port 6379) │
└─────────────┘
- Docker & Docker Compose
- Node.js 20+
- Python 3.12+
# Start infrastructure
docker compose up -d postgres redis
# API
cd api && pip install -r requirements.txt && uvicorn app.main:app --reload
# Frontend
cd web && npm install && npm run devOpen http://localhost:3000 — API docs at http://localhost:8000/docs
docker compose up --buildkubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/
# Or use Helm
helm install microservice ./helm/microservice-starter| Method | Path | Description |
|---|---|---|
| GET | /health |
Liveness probe |
| GET | /ready |
Readiness probe (checks DB + Redis) |
| GET | /api/v1/items |
List items |
| POST | /api/v1/items |
Create item |
microservice-starter/
├── api/ # FastAPI backend
├── web/ # Next.js frontend
├── k8s/ # Kubernetes manifests
├── helm/ # Helm chart
├── .github/workflows/ # CI/CD pipelines
├── docker-compose.yml
└── README.md
- Lint — Ruff (Python), ESLint (TypeScript)
- Test — pytest, Vitest
- Build — Docker images with layer caching
- Scan — Trivy vulnerability scan
- Deploy — Optional K8s rollout (on tag)
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
postgresql://app:app@localhost:5432/app |
Postgres connection |
REDIS_URL |
redis://localhost:6379/0 |
Redis connection |
API_URL |
http://localhost:8000 |
Backend URL (frontend) |
MIT © almightymoon