Full-stack crypto portfolio tracker built with the MERN stack, containerized with Docker and deployed on AWS via Terraform and GitHub Actions CI/CD.
Explore the documentation »
View Architecture
·
Setup Guide
·
Report Issue
This crypto portfolio tracker was originally developed as a team project during a full-stack developer course.
The original frontend and backend codebases were built collaboratively and the build process is included in the commit history.
In this repository, the focus has been on optimizing and extending the existing application by adding:
- Docker containerization of backend and frontend
- A minimal Terraform infrastructure for AWS provisioning (EC2, Security Groups, IAM, OIDC)
- A complete GitHub Actions CI/CD pipeline using OIDC authentication
- Frontend (React + Nginx) → served on an AWS EC2 instance, load-balanced via AWS NLB
- Backend (Express API) → runs as a Docker container on the same host, available under
/api - Database (MongoDB Atlas) → secure managed service, IP-whitelisted for EC2
- Infrastructure → provisioned with Terraform (EC2, SGs, NLB, IAM, OIDC provider)
- CI/CD → GitHub Actions builds Docker images → pushes to ECR → deploys via SSM command
- AWS account with permissions to create:
- ECR repositories
- IAM roles & OIDC provider
- EC2, Security Groups and NLB
- Default VPC in your region or in the default region
eu-central-1 - Backend & Frontend ECR repository in the same region
- Terraform
>= 1.5 - GitHub repository for this project
- MongoDB Atlas cluster (with
MONGO_URIand whitelisted EC2 Public IP) - Coingecko API Key (
COINGECKO_KEY)
- Clone the repo and switch to the terraform folder:
git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>/terraformCreate terraform.tfvars file to define sensitive variables:
ecr_repo_frontend = "mern-docker-frontend"
ecr_repo_backend = "mern-docker-backend"
mongo_uri = "your-mongodb-uri"
coingecko_key = "your-coingecko-key"
github_owner = "your-github-username"
github_repo = "your-github-repo-name"Initialize and apply:
terraform init
terraform applyThis will create:
- EC2 instance (Ubuntu 24.04, with Docker, AWS CLI, SSM Agent installed) > Add EC2 public IP to the whitelist of your MongoDB cluster
- IAM role for GitHub OIDC
- Security Groups & Network Load Balancer
Note: ECR repositories must exist beforehand
Add the following repository secret from Terraform outputs under Git repository Settings > Secrets and variables > Actions:
AWS_ROLE_ARN - The ARN of the OIDC role created by Terraform (e.g., arn:aws:iam::<account_id>:role/gh-actions-mern-docker)
On push to main, GitHub Actions will:
- Assume the OIDC role in AWS
- Build backend & frontend Docker images
- Push them to ECR
- Trigger SSM command on EC2 > docker compose pull && docker compose up -d
Access the application via the NLB DNS name printed in Terraform outputs. API base path is /api.
- Requires existing ECR repositories
- MongoDB Atlas must have EC2 IP whitelisted
- Single EC2 host – no auto-scaling yet