Skip to content

kevzero/DevSecOps-Starter-Kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

DevSecOps Starter Kit

๐Ÿ“Œ Overview

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

โœ… Features

  • Secure API with FastAPI
  • React-based frontend using Vite for fast builds
  • PostgreSQL database integration
  • .env file for secrets management
  • Health checks for backend and database
  • CI/CD pipeline with security scans and image checks

โš™๏ธ Requirements

  • Docker & Docker Compose
  • Node.js & npm (if running frontend locally)
  • Python 3.11+ (if running backend locally)

๐Ÿš€ Quick Start (Windows, Mac, Linux)

1. Clone the repository

git clone <repo-url>
cd DevSecOps-Starter-Kit

2. Create the environment file

cp .env.example .env

On Windows PowerShell:

Copy-Item .env.example .env

Edit .env to set database credentials:

POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=app

3. Start services in DEV mode

docker-compose up -d

4. Access services


Stop services

docker-compose down

View logs

docker-compose logs -f

For a specific service:

docker-compose logs backend
docker-compose logs frontend

Rebuild containers

docker-compose build --no-cache

๐Ÿ›  Local Development Without Docker

Backend

cd backend
python3 -m venv venv
source venv/bin/activate  # Windows: venv\\Scripts\\activate
pip install -r requirements.txt
uvicorn app.main:app --reload

Frontend

cd frontend
npm install
npm run dev

Access at: http://localhost:5173


๐Ÿ— Production Deployment

1. Build frontend for production

cd frontend
npm install
npm run build

The production build will be in the dist/ folder.

2. Run in Docker (Production mode)

docker-compose -f docker-compose.prod.yml up -d

โœ… Post-Deployment Verification

Check container status:

docker ps

Logs:

docker-compose -f docker-compose.prod.yml logs -f

๐Ÿ” Troubleshooting

1. .env File Missing

Create .env with:

POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=app

2. Port Conflicts

Stop other services or edit docker-compose.prod.yml to use different ports.

3. Healthcheck Failures

Restart services:

docker-compose up -d --force-recreate

4. Blank Frontend Page

Rebuild the frontend:

cd frontend
npm install && npm run build

๐Ÿ” Security Tools

  • Bandit: bandit -r backend
  • Trivy: trivy image devsecops-backend

โšก CI/CD Pipeline

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


๐Ÿ–ผ Architecture

[ React Frontend ] <---> [ FastAPI Backend ] <---> [ PostgreSQL DB ]
    (Vite Build)          (API + Auth)             (Persistent Data)
Docker Compose orchestrates all services.

๐Ÿ”ฎ Future Enhancements

  • JWT authentication & OAuth integration
  • Logging & Monitoring (ELK Stack)
  • Advanced DevSecOps tools (SAST, DAST)

๐Ÿ“œ License

MIT

About

DevSecOps Starter Kit is a ready-to-use template to set up a secure development pipeline with FastAPI, React, Docker, and GitHub Actions. It includes security checks, vulnerability scans, and automated deployments, helping developers implement DevSecOps best practices from day one.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages