A simple TypeScript web application that returns "Hello World". This app is containerised and ready for deployment.
- TypeScript-based Express web server
- Returns "Hello World" on the root endpoint
- Health check endpoint at
/health - Docker containerization
- Jest testing suite
- Node.js 20+ (for local development)
- Docker and Docker Compose (for containerised deployment)
Install dependencies:
npm installRun the app locally in development mode:
npm run devThe server will start on http://localhost:3000
Compile TypeScript to JavaScript:
npm run buildRun the compiled version:
npm startRun tests:
npm testGenerate coverage report:
npm run test:coveragedocker build -t interview-webapp .docker run -p 3000:3000 interview-webappFor local testing with Docker Compose:
docker-compose upGET /- Returns "Hello World"GET /health- Returns health status JSON:{"status": "ok"}
Once running, test the endpoints:
# Test Hello World endpoint
curl http://localhost:3000/
# Test health endpoint
curl http://localhost:3000/health.
├── src/
│ ├── app.ts # Express app configuration
│ ├── index.ts # Entry point
│ └── app.test.ts # Jest tests
├── dist/ # Compiled JavaScript (generated)
├── coverage/ # Test coverage reports (generated)
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── tsconfig.json # TypeScript configuration
├── jest.config.js # Jest configuration
├── package.json # Dependencies and scripts
└── README.md # This file
The following tasks should be completed as a take-home assignment. Allocate 30-60 minutes to complete the task. You will have access to this codebase the day before your interview to implement CI/CD workflows using GitHub Actions. Feel free to fork this repo generate a CI/CD in your forks GitHub actions, alternatively you could use tools like excalidraw to generate diagrams, write the yaml files, or use pseudo code.
Requirement: Every change must pass continuous integration checks before making its way to the master branch.
CI Must Verify:
- The TypeScript application compiles successfully
- All tests pass
- The Docker image can be built successfully
Points for discussion:
- What events should trigger CI? (push to feature branches, pull requests, etc.)
- How can you optimize build times?
- What information should developers see when CI fails?
Requirement: Changes merged to master should be deployed automatically to production.
CD Must Include:
- Deploy the application (you can mock this step with docker, or use pseudo code)
- Post-deployment verification:
- Verify the health check endpoint returns 200 status
- Notification when deployment or verification fails
- These notifications don't need to go anywhere real, printing to stdout is fine
Points for discussion: In a busy team repository with many daily commits to master, you need to consider:
- Deployment Triggers: How do you handle high-frequency commits? Should every commit trigger deployment?
- Concurrent Deployments: How do you handle multiple deployments triggered in quick succession?
- Rollback Strategy: If smoke tests fail, how do you handle rollback? How would you ensure a rollback reverts to exactly the previous deployment state rather than rebuilding an older commit?
- Environment Management: How would you extend this to handle different environments (staging vs production)?