A simple Node.js and Express API for managing orders.
Designed to run in AWS ECS and deployed via CodeDeploy or other CI/CD pipelines.
This application demonstrates a basic orders API using Express.
It exposes a health check endpoint and /api/orders endpoints to list and retrieve individual orders.
It is containerized using Docker and integrates with AWS ECS, ECR, and CodeDeploy for automated deployment.
Deployment uses AWS ECS with task definitions, ECR for Docker images, and CodeDeploy for orchestrating service updates.
- Push Docker images to AWS ECR
- Register new ECS task definitions
- Trigger ECS service updates via CodeDeploy
- Canary deployment for main branch, rolling updates for other branches
The GitHub Actions workflow (.github/workflows/build-and-deploy.yaml) automates:
- Branch environment detection
- main → prod (canary deployment)
- dev/test → dev (rolling update)
- AWS authentication via OIDC
- Docker build & push to ECR
- ECS task definition registration
- CodeDeploy deployment (canary/rolling)
- Deployment monitoring (optional polling until success/failure)
- GET /health → Returns OK status
curl http://localhost:8080/health
# OK
- GET /api/orders → Returns a list of all orders
curl http://localhost:8080/api/orders
# [
# { "id": 1, "item": "Laptop", "quantity": 1 },
# { "id": 2, "item": "Phone", "quantity": 2 },
# { "id": 3, "item": "Keyboard", "quantity": 3 }
# ]
- GET /api/orders/:id → Returns details of a single order
curl http://localhost:8080/api/orders/1
# { "id": 1, "item": "Monitor", "quantity": 1 }