Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ DevSecOps CI/CD Pipeline Template

Reusable DevSecOps pipeline template with GitHub Actions, automated security scanning, testing, and multi-platform deployment

CI/CD Pipeline License Version

🎯 Overview

This repository provides a complete DevSecOps CI/CD pipeline template that can be easily integrated into any JavaScript/Node.js project. The pipeline implements industry best practices for security, testing, and deployment automation.

🌟 Key Features

  • πŸ›‘οΈ Automated Security Auditing - Dependency scanning and vulnerability detection
  • πŸ§ͺ Comprehensive Testing Pipeline - Unit, integration, and coverage testing
  • πŸ—οΈ Multi-stage Build Process - Optimized builds with artifact management
  • πŸš€ Multi-Platform Deployment - Vercel, GitHub Pages, and custom targets
  • πŸ“Š Performance Monitoring - Build metrics and deployment tracking
  • πŸ”’ Security Headers - CSP, HSTS, and modern security implementations
  • πŸ”„ Reusable Workflows - Easy integration into existing projects

πŸ—οΈ Pipeline Architecture

graph TD
    A[πŸ“₯ Trigger: Push/PR] --> B[πŸ” Security Audit]
    B --> C[🧹 Code Quality Check]
    C --> D[πŸ§ͺ Run Tests]
    D --> E[πŸ“Š Coverage Report]
    E --> F[πŸ—οΈ Build Application]
    F --> G[πŸ“¦ Create Artifacts]
    G --> H{Branch?}
    H -->|main| I[πŸš€ Production Deploy]
    H -->|PR| J[πŸ” Preview Deploy]
    I --> K[πŸ“‹ Notifications]
    J --> K
Loading

πŸš€ Quick Start

1. Copy Pipeline Files

Copy these files to your project:

# Create workflow directory
mkdir -p .github/workflows

# Copy main pipeline
curl -o .github/workflows/ci-cd.yml https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/.github/workflows/ci-cd.yml

# Copy deployment workflow (optional)
curl -o .github/workflows/deploy.yml https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/.github/workflows/deploy.yml

2. Configure for Your Project

Update the pipeline configuration in .github/workflows/ci-cd.yml:

env:
  NODE_VERSION: '18'  # Change to your Node.js version
  BUILD_COMMAND: 'npm run build'  # Your build command
  TEST_COMMAND: 'npm run test:run'  # Your test command

3. Setup Deployment (Optional)

For Vercel deployment, add these secrets to your GitHub repository:

  • VERCEL_TOKEN - Your Vercel token
  • VERCEL_ORG_ID - Your Vercel organization ID
  • VERCEL_PROJECT_ID - Your Vercel project ID

4. Customize Security Configuration

Copy and customize the security configuration:

curl -o vercel.json https://raw.githubusercontent.com/iabreuIjam99/devsecops-pipeline-template/main/vercel.json

πŸ“‹ Pipeline Stages

πŸ” Security Stage

  • npm audit: Dependency vulnerability scanning
  • ESLint: Code quality and security linting
  • Risk Assessment: Configurable security thresholds

πŸ§ͺ Testing Stage

  • Unit Tests: Component and function testing
  • Integration Tests: End-to-end workflow testing
  • Coverage Reports: Test coverage analysis with artifacts

πŸ—οΈ Build Stage

  • Production Build: Optimized application building
  • Asset Optimization: Image and bundle optimization
  • Artifact Management: Build output preservation

πŸš€ Deployment Stage

  • Preview Deployments: PR-based preview environments
  • Production Deployment: Main branch automatic deployment
  • Multi-Platform: Support for Vercel, GitHub Pages, AWS, etc.

πŸ› οΈ Supported Technologies

Frontend Frameworks

  • βœ… React (Vite, CRA, Next.js)
  • βœ… Vue.js (Vite, Nuxt.js)
  • βœ… Angular
  • βœ… Svelte/SvelteKit
  • βœ… Static Sites (HTML/CSS/JS)

Testing Frameworks

  • βœ… Vitest
  • βœ… Jest
  • βœ… Cypress
  • βœ… Playwright
  • βœ… Testing Library

Deployment Platforms

  • βœ… Vercel
  • βœ… GitHub Pages
  • βœ… AWS S3/CloudFront
  • βœ… Netlify
  • βœ… Azure Static Web Apps

πŸ”§ Configuration Options

Environment Variables

Variable Description Default Required
NODE_VERSION Node.js version 18 No
BUILD_COMMAND Build command npm run build No
TEST_COMMAND Test command npm run test:run No
AUDIT_LEVEL Security audit level moderate No

Security Configuration

{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        {"key": "X-Content-Type-Options", "value": "nosniff"},
        {"key": "X-Frame-Options", "value": "DENY"},
        {"key": "Strict-Transport-Security", "value": "max-age=31536000"}
      ]
    }
  ]
}

πŸ“Š Pipeline Metrics & Monitoring

The pipeline provides comprehensive metrics:

  • ⏱️ Build Duration: Average execution time tracking
  • πŸ“ˆ Test Coverage: Coverage percentage reporting
  • πŸ”’ Security Score: Vulnerability assessment results
  • πŸ“¦ Bundle Size: Asset size optimization tracking
  • πŸš€ Deployment Status: Success/failure rates

🎯 DevSecOps Best Practices

βœ… Implemented Practices

  1. Shift-Left Security

    • Early vulnerability detection
    • Automated security scanning
    • Security-first pipeline design
  2. Test Automation

    • Multi-level testing strategy
    • Coverage requirements
    • Automated test execution
  3. Infrastructure as Code

    • Version-controlled pipelines
    • Reproducible environments
    • Environment parity
  4. Continuous Integration

    • Automated builds
    • Quality gates
    • Fast feedback loops
  5. Continuous Deployment

    • Automated deployments
    • Preview environments
    • Rollback capabilities

πŸ”— Example Implementations

React + Vite Project

# Minimal configuration for React/Vite
env:
  NODE_VERSION: '18'
  BUILD_COMMAND: 'npm run build'
  TEST_COMMAND: 'npm run test:run'

Next.js Project

# Configuration for Next.js
env:
  NODE_VERSION: '18'
  BUILD_COMMAND: 'npm run build'
  TEST_COMMAND: 'npm run test'

Vue.js Project

# Configuration for Vue.js
env:
  NODE_VERSION: '18'
  BUILD_COMMAND: 'npm run build'
  TEST_COMMAND: 'npm run test:unit'

πŸ“š Documentation

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Code of Conduct
  • Development Process
  • Pull Request Process
  • Issue Reporting

πŸ“„ License

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

🌟 Real-World Usage

This pipeline is actively used in production by:

  • DevSecOps Portfolio: Live Demo | Source
  • Enterprise Projects: Multiple client implementations
  • Open Source Projects: Community adoptions

πŸ“ž Support & Contact


Created by: Isai Abreu | DevSecOps Engineer Jr
License: MIT | Version: 1.0.0

πŸš€ Ready to implement DevSecOps in your projects? Start with this template and customize for your needs!

About

Reusable DevSecOps CI/CD pipeline template

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages