A portfolio project demonstrating distributed tracing and observability using OpenTelemetry, microservices, Docker, and Terraform on AWS.
This project showcases:
- Microservices Architecture - 4 TypeScript services with REST APIs
- Distributed Tracing - OpenTelemetry instrumentation across all services
- Async Processing - Redis queue with trace context propagation
- Serverless Integration - AWS Lambda with tracing
- Container Orchestration - Docker Compose for local dev, ECS Fargate for production
- Infrastructure as Code - Terraform for AWS deployment
βββββββββββββββ
β Client β
ββββββββ¬βββββββ
β
v
βββββββββββββββββββ
β API Gateway ββββββββββββββββ
β (Port 3000) β β
ββββββββββ¬βββββββββ β
β β
ββββββ΄βββββ β
β β β
v v v
βββββββββββ βββββββββββ βββββββββββ
β User β β Order β β Lambda β
β Service β β Service β βValidatorβ
β :3001 β β :3002 β βββββββββββ
βββββββββββ ββββββ¬βββββ
β
v
βββββββββββ
β Redis β
β Queue β
ββββββ¬βββββ
β
v
βββββββββββββββ
βNotification β
β Service β
β :3003 β
βββββββββββββββ
β
v
βββββββββββββββ
β Jaeger β
β (Tracing UI)β
β :16686 β
βββββββββββββββ
- Node.js 20+
- Docker & Docker Compose
- AWS CLI (for deployment)
- Terraform (for infrastructure)
- Clone and setup
git clone <repository>
cd observability- Start all services
docker-compose up --build- Access services
- API Gateway: http://localhost:3000
- Jaeger UI: http://localhost:16686
- User Service: http://localhost:3001
- Order Service: http://localhost:3002
- Notification Service: http://localhost:3003
# Create a user
curl -X POST http://localhost:3000/api/users \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
# Create an order (triggers full trace across services)
curl -X POST http://localhost:3000/api/orders \
-H "Content-Type: application/json" \
-d '{
"userId": 1,
"items": ["Product A", "Product B"],
"total": 149.99
}'
# View trace in Jaeger
open http://localhost:16686observability/
βββ services/
β βββ api-gateway/ # Entry point service
β βββ user-service/ # User management
β βββ order-service/ # Order processing + queue
β βββ notification-service/ # Queue consumer
βββ lambda/ # Serverless function
β βββ src/index.ts # Order validator
βββ infrastructure/
β βββ terraform/ # AWS deployment
βββ configs/ # Shared OpenTelemetry config
βββ docker-compose.yml # Local orchestration
βββ PLAN.md # Implementation plan
βββ TASKS.md # Detailed task list
- Automatic: HTTP requests, database calls, Redis operations
- Manual: Custom business logic spans
- Context Propagation: Traces flow across service boundaries and queues
- API Gateway β User Service - Simple request flow
- API Gateway β Order Service β User Service - Multi-service call
- Order Service β Redis β Notification Service - Async processing
- API Gateway β Lambda - Serverless integration
- View end-to-end request traces
- Analyze service dependencies
- Identify performance bottlenecks
- Track error propagation
cd services/api-gateway
npm install
npm run build
npm startnpm run dev # Uses ts-nodecd lambda
npm install
npm run build # Creates lambda.zipexport AWS_ACCOUNT_ID="your-account-id"
export AWS_REGION="us-east-1"
# Login to ECR
aws ecr get-login-password --region $AWS_REGION | \
docker login --username AWS --password-stdin \
$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
# Build and push
./infrastructure/scripts/build-and-push.shcd infrastructure/terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars
terraform init
terraform plan
terraform applyterraform output api_gateway_url
terraform output lambda_function_nameaws logs tail /ecs/observability-demo --followcurl http://<alb-dns>/healthaws lambda invoke \
--function-name observability-demo-order-validator \
--payload '{"body":"{\"userId\":1,\"items\":[\"test\"],\"total\":99.99}"}' \
response.jsonUsers
# Get all users
GET /api/users
# Get user by ID
GET /api/users/:id
# Create user
POST /api/users
{
"name": "Jane Doe",
"email": "jane@example.com"
}Orders
# Get all orders
GET /api/orders
# Get order by ID (includes user data)
GET /api/orders/:id
# Create order (validates user, publishes to queue)
POST /api/orders
{
"userId": 1,
"items": ["Item 1", "Item 2"],
"total": 99.99
}This project demonstrates:
- TypeScript in production microservices
- OpenTelemetry SDK integration
- Distributed tracing patterns
- Service-to-service communication
- Async messaging with trace context
- Container orchestration
- Infrastructure as Code
- Serverless observability
- PLAN.md - Overall strategy and architecture decisions
- TASKS.md - Detailed implementation checklist
- infrastructure/terraform/README.md - Deployment guide
- lambda/README.md - Lambda function details
- ECS Fargate: ~$30-50/month (minimal CPU/memory)
- ALB: ~$16/month
- NAT Gateway: ~$32/month
- Lambda: Free tier eligible
- CloudWatch: Free tier eligible
Total: ~$80-100/month (can be reduced using spot instances)
docker-compose down -vcd infrastructure/terraform
terraform destroy- No authentication/authorization
- Public ALB with HTTP only
- No secret management
- Basic security groups
- No WAF or DDoS protection
For production:
- Add AWS WAF
- Use HTTPS with ACM certificates
- Implement AWS Secrets Manager
- Add API authentication (JWT, API keys)
- Enable VPC Flow Logs
- Implement proper IAM policies
This is a portfolio project, but feedback is welcome!
MIT
Portfolio project by [Your Name]
- GitHub: [your-github]
- LinkedIn: [your-linkedin]
Built with: TypeScript β’ Node.js β’ Express β’ OpenTelemetry β’ Jaeger β’ Redis β’ Docker β’ AWS ECS β’ Lambda β’ Terraform