How enmanuelrivas/retotc2005b works
Project Type & Purpose
• This is a full-stack web application combining:
• A primary Node.js/Express backend (folder: backend/)
• A static frontend (HTML/CSS/JS + a Unity WebGL game) under frontend/
• An auxiliary game-API microservice (folder: game-api/)
• A MySQL database for persistent storage
File Structure
• Top-level:
• backend/ – Express app with REST controllers, service layer, data layer, middleware
• frontend/ – Static site assets: pages/, partials/, scripts/, styles/; plus a Unity WebGL build under frontend/game/
• game-api/ – Separate Node.js service exposing its own REST endpoints (db.js, index.js)
• backend/ follows a layered architecture:
• API (controllers) → Service (business logic) → Data (MySQL manager)
• middleware/ for auth and file uploads
• webserver.js (static file serving + API mounting)
• Configuration:
• backend/constants.js, .env for ports, DB credentials
• package.json and npm scripts for dev/prod
• frontend/ is purely static; it communicates with backend REST endpoints and the game-api.
README Insights
• Backend runs on port 4000 under base path /awaq
• REST routes for users, forms, images, metrics, support, etc.
• MySQL version 5.7+
• Static pages served from Express or by hosting frontend folder
• game-api is launched separately (likely different port, e.g., 5000)
Main Components & Interactions
a. Components
• Browser Client
• Static Frontend Server (Express static middleware)
• Backend API (Node.js/Express)
• game-api Microservice
• MySQL Database
• External Services:
– Email SMTP (emailService in backend)
– Cloud storage or local filesystem (imageUploadService)
b. Relationships
• Browser ↔ Static resources (HTML/CSS/JS + Unity WebGL)
• Browser JS ↔ Backend API endpoints (/awaq/api/…)
• Unity WebGL game ↔ game-api endpoints
• Backend Service layer ↔ Data layer → MySQL
• Backend ↔ External Email & Image storage
c. Architectural Patterns
• Layered (Controller → Service → Data) in backend
• Microservice pattern (game-api separate from main backend)
• Static assets + API separation
• Middleware for cross-cutting concerns (auth, uploads)
d. Key Technologies
• Node.js / Express
• MySQL
• Unity WebGL (HTML5 build)
• Vanilla JavaScript, HTML, CSS for UI
• nodemon for dev, dotenv for env vars