A lightweight, robust, and custom-built CI/CD system designed for automating deployments for personal projects. This system listens for GitHub webhooks, verifies signatures, triggers remote deployment scripts on AWS EC2 via SSH, and provides real-time status updates via Telegram.
Important
This system is optimized for performance on memory-constrained environments (like AWS EC2 t2.micro) using swap-space strategies and efficient npm ci execution.
Check out how the system keeps you informed during deployments:
| Frontend Deployment | Backend Deployment |
|---|---|
![]() |
![]() |
The system is split into two main components:
- Role: Receives webhooks, validates GitHub signatures, and manages the deployment flow.
- Tech Stack: Node.js, Express, Axios (for Telegram),
child_process(for SSH). - Security: Implements
x-hub-signature-256verification to ensure requests only come from GitHub.
- Role: Hosts the actual Frontend and Backend applications.
- Tools: PM2 (Process Management), Nginx (Reverse Proxy).
- Optimization: Uses custom bash scripts for atomic updates and swap files for OOM (Out Of Memory) prevention.
- Git Push: Code is pushed to the
mainbranch. - Webhook Call: GitHub triggers a POST request to
/github-webhook. - Signature Verification: CI/CD server verifies the payload.
- Telegram - Started: An instant "Deployment Started" notification is sent.
- SSH Execution: CI/CD server executes
bash ~/deploy-frontend.shorbash ~/deploy-backend.shon the target server. - Remote Steps:
git pulllatest changes.npm ci(clean install) ifpackage-lock.jsonhas changed.pm2 reloadfor zero-downtime deployment.
- Health Check: The system verifies the app is LIVE.
- Telegram - Success: A detailed "Deployment Successful" message with commit hash and duration.
Custom-CI-CD-Server/
βββ assets/images/ # Deployment screenshots
βββ src/
β βββ controllers/ # Business logic for FE/BE webhooks
β βββ middlewares/ # GitHub signature verification
β βββ routes/ # Webhook and Health endpoints
β βββ services/ # Telegram notification service
β βββ utils/ # SSH/Deployer utilities
β βββ app.js # Express app configuration
β βββ server.js # Server entry point
βββ ecosystem.config.js # PM2 configuration
βββ README.MD # Project documentation
Create a .env file in the root based on .env.example:
PORT=3000
GITHUB_WEBHOOK_SECRET=your_secret_here
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHAT_ID=your_chat_id
DEPLOY_SERVER_USER=ubuntu
DEPLOY_SERVER_IP=your_target_ip- Payload URL:
http://<CICD_SERVER_IP>:3000/github-webhook/[frontend|backend] - Content Type:
application/json - Secret: Must match
GITHUB_WEBHOOK_SECRET.
On the target server, ensure your deployment scripts exist at ~/deploy-frontend.sh and ~/deploy-backend.sh.
- β
Automated Workflows: Zero manual intervention after
git push. - β Telegram Integration: Instant feedback loop in your pocket.
- β Security First: Cryptographic validation of all incoming webhooks.
- β Performance Focused: Minimal footprint, designed for small EC2 instances.
- β PM2 Integration: Zero-downtime reloads.
Developed with focus on Automation and Reliability by Varun Mendre

