This project uses GitHub Actions for continuous integration and deployment. The pipeline automatically runs tests, builds the TypeScript code, and can deploy to production.
- Push to main branch: Runs full CI/CD including deployment
- Pull requests to main: Runs CI only (no deployment)
- ✅ Installs Node.js 18
- ✅ Caches npm dependencies for faster builds
- ✅ Installs dependencies with
npm ci - ✅ Runs unit tests with
npm test - ✅ Builds TypeScript with
npm run build - ✅ Uploads build artifacts
- ✅ Downloads build artifacts
- ✅ Runs deployment (currently placeholder)
npm install --save-dev jest @types/jest ts-jest supertest @types/supertestAdd these secrets in GitHub repository settings → Security → Secrets:
For Render:
RENDER_API_KEYRENDER_SERVICE_ID
For Heroku:
HEROKU_API_KEY
For VPS:
HOSTUSERNAMESSH_PRIVATE_KEY
For Docker:
DOCKER_USERNAMEDOCKER_PASSWORD
Create .env file for local development:
NODE_ENV=development
PORT=3000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=7d
.github/workflows/main.yml- Main CI/CD pipeline.github/workflows/ci-cd.yml- Alternative comprehensive pipeline
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage- ✅ CI pipeline configured
- ⏳ Deployment configured (uncomment desired method)
- Render - Recommended for Node.js apps
- Heroku - Popular platform
- VPS/Server - Via SSH deployment
- Docker - Containerized deployment
- Choose your deployment method in
.github/workflows/main.yml - Uncomment the relevant deployment section
- Add required secrets to GitHub repository
- Push to main branch
- View pipeline status in GitHub Actions tab
- Build artifacts stored for 30 days
- Failed builds prevent deployment
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm start