This repository demonstrates a full-stack web application with an automated CI/CD pipeline using:
- React (Frontend)
- Node.js / Express (Backend)
- Docker (Multi-stage builds)
- docker-compose
- NGINX reverse proxy
- GitHub Actions for deployment via SSH
The setup focuses on production-grade containerization and seamless deployments.
- Frontend (React): Built and served by NGINX
- Backend (Node.js): API endpoints
- NGINX: Serves React app and proxies
/apito backend - docker-compose: Orchestrates services locally
- GitHub Actions: Automates deployment on
mainbranch push via SSH to remote server
Client
↓
┌───────┐
│ NGINX │
└──┬────┘
┌─────┴─────┐
│ │
┌───────────────┐ ┌──────────────┐
│ React Frontend│ │Node.js Backend│
└───────────────┘ └──────────────┘
NGINX handles static serving and API proxying.
| Component | Technology |
|---|---|
| Frontend | React |
| Backend | Node.js / Express |
| Reverse Proxy | NGINX |
| Containerization | Docker (multi-stage) |
| Orchestration | docker-compose |
| CI/CD | GitHub Actions (SSH deployment) |
- Frontend: Multi-stage Docker build producing optimized React static files served via
nginx:alpine - Backend: Multi-stage build with minimal image size
- Benefits: Small image sizes, faster builds, production-ready containers
Start all services:
docker-compose up -d --buildAccess:
- Frontend: http://localhost
- Backend API: http://localhost/api
- Triggered on pushes to
mainbranch - Uses SSH key stored in Repository Secrets (
SSH_PRIVATE_KEY,SERVER_IP,SERVER_USER) - SSH into remote server, pull latest code, rebuild containers, restart services
Example deploy command on server:
cd /mnt/c/Users/hp/Desktop/fullstack-ci-cd
git pull
docker-compose down
docker-compose up -d --buildAdd the following secrets in GitHub repo settings → Settings > Secrets and variables > Actions:
SSH_PRIVATE_KEY: Your private SSH key for authenticationSERVER_IP: IP address of the deployment serverSERVER_USER: SSH username
Developer pushes → GitHub Actions triggered
↓
Runner uses SSH key
↓
SSH connects to deployment server
↓
Pull latest code, rebuild, and restart containers
↓
✅ Application updated automatically
project/
│── frontend/
│ ├── Dockerfile
│ ├── src/
│
│── backend/
│ ├── Dockerfile
│ ├── src/
│
│── nginx/
│ ├── nginx.conf
│
│── docker-compose.yml
│── .github/workflows/deploy.yml
│── README.md
- Multi-stage Docker builds for optimized images
- Secrets managed securely via GitHub Actions
- SSH-based deployment avoids exposing sensitive credentials
- Reproducible local development with docker-compose
- Clear separation of frontend, backend, and proxy layers