A production-ready, DevSecOps-hardened coding platform built with React, Node.js/Express, PostgreSQL, and Redis β containerised with Docker, deployable on Kubernetes via Helm, and secured through a fully automated CI/CD pipeline.
- Overview
- Architecture
- Tech Stack
- Project Structure
- Quick Start
- Kubernetes Deployment
- Observability Stack
- Infrastructure (Terraform)
- CI/CD Pipeline
- Environment Variables
- Contributing
CodeForge is a full-stack competitive coding platform where users can:
- Browse and solve coding challenges through an in-browser Monaco editor
- Submit code that is evaluated asynchronously via a Redis job queue
- View real-time submission status through result polling
- Track their scores and ranking on a live leaderboard
The project is designed as a DevSecOps reference implementation, demonstrating a complete journey from local Docker Compose to a production-grade Kubernetes cluster on Azure AKS, with security baked into every stage of the pipeline.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CODEFORGE PLATFORM β
ββββββββββββββββ¬ββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββ€
β TIER 1 β TIER 2 β TIER 3 β TIER 4 β
β Frontend β Backend API β PostgreSQL β Redis β
β React + β Node.js + β Database β Cache + Job Queue β
β Monaco + β Express β β β
β Nginx β β β β
ββββββββββββββββ΄ββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββββ€
β Code Execution Worker β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Service | Technology | Port | Role |
|---|---|---|---|
frontend |
React + Nginx | 3000 | Monaco editor UI, routing, JWT auth |
backend |
Node.js + Express | 5000 | REST API, authentication, business logic |
postgres |
PostgreSQL 15 | 5432 | Users, challenges, submissions persistence |
redis |
Redis 7 | 6379 | Session cache, JWT blacklist, job queue |
worker |
Node.js | β | Async code evaluation via Redis queue |
| Layer | Technology |
|---|---|
| Frontend | React, Monaco Editor, Axios, Nginx |
| Backend | Node.js, Express, JWT, Winston |
| Database | PostgreSQL 15 |
| Cache / Queue | Redis 7 |
| Containerisation | Docker, Docker Compose |
| Orchestration | Kubernetes, Helm |
| Cloud | Azure AKS (via Terraform) |
| CI/CD | GitHub Actions |
| Security | GitLeaks, Semgrep (SAST), Trivy, npm Dependency-audit |
| Observability | Prometheus, Grafana, Alertmanager (kube-prometheus-stack) |
| GitOps | Argo CD |
| Ingress | NGINX Ingress |
| Gateway Api | NGINX Gateway Fabric |
codeforge/
βββ docker-compose.yml # Local orchestration of all 5 services
β
βββ frontend/ # TIER 1 β React Application
β βββ src/
β β βββ App.js # Router + auth wrapper
β β βββ api.js # Axios client with JWT interceptors
β β βββ context/
β β β βββ AuthContext.js # Global authentication state
β β βββ components/
β β β βββ Navbar.js
β β βββ pages/
β β βββ Home.js
β β βββ Challenges.js
β β βββ Editor.js # Monaco editor + submission polling
β β βββ Login.js
β β βββ Register.js
β β βββ Leaderboard.js
β βββ Dockerfile # Multi-stage: build β Nginx serve
β βββ .env.example
β βββ nginx.conf # Reverse proxy + security headers
β
βββ backend/ # TIER 2 β Express REST API
β βββ server.js # App bootstrap, middleware, routes
β βββ routes/
β β βββ auth.js # Register, login, logout, /me
β β βββ challenges.js # Challenge list + detail (Redis-cached)
β β βββ submissions.js # Submit code, poll results
β β βββ users.js # Leaderboard + profiles
β β βββ health.js # Health check endpoint
β βββ middleware/
β β βββ auth.js # JWT verification + Redis blacklist
β βββ config/
β β βββ db.js # PostgreSQL connection pool
β β βββ redis.js # Redis client + cache helpers
β β βββ logger.js # Winston structured logging
β β βββ init.sql # DB schema + seed data
β βββ package.json
β βββ Dockerfile # Multi-stage Node.js build
β
βββ worker/ # Code Execution Worker
β βββ worker.js # Redis BRPOP queue consumer
β βββ package.json
β βββ Dockerfile
β
βββ k8s/ # Raw Kubernetes manifests
β βββ namespace.yaml
β βββ configmap.yaml
β βββ secrets.yaml
β βββ network-policies.yaml # Default-deny + explicit allow rules
β βββ frontend.yaml
β βββ backend.yaml
β βββ worker.yaml
β βββ postgres.yaml
β βββ redis.yaml
β βββ ingress.yaml
β
βββ helm/ # Helm chart for parameterised deployment
β βββ codeforge/
β βββ Chart.yaml
β βββ values-dev.yaml # Dev environment overrides
β βββ values-prod.yaml # Production environment overrides
β βββ templates/
β βββ frontend.yaml
β βββ backend.yaml
β βββ worker.yaml
β βββ postgres.yaml
β βββ redis.yaml
β βββ configmap.yaml
β βββ secrets.yaml
β βββ ingress.yaml
β βββ network-policies.yaml
β
βββ terraform/ # Azure AKS cluster provisioning
β βββ main.tf
β
βββ automation/ # Bootstrap & observability scripts
β βββ dev_automation.sh # Installs Docker, kubectl, Minikube, Helm
β βββ obervability.sh # Deploys Prometheus, Grafana, Argo CD
β βββ gateway.yaml # NGINX Gateway Fabric HTTPRoute
β βββ ingress.yaml # Ingress resource
β βββ obs_route.yaml # Observability service routes
β βββ values.yaml # Shared Helm values
β
βββ .github/
βββ workflows/
βββ ci_security.yaml # Full CI/CD + security scanning pipeline
- Docker & Docker Compose
- Node.js 20+ (local dev only)
# 1. Clone the repository
git clone https://github.com/Yadav-SubratKumar/codeforge_devopsified.git
cd codeforge_devopsified
# 2. Copy environment variables
cp .env.example .env
# 3. Build and start all services
docker compose up --build
# 4. Open in browser
open http://localhost:3000All five services (frontend, backend, postgres, redis, worker) will start with health checks and restart policies.
If you're running locally with Minikube, the automation script handles all tool installation:
chmod +x automation/dev_automation.sh
./automation/dev_automation.sh
# Apply docker group changes without logging out
newgrp docker
# Start Minikube
minikube startThis installs Docker, kubectl, Minikube, and Helm.
# Create the namespace
kubectl apply -f k8s/namespace.yaml
# Apply all resources
kubectl apply -f k8s/
# Verify pods are running
kubectl get pods -n codeforgeThe Helm chart supports parameterised deployments across environments.
# Deploy to dev
helm upgrade --install codeforge ./helm/codeforge \
--namespace codeforge \
--create-namespace \
-f helm/codeforge/values-dev.yaml
# Deploy to production
helm upgrade --install codeforge ./helm/codeforge \
--namespace codeforge \
--create-namespace \
-f helm/codeforge/values-prod.yamlThe observability script sets up a full monitoring and GitOps stack:
chmod +x automation/obervability.sh
./automation/obervability.shThis deploys:
| Tool | Purpose | Access |
|---|---|---|
| Prometheus | Metrics collection | NodePort (patched) |
| Grafana | Dashboards & visualisation | NodePort (patched) |
| Alertmanager | Alerting | NodePort (patched) |
| Argo CD | GitOps continuous delivery | NodePort |
| NGINX Gateway | Kubernetes Gateway API ingress | β |
Retrieve credentials after deployment:
# Grafana admin password
kubectl get secret --namespace monitoring \
-l app.kubernetes.io/component=admin-secret \
-o jsonpath="{.items[0].data.admin-password}" | base64 --decode && echo
# Argo CD admin password
kubectl -n argocd get secret argocd-initial-admin-secret \
-o jsonpath="{.data.password}" | base64 -d && echoProvision an AKS cluster on Azure using the provided Terraform config:
cd terraform
# Authenticate with Azure
az login
# Initialise and apply
terraform init
terraform plan
terraform applyWhat it provisions:
- Resource group in East US
- Virtual network (
10.0.0.0/20) with a dedicated AKS subnet - AKS cluster with a single
Standard_B2msnode (system-assigned identity) - Azure CNI networking
After provisioning, configure kubectl:
az aks get-credentials --resource-group james --name my-aks-cluster
kubectl get nodesThe GitHub Actions pipeline (.github/workflows/ci_security.yaml) triggers on every push and pull request to main / develop (excluding changes to infra-only paths like k8s/, helm/, terraform/).
ββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ
β Secret Scan β β Backend Tests β β Frontend Tests & β
β (GitLeaks) β β (Jest + pg + β β Build β
β β β redis svc) β β β
ββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ
β β β
ββββββββββββββββββββββΌββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββ
β Dependency Audit (npm audit) β
β SAST (Semgrep β OWASP Top 10,β
β Node.js, JWT, Express rules) β
βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Build & Push Docker Images β
β to Docker Hub β
β (backend, frontend, worker) β
βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Container Scan (Trivy) β
β CRITICAL/HIGH CVEs β fail β
βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββ
β Update Image Tags in β
β k8s/ manifests & Helm values β
β β Commit & Push (GitOps) β
βββββββββββββββββββββββββββββββββ
| Key | Type | Description |
|---|---|---|
DOCKERHUB_TOKEN |
Secret | Docker Hub access token |
DOCKERHUB_USERNAME |
Variable | Docker Hub username |
| Tool | What it checks |
|---|---|
| GitLeaks | Secrets and credentials accidentally committed to git |
| Semgrep | SAST β OWASP Top 10, JWT misuse, Express vulnerabilities |
| npm audit | Known CVEs in backend, frontend, and worker dependencies |
| Trivy | Container image vulnerabilities (CRITICAL & HIGH severity) |
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes and commit:
git commit -m "feat: describe your change" - Push to your fork:
git push origin feature/your-feature - Open a Pull Request against
main
The CI pipeline will automatically run all security scans and tests on your PR.
This project is open source. See LICENSE for details.
