This is a simple Todo application with:
- Frontend: React (port 3000)
- Backend: Node.js/Express (port 8080)
- Database: PostgreSQL (port 5432)
- When running with docker-compose, the backend listens on port 8080 within the container and is mapped to the host (e.g., 8080).
Your task is to build a complete CI/CD pipeline around this application.
The codebase contains intentional bugs that you need to identify and fix:
- server.js - Multiple bugs marked with comments (6 bugs total!)
- Tests failing - 4 out of 7 tests will fail until you fix the code
- Missing functionality - DELETE and PUT endpoints not implemented
- Dockerfiles - Need to be completed (only skeleton/comments provided)
- docker-compose.yml - Incomplete, missing configurations
- Missing .dockerignore - You need to create these files
- No workflow file - You must create
.github/workflows/ci.ymlfrom scratch
- Bug #1: Wrong default password
- Bug #2: Missing validation for empty title
- Bug #3: Missing DELETE endpoint
- Bug #4: Missing PUT endpoint
- Bug #5: Server starts in test mode
- Bug #6: App not exported for tests
- Complete
backend/Dockerfile(multi-stage build) - Complete
frontend/Dockerfile(multi-stage build) - Create
.dockerignorefiles for both
- Add proper environment variables
- Add healthchecks for backend and postgres
- Add volume mounts for database persistence
- Mount init script for database
- Configure service dependencies with health conditions
- Create
.github/workflows/ci.yml - Configure build-and-test job with PostgreSQL service
- Configure Docker build and push to Docker Hub
- Configure deploy job with SSH
- Setup branch protection for main
- Add required secrets
- Configure PR review requirements
# Install dependencies
cd backend && npm ci
# Run tests (will fail until bugs are fixed!)
npm test
# Expected: 3 pass, 4 fail (until you fix the code)- Create a branch with failing code
- Open PR → Show CI failing (Red X)
- Fix the code → Push again
- Show CI passing (Green ✓)
- Get approval → Merge to main
- Show CD deploying automatically
- Verify live application updated