Skip to content

krnmah/doap

Repository files navigation

TaskOps: A Devops Driven Todo App

A modern, full-stack to-do list web application with complete DevOps automation, built using React.js, Node.js, MongoDB, and deployed on AWS with Kubernetes.

Application Demo React Node.js MongoDB AWS Kubernetes

πŸš€ Features

  • πŸ“ Task Management: Create, update, delete, and mark tasks as complete
  • πŸ’Ύ Persistent Storage: MongoDB database for reliable data persistence
  • 🎨 Modern UI: Clean, responsive design with Material-UI components
  • πŸ”„ Real-time Updates: Instant UI updates for task operations
  • πŸ—οΈ Microservices Architecture: Separate frontend and backend services
  • 🐳 Containerized: Docker containers for consistent deployment
  • ☸️ Kubernetes Ready: Complete Kubernetes manifests for production deployment
  • πŸš€ CI/CD Pipeline: Automated Jenkins pipelines for build and deployment
  • πŸ”’ Security: VPC, security groups, and IAM roles for secure AWS deployment
  • πŸ“Š Monitoring: Health checks and monitoring endpoints
  • ⚑ Performance: Optimized builds and scalable infrastructure

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚    Backend      β”‚    β”‚    Database     β”‚
β”‚   (React.js)    │◄──►│  (Node.js/      │◄──►│   (MongoDB)     β”‚
β”‚   Port: 3000    β”‚    β”‚   Express)      β”‚    β”‚   Port: 27017   β”‚
β”‚                 β”‚    β”‚   Port: 3500    β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

  • Frontend: React.js 17.0.2, Material-UI 4.11.4, Axios
  • Backend: Node.js, Express.js 4.17.1, Mongoose 6.13.6
  • Database: MongoDB
  • DevOps: Docker, Kubernetes, Jenkins, Terraform
  • Cloud: AWS (VPC, EC2, ECR, S3, DynamoDB)
  • Monitoring: SonarQube, Health Check Endpoints

πŸ“‹ Prerequisites

  • Node.js 14.x or higher
  • npm or yarn
  • Docker and Docker Compose
  • MongoDB (local or cloud)
  • AWS Account (for cloud deployment)
  • Kubernetes cluster (for production deployment)
  • Jenkins server (for CI/CD)

πŸ› οΈ Quick Start

Local Development

1. Clone the Repository

git clone https://github.com/krnmaheshwari09/To-do-list-webApp.git
cd To-do-list-webApp

2. Setup Backend

cd Application-Code/backend
npm install
node index.js
# Backend runs on http://localhost:3500

3. Setup Frontend

cd Application-Code/frontend
npm install
npm start
# Frontend runs on http://localhost:3000

4. Setup Database

# Option 1: Local MongoDB
mongod --port 27017

# Option 2: Docker MongoDB
docker run -d -p 27017:27017 --name mongodb mongo:latest

Docker Development

1. Build and Run with Docker Compose

docker-compose up -d

2. Access Application

πŸš€ Production Deployment

AWS Infrastructure Setup

1. Deploy Jenkins Server

cd Jenkins-Server-TF
terraform init
terraform plan -var-file="variables.tfvars"
terraform apply -var-file="variables.tfvars"

2. Configure Jenkins

  • Access Jenkins at http://<jenkins-server-ip>:8080
  • Install required plugins (Node.js, Docker, AWS CLI)
  • Configure Jenkins pipelines using provided Jenkinsfiles

3. Deploy to Kubernetes

# Deploy database
kubectl apply -f Kubernetes-Manifests-file/Database/

# Deploy backend
kubectl apply -f Kubernetes-Manifests-file/Backend/

# Deploy frontend
kubectl apply -f Kubernetes-Manifests-file/Frontend/

# Configure ingress
kubectl apply -f Kubernetes-Manifests-file/ingress.yaml

πŸ“š API Documentation

Base URL

Development: http://localhost:3500
Production: https://your-domain.com

Endpoints

Health Checks

  • GET /healthz - Basic health check
  • GET /ready - Readiness check with database connection
  • GET /started - Startup verification

Task Management

  • GET /api/tasks - Get all tasks
  • POST /api/tasks - Create new task
  • PUT /api/tasks/:id - Update task completion status
  • DELETE /api/tasks/:id - Delete task

Example API Usage

# Get all tasks
curl -X GET http://localhost:3500/api/tasks

# Create a new task
curl -X POST http://localhost:3500/api/tasks \
  -H "Content-Type: application/json" \
  -d '{"task": "Complete project documentation"}'

# Update task completion
curl -X PUT http://localhost:3500/api/tasks/TASK_ID \
  -H "Content-Type: application/json" \
  -d '{"completed": true}'

# Delete a task
curl -X DELETE http://localhost:3500/api/tasks/TASK_ID

πŸ§ͺ Testing

Frontend Testing

