A comprehensive DevSecOps pipeline implementation for a full-stack travel blog application (Wanderlust) featuring automated security scanning, continuous integration/deployment, infrastructure as code, and container orchestration.
- Framework: React 18.2.0 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS with custom components
- Routing: React Router DOM
- Form Handling: React Hook Form with Zod validation
- UI Components: Lucide React icons, custom UI library
- Testing: Jest
- Runtime: Node.js with Express.js
- Database: MongoDB with Mongoose ODM
- Caching: Redis
- Authentication: JWT with bcryptjs
- Testing: Jest with comprehensive coverage
- Security: CORS, compression, cookie-parser
- Containerization: Docker & Docker Compose
- Orchestration: Kubernetes
- CI/CD: Jenkins with shared libraries
- Infrastructure: Terraform (AWS EC2)
- Security Scanning: Trivy, OWASP Dependency Check, SonarQube
- Version Control: Git with GitHub
devSecOps-Pipeline/
βββ π§ Automations/ # Deployment automation scripts
βββ π backend/ # Node.js Express API
β βββ api/ # API endpoints
β βββ config/ # Database & utility configs
β βββ controllers/ # Business logic controllers
β βββ models/ # MongoDB data models
β βββ routes/ # Express route definitions
β βββ services/ # External service integrations
β βββ tests/ # Unit & integration tests
β βββ utils/ # Helper utilities
βββ π¨ frontend/ # React TypeScript application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Application pages
β β βββ layouts/ # Layout components
β β βββ utils/ # Frontend utilities
β β βββ types/ # TypeScript type definitions
β βββ public/ # Static assets
βββ ποΈ database/ # Database configurations
βββ βΈοΈ kubernetes/ # K8s deployment manifests
βββ ποΈ terraform/ # Infrastructure as Code
βββ π GitOps/ # GitOps workflow definitions
βββ π³ docker-compose.yml # Local development setup
βββ π Jenkinsfile # CI/CD pipeline definition
βββ π README.md # Project documentation
- Node.js (v18+)
- Docker & Docker Compose
- MongoDB (for local development)
- Redis (for caching)
git clone https://github.com/DetonatorC4/devSecOps-Pipeline.git
cd devSecOps-Pipeline# Install all dependencies (root, backend, frontend)
npm run installer
# Or install individually
npm install # Root dependencies
npm run install-backend # Backend dependencies
npm run install-frontend # Frontend dependenciesCreate environment files:
Backend (backend/.env):
MONGODB_URI=mongodb://localhost:27017/wanderlust
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-jwt-secret
PORT=8080
NODE_ENV=developmentFrontend (frontend/.env):
VITE_API_URL=http://localhost:8080/api
VITE_APP_NAME=Wanderlust# Start all services locally
npm start
# Or start services individually
npm run start-backend # Backend on :8080
npm run start-frontend # Frontend on :5173# Start all services with Docker Compose
docker-compose up -d
# Services will be available at:
# Frontend: http://localhost:5173
# Backend: http://localhost:31100
# MongoDB: localhost:27017
# Redis: localhost:6379-
Trivy Filesystem Scan
- Scans source code for vulnerabilities
- Checks container images for security issues
- Integrated into Jenkins pipeline
-
OWASP Dependency Check
- Analyzes project dependencies
- Identifies known vulnerabilities
- Generates detailed security reports
-
SonarQube Code Analysis
- Static code analysis
- Code quality metrics
- Security hotspot detection
- Quality gate enforcement
flowchart TD
A[Code Commit] --> B[Jenkins Trigger]
B --> C[Workspace Cleanup]
C --> D[Code Checkout]
D --> E[Trivy Filesystem Scan]
E --> F[OWASP Dependency Check]
F --> G[SonarQube Analysis]
G --> H{Quality Gates Pass?}
H -->|Yes| I[Environment Setup]
H -->|No| Z[Pipeline Fails]
I --> J[Parallel Build]
J --> K[Frontend Build]
J --> L[Backend Build]
K --> M[Docker Build & Push]
L --> M
M --> N[Deploy to Kubernetes]
N --> O[Health Check]
O --> P[Pipeline Success]
- Parallel Execution: Frontend & Backend builds
- Security Gates: Automated security scanning
- Quality Assurance: Code quality enforcement
- Artifact Management: Automated artifact archiving
- Deployment Automation: Seamless deployment to Kubernetes
- Provider: AWS
- Region: ap-south-1 (configurable)
- Instance Type: t2.large (configurable)
- Infrastructure: EC2 instances for Jenkins & K8s clusters
cd terraform/
terraform init
terraform plan
terraform applyThe project includes comprehensive Kubernetes manifests for:
- Application Pods: Frontend & Backend deployments
- Services: Load balancing and service discovery
- Persistent Storage: MongoDB data persistence
- ConfigMaps & Secrets: Configuration management
- Redis Cache: Session and data caching
# Apply all Kubernetes manifests
kubectl apply -f kubernetes/
# Monitor deployment
kubectl get pods -w
kubectl get services- Frontend Service: Web application interface
- Backend Service: API endpoints
- MongoDB Service: Database with persistent storage
- Redis Service: Caching layer
cd backend/
npm test # Run all tests
npm run test -- --coverage # Run with coverage reportcd frontend/
npm test # Run Jest tests
npm run lint # ESLint analysis- Unit Tests: Controller and utility functions
- Integration Tests: API endpoint testing
- Component Tests: React component testing
- Health Checks: Built-in application health endpoints
- Logging: Structured logging with different levels
- Metrics: Performance and usage metrics collection
- Container Metrics: Docker container resource usage
- Kubernetes Metrics: Pod and service health monitoring
- Security Metrics: Vulnerability scan results
- Multi-stage builds for optimized images
- Environment-specific configurations
- Health checks for container monitoring
- Resource limits for production deployments
- Resource quotas and limits
- Rolling updates for zero-downtime deployments
- Horizontal Pod Autoscaling for load management
- Network policies for security
docker-compose up -d# Deploy to staging Kubernetes cluster
kubectl apply -f kubernetes/ --namespace=staging# Production deployment through Jenkins CD pipeline
# Triggered automatically after successful CI pipeline- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
