How csye6225-neu/webapp works
Project Type and Purpose
• This is a backend-heavy, cloud-native NodeJS web application with:
• REST endpoints (file upload/download, health checks)
• AWS RDS for relational data
• AWS S3 for file storage
• AWS CloudWatch for logging and metrics
• CI/CD via GitHub Actions
• Packer-based AMI builds (infra/packer)
File Structure
• Top-level entry points:
• app.js / server.js – bootstraps Express server and middleware
• dist/webapp – compiled front-end assets (static UI)
• Core folders:
• controllers/ – request handlers
• routes/ – Express router definitions
• services/ – AWS integrations (s3service, cloudwatchService)
• models/ – ORM or schema definitions (RDS models)
• middleware/ – request/response processing (metrics, file upload, health check)
• config/ – database configuration
• infra/packer/ – AMI build scripts and configuration
• .github/actions & workflows – CI/CD pipelines
README and Docs
• README calls out architecture.md (docs/02-architecture.md) – likely describes functional components
• Docs outline CI/CD, CloudWatch, project structure, infra setup
Main Components
a. Client (Browser or API consumer)
b. CI/CD Pipeline (GitHub Actions)
– build-binary, setup-environment, cloud-credentials
– webapp-ci-pipeline
d. Infrastructure Provisioning (Packer → AMI)
e. AWS Compute (EC2 Auto Scaling Group or Container Service)
f. NodeJS Application
– Express framework (routes, controllers)
– Middleware chain (healthCheckMiddleware, metricsMiddleware, fileUploadMiddleware)
– Services layer (cloudwatchService, s3service)
– Models / ORM layer (RDS models via config/database.js, utils/dbInitializer.js)
g. AWS RDS (PostgreSQL/MySQL)
h. AWS S3 (file storage bucket)
i. AWS CloudWatch (logs, custom metrics)
j. (Optional) Load Balancer and VPC / Security Groups
Relationships and Data Flows
• Client → Load Balancer → EC2/ECS → NodeJS App
• NodeJS App ↔ AWS RDS (queries, transactions)
• NodeJS App → AWS S3 (upload/download via s3service)
• NodeJS App → AWS CloudWatch (logs & metrics via cloudwatchService + metricsMiddleware)
• GitHub Actions → build & test → push artifacts → trigger infra deployment (via packer scripts)
• Infra (packer) → produce AMI → deploy to AWS Compute
Architectural Patterns and Principles
• Layered architecture (route → controller → service → model)
• Separation of concerns (middleware handles cross-cutting aspects)
• Infrastructure as code (packer HCL, shell scripts, GitHub Actions)
• Cloud-native best practices (externalized config, managed services)
Essential Details to Capture
• Labels for all npm scripts, action names (setup-environment, build-binary) and packer scripts (machine-image.pkr.hcl)
• Environment configuration loading (config/database.js)
• Middleware chain and service dependencies (services/cloudwatchService.js, services/s3service.js)
• Call out test coverage for middleware (middleware/__tests__)