How jardelgoncalves/monster-killer-game-serverless works
Project type and purpose
• This is a full-stack, event-driven serverless game application (“Monster Killer Game”)
• Frontend: Vue.js SPA that lets users register, play (attack/heal), and view rankings
• Backend: Node.js Serverless API on AWS (API Gateway + Lambda + DynamoDB + DynamoDB Streams)
File structure
• Top-level dirs:
• api/ – Serverless backend code (handler.js, serverless.yml, src/ with services & schemas; mock events)
• frontend/ – Vue.js SPA (components/, views/, router.js, services/api.js)
• screenshot/ – UI mockups
• Architectural patterns:
• Serverless micro-services (multiple Lambda handlers defined in serverless.yml)
• DynamoDB as primary data store
• DynamoDB Streams trigger a ranking update Lambda
Key README insights
• Explains AWS setup, serverless deploy, front-end config
• Lists three REST endpoints (user, score, ranking)
• Emphasizes event‐driven handling of DynamoDB inserts
a. Client (web browser) running the Vue.js app
b. API Gateway (REST endpoints)
c. Lambda functions (handlers for user, score, ranking)
d. DynamoDB tables (User, Score, Ranking)
e. DynamoDB Stream on Score/User tables triggering Ranking Lambda
f. External services: AWS IAM for permissions, CloudWatch for logs
Component interactions & data flow
• User clicks “Start Game” or “Register” → Vue client sends POST /user → API Gateway routes to User Lambda → writes to DynamoDB User table → returns success
• During play, client sends POST /score/{userId} → Score Lambda → writes to Score table → returns current health/status
• Score or User table Streams → triggers Ranking Lambda → reads tables, calculates top players → writes to Ranking table or returns ranking
• Client fetches GET /ranking → Ranking Lambda reads Ranking table → returns list
Architectural patterns & principles
• Serverless microservices: each Lambda scoped to one concern
• Event-driven: DynamoDB Streams drive ranking updates asynchronously
• Separation of concerns: services/ folder implements business logic, util/ for shared code (validation, responses)
• SPA + BFF: Vue.js interacts only with API Gateway
Technologies & frameworks
• AWS API Gateway, Lambda, DynamoDB, DynamoDB Streams
• Serverless Framework (serverless.yml)
• Node.js, axios
• Vue.js, Vue Router, Vuex (if used)
Detail
• All three endpoints (/user, /score/{userId}, /ranking) and their corresponding Lambda functions
• DynamoDB tables: User, Score, Ranking
• DynamoDB Streams trigger path
• Client-side service/api.js baseURL configuration
• Cross-cutting concerns: logging (CloudWatch), IAM permissions