You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A REST API for storing code snippets and notes with tags, search functionality, and API key-based authentication. Built with Node.js, Express, and MongoDB.
This project includes a complete CI/CD pipeline using GitHub Actions.
Pipeline Overview
git push --> CI Pipeline --> DockerHub --> CD Pipeline --> Kubernetes (AWS EC2)
CI Pipeline Stages
Stage
Tool
Purpose
Linting
ESLint
Enforce code standards
SAST
CodeQL
Static security analysis
SCA
npm audit + Dependency-Check
Find vulnerable dependencies
Unit Tests
Jest
Validate business logic
Build
Docker
Create container image
Image Scan
Trivy
Scan for vulnerabilities
Runtime Test
curl
Container smoke test
Registry Push
DockerHub
Publish image
CD Pipeline Stages
Stage
Purpose
Deploy to K8s
SSH to EC2, restart pods
Health Check
Verify deployment
DAST
Security headers check
Quick Start
Prerequisites
Node.js 18+
MongoDB (local or Atlas)
Docker (optional)
Local Development
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your MongoDB connection string# Start development server
npm run dev
Using Docker
# Start with Docker Compose (includes MongoDB)
docker-compose up -d
# View logs
docker-compose logs -f app
GitHub Secrets Configuration
To enable CI/CD, add these secrets in GitHub (Settings > Secrets > Actions):
For CI Pipeline (DockerHub Push)
Secret
Description
DOCKERHUB_USERNAME
Your DockerHub username
DOCKERHUB_PASSWORD
Your DockerHub password
For CD Pipeline (EC2 Deployment)
Secret
Description
EC2_HOST
EC2 instance public IP
EC2_USER
SSH user (usually ubuntu)
EC2_SSH_KEY
Contents of your .pem file
Infrastructure Setup (Terraform)
Prerequisites
AWS CLI configured
Terraform installed
AWS key pair created
Deploy to AWS
cd terraform
# Initialize Terraform
terraform init
# Deploy (creates EC2 with K3s + MongoDB + Notes API)
terraform apply -var="key_name=your-key-pair-name"# Get app URL
terraform output app_url