A complete full-stack expense splitting platform with mobile app, backend API, marketing website, and cloud infrastructure. This repository contains all components needed to deploy and maintain a comprehensive expense sharing solution.
This project consists of four main components that work together to provide a complete expense splitting solution:
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Marketing β β Mobile App β β Backend API β
β Website β β (Client) β β (Services) β
β β β β β β
β Brand Image β β Expense Splittingβ β User Management β
β App Downloads β β Friend Managementβ β Friend System β
β Information β β Group Creation β β Group Managementβ
βββββββββββββββββββ β Balance Trackingβ β Expense Trackingβ
βββββββββββββββββββ β Balance Calc β
βββββββββββββββββββ
β
βββββββββββββββββββ
β Cloud Infrastructureβ
β (Terraform) β
β β
β GCP Deployment β
β VPC & Networkingβ
β DNS Management β
β VM + Kubernetes β
βββββββββββββββββββ
Internet β Load Balancer β VM Instances (2-10) β MongoDB
(SSL/TLS) (Auto-scaling)
Internet β Load Balancer β Kubernetes Pods (2-10) β MongoDB
(External IP) (GKE Auto-scaling)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GKE Cluster Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Internet
β
βΌ
Load Balancer (External IP)
β
βββΊ Pod 1 (API:3000)
βββΊ Pod 2 (API:3000)
βββΊ Pod N (API:3000)
β
βΌ
Kubernetes Service
β
ββββββ΄βββββ
β β
Node 1 Node N
(e2-medium)
See ARCHITECTURE_DIAGRAM.md for detailed diagrams
User discovers app β Visits marketing website β Learns about features β Downloads mobile app
Purpose: Brand presence and user acquisition
- Technology: Next.js 16, TypeScript, Tailwind CSS
- Features: SEO-optimized landing pages, app store links, feature showcases
- Deployment: Static website hosting (Vercel/Netlify)
User downloads app β Registers account β Adds friends β Creates groups β Splits expenses β Tracks balances
Purpose: Core expense splitting functionality
- Technology: React Native, Expo, TypeScript
- Features:
- User authentication and profile management
- Friend management with contact sync
- Group creation and member management
- Expense creation and splitting
- Real-time balance calculations
- Settlement tracking
- Platforms: iOS and Android via Expo/EAS
Mobile app β API requests β Authentication β Business logic β Database operations β Response
Purpose: Core business logic and data management
- Technology: Node.js, Express, MongoDB, JWT
- Features:
- RESTful API with comprehensive endpoints
- JWT-based authentication system
- User and friend management
- Group operations with role-based access
- Expense tracking with automatic balance calculations
- Security middleware and input validation
- Database: MongoDB with Mongoose ODM
Code deployment β Terraform provisioning β GCP resources β Load balancer β Auto scaling β DNS routing
Purpose: Scalable cloud infrastructure with high availability
- Technology: Terraform, Google Cloud Platform
- Features:
- Multi-environment support (production/staging)
- Global HTTP(S) Load Balancer with SSL termination
- Auto Scaling Groups with health-based scaling
- Managed SSL Certificates for HTTPS security
- VPC with public/private subnets
- Instance Templates for consistent deployments
- Cloud DNS management
- Advanced firewall and security rules
- Automated infrastructure deployment
-
Development Phase
Developer codes β Local testing β Git commit β Push to branch -
Infrastructure Provisioning
Terraform plan β Infrastructure validation β Apply changes β Resources created -
Backend Deployment
Services build β Docker containerization β VM deployment β Health checks -
Mobile App Distribution
Client build β EAS build service β App store submission β User downloads -
Website Deployment
Website build β Static optimization β CDN deployment β SEO indexing
βββ Client/ # React Native Mobile Application
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ screens/ # App screens (auth, friends, groups, expenses)
β β βββ services/ # API integration and data management
β β βββ navigation/ # App navigation setup
β β βββ theme/ # Design system and styling
β βββ app.json # Expo configuration
β βββ package.json # Dependencies and scripts
β βββ README.md # Mobile app documentation
β
βββ services/ # Node.js Backend API
β βββ controllers/ # Request handlers and business logic
β βββ models/ # Database schemas (User, Group, Expense)
β βββ routes/ # API endpoint definitions
β βββ middleware/ # Authentication and security
β βββ config/ # Database and app configuration
β βββ docker-compose.yml # Container orchestration
β βββ package.json # Dependencies and scripts
β βββ README.md # Backend API documentation
β
βββ website/ # Next.js Marketing Website
β βββ src/
β β βββ app/ # Next.js pages (home, contact, privacy)
β β βββ components/ # React components (hero, features, footer)
β β βββ lib/ # Utility functions
β βββ public/ # Static assets
β βββ next.config.ts # Next.js configuration
β βββ package.json # Dependencies and scripts
β βββ README.md # Website documentation
β
βββ terraform/ # Infrastructure as Code (VM-based)
β βββ provider.tf # GCP provider configuration
β βββ vpc.tf # Network and compute resources
β βββ dns.tf # Domain and DNS management
β βββ variables.tf # Input variable definitions
β βββ terraform.main.tfvars # Production environment config
β βββ terraform.staging.tfvars # Staging environment config
β βββ README.md # Infrastructure documentation
β
βββ terraform-k8s/ # Kubernetes Infrastructure (Testing)
β βββ provider.tf # GCP and Kubernetes provider config
β βββ gke.tf # GKE cluster configuration
β βββ artifact-registry.tf # Docker image registry
β βββ variables.tf # Input variable definitions
β βββ outputs.tf # Output values
β βββ terraform.testing.tfvars # Testing environment config
β βββ README.md # K8s infrastructure documentation
β
βββ k8s/ # Kubernetes Manifests (Testing)
β βββ deployment.yaml # Application deployment
β βββ service.yaml # LoadBalancer service
β βββ hpa.yaml # Horizontal Pod Autoscaler
β βββ configmap.yaml # Configuration
β βββ secret-template.yaml # Secret template
β βββ README.md # K8s deployment guide
β
βββ README.md # This comprehensive overview
- Node.js 18+
- Terraform 1.0+
- Google Cloud SDK + gke-gcloud-auth-plugin
- kubectl
- Docker
- Expo CLI
- MongoDB (local or cloud)
cd terraform
terraform init
terraform plan -var-file="terraform.main.tfvars"
terraform apply -var-file="terraform.main.tfvars"cd services
npm install
cp .env.example .env
# Configure environment variables
npm run devcd terraform-k8s
terraform init
terraform apply -var-file="terraform.testing.tfvars"# Install auth plugin
gcloud components install gke-gcloud-auth-plugin
# Get cluster credentials
gcloud container clusters get-credentials coinbreakr-testing-cluster \
--zone us-central1-a --project coinbreakr
# Create secrets
kubectl create secret generic coinbreakr-secrets \
--from-literal=mongo-url='YOUR_MONGO_URL' \
--from-literal=jwt-secret='YOUR_JWT_SECRET'
# Deploy application
cd ../k8s
kubectl apply -f .
# Get external IP
kubectl get service coinbreakr-api-service# Get IP and test
EXTERNAL_IP=$(kubectl get service coinbreakr-api-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
curl http://$EXTERNAL_IP/v1/healthzπ Full Kubernetes Guide: See START_HERE.md or KUBERNETES_DEPLOYMENT_GUIDE.md
cd Client
npm install
cp .env.example .env
# Configure API endpoints
npm startcd website
npm install
npm run dev- Infrastructure:
terraform.main.tfvars - API: Production MongoDB, optimized settings
- Mobile: Production builds via EAS
- Website: Production deployment with CDN
- Domain:
api.${domain}for API,${domain}for website
- Infrastructure:
terraform.staging.tfvars - API: Staging database, debug settings
- Mobile: Development builds for testing
- Website: Staging deployment for review
- Domain:
staging.${domain}for all services
- Infrastructure:
terraform-k8s/terraform.testing.tfvars - Deployment: Docker containers on GKE
- API: Kubernetes deployment with auto-scaling (2-10 pods)
- Load Balancer: Kubernetes LoadBalancer service
- Registry: GCP Artifact Registry for Docker images
- Access: External IP (no DNS configured)
- Infrastructure: Local or minimal cloud resources
- API: Local MongoDB, development settings
- Mobile: Expo development server
- Website: Local Next.js development server
User Registration β JWT Token Generation β API Authentication β Resource Access
- Password Hashing: bcrypt with salt rounds
- JWT Tokens: Secure token-based authentication
- Input Validation: Comprehensive request validation
- Rate Limiting: Brute force protection
- HTTPS: SSL/TLS encryption for all communications
- Network Segmentation: VPC with public/private subnets
- Firewall Rules: Restrictive access control
- Environment Isolation: Separate resources per environment
- Secret Management: Environment variables and secure storage
- β User registration and authentication
- β Friend management with contact sync
- β Group creation and member management
- β Expense creation and splitting
- β Real-time balance calculations
- β Settlement tracking and history
- β Offline support with sync
- β Push notifications (planned)
- β RESTful API with 20+ endpoints
- β JWT-based authentication
- β User and friend management
- β Group operations with roles
- β Expense tracking and calculations
- β Automatic balance management
- β Health monitoring and logging
- β Multi-environment support
- β Auto-scaling capabilities with CPU-based scaling (2-10 VMs)
- β Global Load Balancer with SSL termination
- β Managed SSL Certificates for automatic HTTPS
- β Health Checks and auto-healing instances
- β Automated deployments via Packer
- β DNS management with Cloud DNS
- β Security and compliance
- β GKE Cluster with auto-scaling nodes (1-5)
- β Horizontal Pod Autoscaler (2-10 pods)
- β Docker containerization with Artifact Registry
- β Rolling updates with zero downtime
- β Health checks (liveness + readiness probes)
- β Automated CI/CD via GitHub Actions
- β Load Balancer with external IP
- β Resource limits and requests per pod
main branch β Production deployments (VM-based)
staging branch β Staging environment testing (VM-based)
testing branch β Testing environment (Kubernetes-based) π
dev branch β Development and feature work
feature/* β Individual feature development
Push to branch β Packer builds VM image β Terraform deploys β Load balancer routes traffic
Workflow: .github/workflows/packer-build.yml
PR to testing β Docker build test + security scan + K8s validation
β
Merge to testing β Build Docker image β Push to Artifact Registry
β Deploy to GKE β Health checks
Workflows:
.github/workflows/docker-test.yml(PR validation).github/workflows/docker-push-k8s-deploy.yml(Deployment)
Architecture Flow:
Developer
β
β git push origin testing
β
βΌ
GitHub Actions
β
βββΊ Build Docker Image
βββΊ Security Scan (Trivy)
βββΊ Push to Artifact Registry
β βββΊ us-central1-docker.pkg.dev/coinbreakr/coinbreakr-testing
β
βΌ
Deploy to GKE
β
βββΊ Apply ConfigMap
βββΊ Apply Deployment (2-10 pods)
βββΊ Apply Service (LoadBalancer)
βββΊ Apply HPA (Auto-scaling)
β
βΌ
Health Check
βββΊ curl http://EXTERNAL_IP/v1/healthz
Code Push β Automated Tests β Build β Deploy β Health Checks β Monitoring
- Unit Tests: Individual component testing
- Integration Tests: API endpoint testing
- E2E Tests: Complete user flow testing
- Performance Tests: Load and stress testing
- API Health:
/v1/healthzendpoint monitoring - Database: Connection and performance monitoring
- Infrastructure: GCP monitoring and alerting
- Mobile App: Crash reporting and analytics
- API Response Times: Track endpoint performance
- Database Queries: Monitor query efficiency
- Mobile App: Track user engagement and performance
- Website: Core Web Vitals and SEO metrics
- Push notifications for expense updates
- Receipt scanning with OCR
- Multi-currency support
- Advanced analytics and reporting
- Integration with payment platforms
- Web application version
- Advanced group permissions
- Expense categories and budgeting
- β Auto-scaling implementation (CPU-based with 2-10 instances)
- β Load balancer setup (Global HTTP(S) with SSL)
- CDN integration
- Advanced monitoring and alerting
- Backup and disaster recovery
- Multi-region deployment
# Get cluster status
kubectl get all -l app=coinbreakr-api
# View pods
kubectl get pods -l app=coinbreakr-api
# View logs
kubectl logs -f deployment/coinbreakr-api
# Get external IP
kubectl get service coinbreakr-api-service
# Check auto-scaling
kubectl get hpa
# Update deployment
kubectl set image deployment/coinbreakr-api \
api=us-central1-docker.pkg.dev/coinbreakr/coinbreakr-testing/services:NEW_TAG
# Rollback deployment
kubectl rollout undo deployment/coinbreakr-api
# Scale manually
kubectl scale deployment coinbreakr-api --replicas=5
# Restart deployment
kubectl rollout restart deployment/coinbreakr-api
# Get load balancer IP
kubectl get service coinbreakr-api-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}'
# Test API
curl http://$(kubectl get service coinbreakr-api-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}')/v1/healthzFull Command Reference: COMMANDS_REFERENCE.md
Kubernetes Guide: k8s/README.md
# VM Infrastructure (Main/Staging)
cd terraform
terraform init
terraform plan -var-file="terraform.main.tfvars"
terraform apply -var-file="terraform.main.tfvars"
# Kubernetes Infrastructure (Testing)
cd terraform-k8s
terraform init
terraform plan -var-file="terraform.testing.tfvars"
terraform apply -var-file="terraform.testing.tfvars"# Build image
docker build -t coinbreakr-api:latest ./services
# Push to Artifact Registry
docker tag coinbreakr-api:latest \
us-central1-docker.pkg.dev/coinbreakr/coinbreakr-testing/services:latest
docker push us-central1-docker.pkg.dev/coinbreakr/coinbreakr-testing/services:latest- Fork the repository
- Create feature branch from
dev - Set up local development environment
- Make changes and test thoroughly
- Submit pull request with detailed description
- TypeScript: Strict type checking
- ESLint: Follow configured rules
- Testing: Write tests for new features
- Documentation: Update relevant README files
This project is proprietary software. All rights reserved.
- START_HERE.md - Quick start guide for Kubernetes
- QUICK_START_K8S.md - 5-minute Kubernetes setup
- DEPLOYMENT_CHECKLIST.md - Step-by-step deployment
- ARCHITECTURE_DIAGRAM.md - Visual architecture diagrams
- WORKFLOW_COMPARISON.md - VM vs Kubernetes comparison
- IMPLEMENTATION_SUMMARY.md - What was built
- KUBERNETES_DEPLOYMENT_GUIDE.md - Complete K8s guide
- terraform-k8s/README.md - Terraform infrastructure
- k8s/README.md - Kubernetes manifests with detailed commands
- DNS_SETUP_GUIDE.md - Domain and DNS configuration
- COMMANDS_REFERENCE.md - Daily command reference
- GITHUB_ACTIONS_SETUP.md - CI/CD configuration
- GET_LOAD_BALANCER_IP.sh - Get K8s external IP (Bash)
- GET_LOAD_BALANCER_IP.ps1 - Get K8s external IP (PowerShell)
- services/README.md - Backend API documentation
- terraform/README.md - VM infrastructure documentation
- Client/README.md - Mobile app documentation
- website/README.md - Marketing website documentation
Project Type: Full-stack expense splitting platform
Architecture: Microservices with mobile-first approach
Deployment: Multi-environment cloud infrastructure (VM + Kubernetes)
Target Users: Individuals and groups sharing expenses
Kubernetes: β
Testing environment ready
Auto-scaling: β
Pods (2-10) + Nodes (1-5)