A full-stack MERN (MongoDB, Express.js, React, Node.js) application with automated CI/CD pipeline, featuring user authentication, task management, and AWS deployment capabilities.
Note: This is a portfolio/demonstration project. Live demo instances have been taken down to manage costs, but the application can be deployed locally or to your own cloud infrastructure using the provided configuration.
- Features
- Tech Stack
- Architecture
- Quick Start
- Installation
- Environment Variables
- API Documentation
- Deployment
- CI/CD Pipeline
- Testing
- Contributing
- License
- JWT-based authentication with secure token management
- Password hashing using bcrypt
- Protected routes and middleware
- Input validation and sanitization
- CRUD operations for tasks (Create, Read, Update, Delete)
- Task prioritization (High, Medium, Low)
- Task completion tracking with timestamps
- User-specific task isolation
- Real-time statistics and progress tracking
- Material-UI components for professional design
- Responsive design for mobile and desktop
- Dark/Light theme support
- Loading states and error handling
- Form validation with user feedback
- Automated CI/CD pipeline with GitHub Actions
- AWS deployment configuration (EC2 + S3)
- Docker support for containerization
- Environment-based configuration
- Health checks and monitoring
- React 18 - Modern React with hooks
- Material-UI (MUI) - Component library
- React Router - Client-side routing
- Axios - HTTP client
- React Context - State management
- Node.js 18 - JavaScript runtime
- Express.js - Web framework
- MongoDB - NoSQL database
- Mongoose - Object modeling
- JWT - Authentication tokens
- bcrypt - Password hashing
- GitHub Actions - CI/CD pipeline
- PM2 - Process management
- AWS EC2 - Backend hosting capability
- AWS S3 - Frontend hosting capability
- Docker - Containerization
- ESLint - Code linting
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend API β β Database β
β (React/S3) ββββββ (Node.js/EC2) ββββββ (MongoDB) β
β β β β β β
β Material-UI β β Express + JWT β β Atlas/Local β
β Task Manager β β RESTful API β β Collections β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
β
βββββββββββββββββββ
β CI/CD Pipeline β
β (GitHub Actions)β
β β
β Automated β
β Testing & β
β Deployment β
βββββββββββββββββββ
- Node.js >= 18.0.0
- npm >= 8.0.0
- MongoDB (local or Atlas)
- Git
# Clone the repository
git clone https://github.com/ManuJB023/mern-cicd-app.git
cd mern-cicd-app
# Install all dependencies
npm run install-all
# Set up environment variables
cp server/.env.example server/.env
cp client/.env.example client/.env
# Start development servers
npm run devThe application will be available at:
- Frontend: http://localhost:3000
- Backend: http://localhost:5000
- API Health: http://localhost:5000/api/health
cd server
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret
# Start backend server
npm run devcd client
npm install
# Configure environment variables
cp .env.example .env
# Edit .env with your API URL
# Start frontend development server
npm start# From project root
npm run dev
# This starts both frontend and backend concurrentlyNODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/mernapp
JWT_SECRET=your_super_secret_jwt_keyREACT_APP_API_URL=http://localhost:5000/apiNODE_ENV=production
PORT=5000
MONGODB_URI=mongodb+srv://user:pass@cluster.mongodb.net/mernapp
JWT_SECRET=production_jwt_secret_keyPOST /api/auth/register
Content-Type: application/json
{
"username": "john_doe",
"email": "john@example.com",
"password": "securePassword123"
}POST /api/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "securePassword123"
}GET /api/auth/me
Authorization: Bearer <jwt_token>GET /api/tasks
Authorization: Bearer <jwt_token>POST /api/tasks
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"title": "Complete project",
"description": "Finish the MERN stack application",
"priority": "high"
}PATCH /api/tasks/:id
Authorization: Bearer <jwt_token>
Content-Type: application/json
{
"completed": true,
"priority": "medium"
}DELETE /api/tasks/:id
Authorization: Bearer <jwt_token>{
"success": true,
"data": { ... },
"message": "Operation successful"
}{
"success": false,
"error": "Error message",
"statusCode": 400
}# Install dependencies
npm run install-all
# Start development environment
npm run dev# Build and run with Docker Compose
docker-compose up --build
# Or run individual containers
docker build -t mern-backend ./server
docker build -t mern-frontend ./clientThe project includes configuration for AWS deployment:
- Backend deployment to EC2 with PM2 process management
- Frontend build deployment to S3 with static website hosting
- CI/CD pipeline for automated deployments
See deployment configuration files:
.github/workflows/deploy.yml- GitHub Actions workflowdocker-compose.yml- Container orchestrationserver/ecosystem.config.js- PM2 configuration
# Backend (Node.js server)
cd server
npm install --production
npm start
# Frontend (Static build)
cd client
npm run build
# Serve build folder with nginx or apacheThe project includes automated CI/CD pipeline that:
-
Continuous Integration
- Runs tests on multiple Node.js versions
- Builds frontend application
- Performs security audits
- Validates code quality
-
Deployment Stages
- Staging: Auto-deploy on
developbranch - Production: Auto-deploy on
masterbranch
- Staging: Auto-deploy on
-
Quality Gates
- All tests must pass
- Security vulnerabilities check
- Build validation
# .github/workflows/deploy.yml
name: MERN Stack CI/CD
on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master ]Set these in GitHub repository settings:
MONGODB_URI- Database connection stringJWT_SECRET- JWT signing secretAWS_ACCESS_KEY_ID- AWS credentialsAWS_SECRET_ACCESS_KEY- AWS credentials
cd server
npm testcd client
npm testnpm run test:integrationnpm run test:coveragenpm run dev # Start both frontend and backend
npm run server # Start backend only
npm run client # Start frontend onlynpm run build # Build frontend for production
npm run build:server # Build backend (if using TypeScript)npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage reportnpm run install-all # Install all dependencies
npm run clean # Clean node_modules and build files
npm run lint # Run ESLint
npm run format # Format code with PrettierWe welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests for new functionality
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow ESLint configuration
- Use Prettier for code formatting
- Write meaningful commit messages
- Add tests for new features
This project is licensed under the MIT License - see the LICENSE file for details.
- Create React App for the React boilerplate
- Material-UI for the component library
- Express.js for the web framework
- MongoDB for the database
- AWS for cloud infrastructure
If you have any questions or need help with setup, please:
- Check the Issues page
- Read the Documentation
- Create a new issue if needed
Portfolio project demonstrating full-stack development with modern DevOps practices
β Star this repository if you found it helpful!