Getting Started/Self Hosting
Self Hosting
Run Hatch in production on your own AWS account. Provision infrastructure with Terraform and deploy each service to ECS Fargate.
~30 MIN AWS COSTS APPLY TERRAFORM REQUIRED
What Gets Provisioned
Infrastructure created in infra/envs/dev:
VPC + Subnets
Isolated network with public/private pairs across 2 AZs
ECS Cluster
Fargate cluster for all user application tasks
Application Load Balancer
Traffic routing via path-based rules
AWS ECR
Private registry for built container images
RDS PostgreSQL 16
Managed relational database for app data
ElastiCache Redis
Managed Redis for log streaming
AWS Credentials
bash
aws configure
# AWS Access Key ID: your_access_key
# AWS Secret Access Key: your_secret_key
# Default region: ap-south-1Ensure your IAM principal has permissions for ECS, ECR, RDS, ElastiCache, IAM, and VPC management.
Terraform State Bucket
bash
aws s3 mb s3://hatch-terraform-state-<account-id> --region ap-south-1
aws s3api put-bucket-versioning --bucket hatch-terraform-state-<account-id> --versioning-configuration Status=EnabledProvision Infrastructure
bash
cd infra/envs/dev
terraform init
terraform plan
terraform applyConfigure Services
apps/deployer/.env
RABBITMQ_URL=amqp://guest:guest@<rabbitmq-host>:5672/
REDIS_URL=redis://<redis-endpoint>:6379
ECS_CLUSTER_NAME=hatch-cluster
ALB_LISTENER_ARN=arn:aws:elasticloadbalancing:...
ECR_REGISTRY=<account-id>.dkr.ecr.ap-south-1.amazonaws.comBuild & Push Images
bash
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin <account-id>.dkr.ecr.ap-south-1.amazonaws.com
docker build --platform linux/amd64 -t hatch-api ./apps/api
docker push <account-id>.dkr.ecr.ap-south-1.amazonaws.com/hatch-api:latestRun Migrations
bash
migrate -path packages/db/migrations -database "postgres://hatch:<password>@<rds-endpoint>:5432/hatch?sslmode=require" upDeploy to ECS
bash
aws ecs register-task-definition --cli-input-json file://infra/tasks/api.json
aws ecs create-service --cluster hatch-cluster --service-name hatch-api --task-definition hatch-api --desired-count 1 --launch-type FARGATEDeploy Frontend
Deploy the Next.js frontend to Vercel and point it to your production ALB.
env
NEXT_PUBLIC_API_URL=https://<your-alb-dns-name>Once healthy, your container becomes reachable at your ALB DNS with automated build log streaming.
Cost Estimates
| Service | ~Monthly |
|---|---|
| ALB | ~$20 |
| ECS Fargate | ~$20 |
| RDS PostgreSQL | ~$15 |
| ElastiCache Redis | ~$12 |
| ECR + Data | Variable |