cd Application-Code/frontend
npm test
npm test -- --coverage

Backend Testing

cd Application-Code/backend
# Manual API testing with curl commands
# Integration testing with frontend

E2E Testing

# Start all services
docker-compose up -d

# Test complete workflow
# 1. Access frontend at http://localhost:3000
# 2. Create, update, and delete tasks
# 3. Verify data persistence

πŸ“Š Monitoring

Health Checks

The application includes comprehensive health check endpoints:

  • Liveness: /healthz - Confirms the application is running
  • Readiness: /ready - Confirms database connectivity
  • Startup: /started - Confirms successful startup

Kubernetes Probes

livenessProbe:
  httpGet:
    path: /healthz
    port: 3500
  initialDelaySeconds: 30
  periodSeconds: 10

readinessProbe:
  httpGet:
    path: /ready
    port: 3500
  initialDelaySeconds: 5
  periodSeconds: 5

πŸ”’ Security

Application Security

  • CORS configuration for secure cross-origin requests
  • Input validation and sanitization
  • Error handling without sensitive information exposure

Infrastructure Security

  • VPC with private and public subnets
  • Security groups with minimal required ports (22, 80, 8080, 9000, 9090)
  • IAM roles and policies for AWS services
  • Container security best practices

πŸ“ˆ Performance

Optimization Features

  • Optimized React build for production
  • Efficient MongoDB queries with Mongoose
  • Container resource limits and requests
  • Kubernetes horizontal pod autoscaling
  • Load balancing with ingress controller

Scalability

  • Stateless frontend and backend design
  • Independent service scaling
  • Database replica sets support
  • Auto-scaling based on CPU/memory metrics

πŸ› οΈ Development Workflow

CI/CD Pipeline

  1. Source Control: GitHub repository with webhook triggers
  2. Build: Jenkins pipelines for frontend and backend
  3. Quality Gates: SonarQube code analysis
  4. Testing: Automated test execution
  5. Package: Docker image creation and ECR storage
  6. Deploy: Kubernetes deployment with rolling updates
  7. Monitor: Health checks and performance monitoring

Branch Strategy

  • main: Production-ready code
  • feature/*: Feature development branches
  • hotfix/*: Critical bug fixes

πŸ“ Project Structure

To-do-list-webApp/
β”œβ”€β”€ Application-Code/
β”‚   β”œβ”€β”€ frontend/          # React.js frontend application
β”‚   β”‚   β”œβ”€β”€ src/           # Source code
β”‚   β”‚   β”œβ”€β”€ public/        # Static assets
β”‚   β”‚   β”œβ”€β”€ package.json   # Dependencies and scripts
β”‚   β”‚   └── Dockerfile     # Frontend container
β”‚   └── backend/           # Node.js backend application
β”‚       β”œβ”€β”€ routes/        # API routes
β”‚       β”œβ”€β”€ models/        # Database models
β”‚       β”œβ”€β”€ package.json   # Dependencies and scripts
β”‚       └── Dockerfile     # Backend container
β”œβ”€β”€ Jenkins-Server-TF/     # Terraform infrastructure code
β”‚   β”œβ”€β”€ vpc.tf            # VPC and networking
β”‚   β”œβ”€β”€ backend.tf        # Terraform backend configuration
β”‚   └── variables.tf      # Variable definitions
β”œβ”€β”€ Jenkins-Pipeline-Code/ # CI/CD pipeline definitions
β”‚   β”œβ”€β”€ Jenkinsfile-Frontend
β”‚   └── Jenkinsfile-Backend
β”œβ”€β”€ Kubernetes-Manifests-file/ # Kubernetes deployment files
β”‚   β”œβ”€β”€ Frontend/         # Frontend K8s manifests
β”‚   β”œβ”€β”€ Backend/          # Backend K8s manifests
β”‚   β”œβ”€β”€ Database/         # Database K8s manifests
β”‚   └── ingress.yaml      # Ingress configuration
β”œβ”€β”€ ARCHITECTURE.md       # System architecture documentation
β”œβ”€β”€ TECHNICAL_SPECIFICATION.md # Technical specifications
β”œβ”€β”€ WORKFLOW.md          # Development and deployment workflows
└── README.md            # Project documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation for significant changes
  • Ensure all CI/CD checks pass

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™‹β€β™‚οΈ Support

For support and questions:

πŸ† Acknowledgments

  • React team for the amazing frontend framework
  • Express.js community for the robust backend framework
  • MongoDB for the flexible database solution
  • AWS for reliable cloud infrastructure
  • Kubernetes community for orchestration platform
  • Jenkins for powerful CI/CD automation

Built with ❀️ for modern web development and DevOps practices

About

End-to-end CI/CD pipeline with Jenkins, Docker & Kubernetes on AWS. Includes Terraform IaC, SonarQube analysis, and Grafana monitoring dashboards.

Topics

Resources

Stars

Watchers

Forks

Contributors