A production-ready fullstack application deployed on AWS ECS with enterprise-grade features
π Live Demo β’ π Documentation β’ π Quick Start β’ ποΈ Architecture
π₯ Modern Tech Stack
- Backend: Node.js + Express.js API
- Frontend: Next.js + React SPA
- Infrastructure: Terraform IaC
- Containerization: Docker & Docker Compose
- Cloud: AWS ECS + ECR + ALB
π‘οΈ Enterprise Security
- SSL/HTTPS encryption
- CORS protection
- Non-root containers
- VPC network isolation
- IAM roles and policies
β‘ Production Ready
- Auto-scaling capabilities
- Health check monitoring
- Load balancer integration
- CloudWatch logging
- CI/CD pipeline with GitHub Actions
π― Developer Experience
- Hot reload development
- Multi-stage Docker builds
- Infrastructure as Code
- Automated deployments
- PR checks and validation
graph TB
subgraph "GitHub"
REPO[Repository]
ACTIONS[GitHub Actions<br/>CI/CD Pipeline]
end
subgraph "AWS Cloud"
ALB[Application Load Balancer<br/>SSL/HTTPS]
subgraph "ECS Cluster"
API[Node.js API<br/>Port 3001]
WEB[Next.js Frontend<br/>Port 3000]
end
subgraph "Container Registry"
ECR1[ECR: API Image]
ECR2[ECR: Frontend Image]
end
subgraph "Infrastructure"
TF[Terraform State]
IAM[IAM Roles]
VPC[VPC & Networking]
end
CW[CloudWatch<br/>Logs & Monitoring]
end
USER[π€ Users] --> ALB
ALB --> API
ALB --> WEB
WEB --> API
API --> CW
WEB --> CW
ECR1 --> API
ECR2 --> WEB
REPO --> ACTIONS
ACTIONS --> ECR1
ACTIONS --> ECR2
ACTIONS --> TF
- Docker & Docker Compose
- AWS CLI configured
- Terraform (for infrastructure)
- Node.js 18+ (optional for local dev)
# Clone the repository
git clone https://github.com/AKRAMSOUIDA/ECS_fullstack_app-.git
cd ECS_fullstack_app-
# Start all services
docker compose up --build
# π Access your applications
# Frontend: http://localhost:3000
# API: http://localhost:3001# Navigate to Terraform directory
cd Terraform
# Initialize Terraform
terraform init
# Plan deployment
terraform plan
# Deploy infrastructure
terraform apply- Fork this repository
- Set up AWS credentials in GitHub Secrets
- Push to main branch - automatic deployment!
ECS_fullstack_app-/
βββ π§ api/ # Node.js Express API
β βββ server.js # Main server application
β βββ package.json # Dependencies & scripts
β βββ Dockerfile # Container configuration
βββ π¨ frontend/ # Next.js React App
β βββ pages/ # Application pages
β βββ components/ # Reusable components
β βββ public/ # Static assets
β βββ package.json # Dependencies & scripts
β βββ Dockerfile # Container configuration
βββ ποΈ Terraform/ # Infrastructure as Code
β βββ main.tf # Main Terraform configuration
β βββ modules/ # Reusable Terraform modules
β β βββ ecr/ # Container registry
β β βββ ecs/ # Container orchestration
β β βββ alb/ # Load balancer
β βββ deploy.sh # Deployment script
βββ π .github/workflows/ # CI/CD Pipelines
β βββ deploy.yml # Deployment workflow
β βββ terraform.yml # Infrastructure workflow
β βββ pr-check.yml # PR validation
βββ π³ docker-compose.yml # Local development
βββ π deployment-guide.md # Deployment instructions
βββ π README.md # You are here!
GET /health{
"status": "OK",
"timestamp": "2025-06-27T08:00:00.000Z"
}GET /api/users # Get all users
POST /api/users # Create new userExample Response:
[
{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
}
]
|
|
|
|
| Variable | Description | Default |
|---|---|---|
NODE_ENV |
Environment mode | development |
PORT |
Server port | 3001 |
NEXT_PUBLIC_API_URL |
API endpoint URL | http://localhost:3001 |
AWS_REGION |
AWS deployment region | us-east-1 |
| Secret | Description |
|---|---|
AWS_ACCESS_KEY_ID |
AWS access key |
AWS_SECRET_ACCESS_KEY |
AWS secret key |
AWS_REGION |
AWS region |
- Container: Multi-stage Docker builds
- Frontend: Static generation & code splitting
- Caching: Efficient Docker layer caching
- Resources: Proper CPU/memory limits
- Auto-scaling: Based on CPU/memory metrics
- Health Checks: Container & application level
- Logging: Structured JSON logs to CloudWatch
- Metrics: CPU, memory, and custom metrics
- Alerts: Automated monitoring alerts
- Dashboards: CloudWatch dashboards
| Method | Use Case | Complexity | Features |
|---|---|---|---|
| Terraform | Production IaC | Medium | Full control, versioning |
| GitHub Actions | Automated CI/CD | Low | Auto-deployment |
| Manual ECS | Learning/Testing | High | Step-by-step control |
- π SSL/HTTPS: End-to-end encryption with ACM certificates
- π CORS: Proper cross-origin handling
- π³ Container Security: Non-root users, minimal images
- π Environment Variables: Secure config management
- π VPC: Isolated network environment
- π€ IAM: Least privilege access policies
- β©οΈ HTTP Redirect: Automatic HTTPS redirect
- π Security Groups: Network-level firewall rules
-
PR Checks (
pr-check.yml)- Code linting and testing
- Docker build validation
- Security scanning
-
Terraform (
terraform.yml)- Infrastructure validation
- Plan and apply changes
- State management
-
Deployment (
deploy.yml)- Build and push Docker images
- Deploy to ECS
- Health check validation
- π Deployment Guide
- ποΈ Terraform Documentation
- π§ Terraform Structure
- π GitHub Actions Setup
- π Secrets Configuration
We welcome contributions! Here's how to get started:
- π΄ Fork the repository
- πΏ Create a feature branch (
git checkout -b feature/amazing-feature) - π» Make your changes
- π§ͺ Test locally with
docker compose up - π Commit your changes (
git commit -m 'Add amazing feature') - π Push to the branch (
git push origin feature/amazing-feature) - π― Open a Pull Request
- Follow existing code style
- Add tests for new features
- Update documentation as needed
- Ensure Docker builds pass
- Test infrastructure changes
- Add database integration (RDS)
- Implement authentication (Cognito)
- Add monitoring dashboards
- Multi-environment support
- Blue/Green deployments
- Cost optimization features
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using AWS services
- Powered by modern web technologies
- Inspired by cloud-native best practices
- Community-driven development