MERN Stack Deployment Pipeline

Automated container deployment with security scanning and quality checks using Gitlab CI

Deployment Architecture Diagram

Project Overview

Designed and implemented a comprehensive deployment pipeline for a MERN (MongoDB, Express, React, Node.js) stack application, leveraging Docker for containerization and GitLab CI/CD for automation. The solution incorporates security scanning, quality gates, and artifact management to ensure reliable deployments.

Core Components

Containerization

Packaged the application components (frontend, backend, database) as isolated Docker containers with proper networking and persistent storage for the database.

Security Scanning

Integrated Trivy for vulnerability scanning at both the filesystem and container image levels, with detailed reporting.

Quality Gates

Implemented SonarQube analysis to enforce code quality standards before deployment.

Automated Pipeline

Configured a 5-stage GitLab CI/CD workflow with parallel execution where possible.

Implementation Details

Container Architecture

The solution uses Docker Compose to manage three main services:

  • Frontend: React application served on port 5173
  • Backend: Node.js/Express API on port 5050
  • Database: MongoDB with persistent volume storage

Pipeline Stages

  1. Build: Installs dependencies and prepares artifacts
  2. Security Scan: Runs Trivy and SonarQube analysis
  3. Docker Build: Creates container images with pipeline IDs
  4. Image Scan: Checks built images for vulnerabilities
  5. Deployment: Pushes approved images to registry

Key Features

  • Artifact passing between pipeline stages
  • Parallel execution of frontend/backend jobs
  • Multiple GitLab runners for efficient resource use
  • Security gates to prevent vulnerable deployments

Key Achievements

  • Designed and implemented a production-ready backend API
  • Implemented secure JWT authentication system
  • Created comprehensive CRUD operations for posts
  • Developed interactive voting system
  • Containerized application with Docker and Docker Compose
  • Configured PostgreSQL with proper persistence
  • Followed best practices for FastAPI development

Work Samples

CI/CD Pipeline Screenshots

GitLab CI images

7 images