How jorge-polanco-roque/aws_rpg works
Project type and purpose
• This is a full-stack interactive training game (“NEURO-ARCHITECT”) built to help users prepare for the AWS Solutions Architect Associate exam in a cyberpunk style.
• Frontend: React 18 SPA with styled-components, Context API, Framer-Motion.
• Backend: Node.js + Express API with JWT auth, SQLite for persistence.
• Deployed via Docker Compose, served behind Nginx in production.
File structure
• Top-level Docker artifacts: multiple Dockerfiles (backend, dev, simple), .dockerignore, docker-compose YAMLs, nginx.conf.
• client/ – React app
• src/components – UI widgets (CombatArena, BossManager, etc.)
• src/pages – route-level views (HomePage, GamePage, LeaderboardPage, etc.)
• src/contexts – AuthContext, GameContext, SoundContext
• build/ – production bundle
• src/server/ – Express API
• index.js – server entry, middleware (CORS, Helmet, JWT)
• data/questions_expanded.js – question pool
• cosmic_codex.db – SQLite file
• start.sh – local development launcher
• Logging: combined.log, error.log
README for additional insights
• Architecture summary shows three main blocks: React UI ↔ Express API ↔ SQLite DB.
• Key services: Auth System, Game Engine, Question Pool, Score Logic, Progress API.
• External concerns: JWT authentication, CORS, security headers, monitoring via Winston.
a. Main components
• User’s Browser (React SPA)
• Nginx reverse proxy (in prod)
• Express API Server (Node.js)
• SQLite Database (cosmic_codex.db)
• Docker & Docker-Compose orchestration
b. Relationships & interactions
• Browser ←→ Nginx ←→ Express REST endpoints
• Express ←→ SQLite for reads/writes (profiles, progress, questions)
• React Contexts manage local state and call APIs via fetch/Axios
c. Architectural patterns & principles
• SPA + API server (separation of concerns)
• Context API for global client state
• JWT stateless authentication
• Modular service design (Auth, Game, Stats)
• Containerization for environment parity (dev, prod, simple)
d. Key technologies
• React 18, styled-components, framer-motion
• Node.js 18+, Express, JWT, Helmet, CORS
• SQLite for lightweight persistence
• Docker, Docker-Compose, Nginx
Detailed breakdown of components
• USER BROWSER
– Hosted by Nginx or local dev server
– React Contexts handle Auth, Game and Sound
– Calls /api/* endpoints
• NGINX (production)
– TLS termination, static asset serving for /client/build
– Proxy /api/* to Express
• EXPRESS API
– Middleware: Helmet, CORS, rate limiter
– Auth routes: /api/auth/login, /register, /logout
– Game routes: /api/game/start-session, /question/:id, /submit-answer, /stats, /leaderboard
– Health: /api/health, /api/game/cosmic-entities
– Logging: Winston to combined.log and error.log
• SQLITE DATABASE
– Tables: Users, Sessions, Questions, Progress, Stats
– Access via simple file path (./cosmic_codex.db)
• DOCKER & COMPOSE
– Services: frontend, backend, nginx
– Variants: dev (live-reload), simple (single container), prod (multi-container)
– Environment variables for PORT, JWT_SECRET, DB_PATH, CORS
Putting it all together
• Browser → Nginx (HTTPS/HTTP)
• Nginx → Express (HTTP)
• Express → SQLite (SQL queries)
5. Annotations for ports (3030 for API, 80/443 for Nginx, etc.), Docker Compose files, and environment variables.
6. Build pipeline if needed (Git → Docker build → Deploy).