A complete DevSecOps Starter Kit to build secure, modern web applications with:
- Backend: FastAPI + PostgreSQL
- Frontend: React + Vite
- Security Tools: Bandit (Python Security Scan), Trivy (Docker Image Scan)
- CI/CD: GitHub Actions pipeline
- Deployment: Docker Compose for development and production
- Secure API with FastAPI
- React-based frontend using Vite for fast builds
- PostgreSQL database integration
.envfile for secrets management- Health checks for backend and database
- CI/CD pipeline with security scans and image checks
- Docker & Docker Compose
- Node.js & npm (if running frontend locally)
- Python 3.11+ (if running backend locally)
git clone <repo-url>
cd DevSecOps-Starter-Kitcp .env.example .envOn Windows PowerShell:
Copy-Item .env.example .envEdit .env to set database credentials:
POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=app
docker-compose up -d- Frontend (Dev): http://localhost:5173
- Backend API: http://localhost:8000
- Swagger Docs: http://localhost:8000/docs
docker-compose downdocker-compose logs -fFor a specific service:
docker-compose logs backend
docker-compose logs frontenddocker-compose build --no-cachecd backend
python3 -m venv venv
source venv/bin/activate # Windows: venv\\Scripts\\activate
pip install -r requirements.txt
uvicorn app.main:app --reloadcd frontend
npm install
npm run devAccess at: http://localhost:5173
cd frontend
npm install
npm run buildThe production build will be in the dist/ folder.
docker-compose -f docker-compose.prod.yml up -d- Frontend (Prod): http://localhost:3000
- Backend API: http://localhost:8000
- Swagger Docs: http://localhost:8000/docs
Check container status:
docker psLogs:
docker-compose -f docker-compose.prod.yml logs -fCreate .env with:
POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=app
Stop other services or edit docker-compose.prod.yml to use different ports.
Restart services:
docker-compose up -d --force-recreateRebuild the frontend:
cd frontend
npm install && npm run build- Bandit:
bandit -r backend - Trivy:
trivy image devsecops-backend
On every push, GitHub Actions will:
- Run Bandit security scan on Python code
- Build Docker image and scan with Trivy
Workflow file: .github/workflows/devsecops.yml
[ React Frontend ] <---> [ FastAPI Backend ] <---> [ PostgreSQL DB ]
(Vite Build) (API + Auth) (Persistent Data)
Docker Compose orchestrates all services.
- JWT authentication & OAuth integration
- Logging & Monitoring (ELK Stack)
- Advanced DevSecOps tools (SAST, DAST)
MIT