How csye-6225-spring-2025/webapp works
Project Type & Purpose
• This is a cloud-native, full-stack web application (“webapp”) built with Node.js/Express on the backend and a Webpack-bundled frontend.
• It provides real-time health metric tracking and analytics, secure user sessions (JWT), and persists data in MySQL (Sequelize ORM).
• Designed for multi-cloud (AWS EC2 Auto-Scaling Group + GCP Compute), with immutable infrastructure via Packer, Terraform provisioning, and CI/CD via GitHub Actions.
File Structure & Architectural Clues
• Root: index.js (Express app entry point), webpack.config.js (frontend build), packer.pkr.hcl (AMI builds), CI workflows (.github/workflows).
• /routes: HTTP API layers (fileRoutes.js, healthz.js).
• /models: Sequelize models (FileMetadata, HealthCheck).
• /utils: Logging (CloudWatch agent integration) & metrics instrumentation.
• /config: Environment and service configuration (config.json).
• /tests: Integration tests (invoked in CI).
• deploy scripts: setup_application.sh, install_dependencies.sh.
• Monitoring: amazon-cloudwatch-agent.json for node-level logs/metrics shipping.
• Artifact pipeline: webapp.zip in /artifact, produced by Webpack & CI.
Key Architectural Patterns & Components
• Separation of concerns (controllers/routes, models, utilities).
• Stateless, horizontally scalable Express instances behind a load balancer.
• Packer-built golden images for AWS AMI & GCP Compute.
• Terraform-managed networking (VPC), compute (EC2, GCE), database (RDS MySQL), and storage (S3).
• GitHub Actions pipelines: lint/test → packer build → Terraform apply → deploy.
• Centralized logging & metrics via AWS CloudWatch.
• JWT/session layer for security; secrets via .env and AWS Secrets Manager.