How csc105-2024/g10-lootbox works
This is a free loot-box web app: users sign up, receive regenerating keys, open meme or superhero boxes, collect items, and manage coins, inventory, and profile images. The React pages call API helpers, which communicate with a Hono backend; controllers coordinate user, key, item, and summon operations backed by Prisma. The graph includes README-documented capabilities whose implementation was not sampled, but omits uncertain links where source excerpts do not establish the call path.
Main entry points: App.jsx Page routing · index.ts Hono server · user.model.ts User and inventory · user.ts User API
Components 29
React client
- Page routing
frontend/src/App.jsx - Sign-in and signup
frontend/src/pages - Game home
frontend/src/pages/Main.jsx - Box selection
frontend/src/pages/SuperHeroBox.jsx - Random draws
frontend/src/pages/HeroRandom.jsx - Item views
frontend/src/pages/heroLook.jsx - Buy and sell
frontend/src/pages/Buying.jsx - User profile
frontend/src/pages/profile.jsx - User API
frontend/src/api/user.ts - Shop API
frontend/src/api/shop.ts - Summon API
frontend/src/api/summon.ts - Inventory API
frontend/src/api/inventory.ts - Axios client
frontend/src/util/axiosInstance.ts
HTTP API
- Hono server
backend/src/index.ts - User routes
backend/src/routes/user.routes.ts - Shop routes
backend/src/routes/shop.routes.ts - Inventory routes
backend/src/routes/inventory.routes.ts - Summon routes
backend/src/routes/summon.routes.ts
Game domain
- User operations
backend/src/controllers/user.controller.ts - Shop operations
backend/src/controllers/shop.controller.ts - Item queries
backend/src/controllers/item.controller.ts - Summon operations
backend/src/controllers/summon.controller.ts - User and inventory
backend/src/models/user.model.ts - Keys and cooldowns
backend/src/models/key.model.ts - Item operations
backend/src/models/item.model.ts - Draw logic
backend/src/models/summon.model.ts - Image file handling
backend/src/utils/fileHandler.ts
Persistence
- Prisma database
backend/prisma/schema.prisma
Other components
- Player
Connections 42
- Player → Page routing: uses
README.md - Page routing → Sign-in and signup: routes to
frontend/src/App.jsx - Page routing → Game home: routes to
frontend/src/App.jsx - Page routing → Box selection: routes to
frontend/src/App.jsx - Page routing → Random draws: routes to
frontend/src/App.jsx - Page routing → Item views: routes to
frontend/src/App.jsx - Page routing → Buy and sell: routes to
frontend/src/App.jsx - Page routing → User profile: routes to
frontend/src/App.jsx - Sign-in and signup → User API: calls
frontend/src/pages/SignUp.jsx - Game home → User API: fetches profile
frontend/src/pages/Main.jsx - Buy and sell → Shop API: calls
frontend/src/pages/Buying.jsx - Buy and sell → User API: fetches user
frontend/src/pages/Buying.jsx - Random draws → Summon API: requests draw
frontend/src/pages/HeroRandom.jsx - User profile → User API: calls
frontend/src/pages/profile.jsx - User API → Axios client: sends requests
frontend/src/api/user.ts - Shop API → Axios client: sends requests
frontend/src/api/shop.ts - Summon API → Axios client: sends requests
frontend/src/api/summon.ts - Inventory API → Axios client: sends requests
frontend/src/api/inventory.ts - Axios client → Hono server: HTTP requests
README.md - Hono server → User routes: mounts routes
backend/src/index.ts - Hono server → Shop routes: mounts routes
- Hono server → Inventory routes: mounts routes
- Hono server → Summon routes: mounts routes
- User routes → User operations: dispatches
backend/src/routes/user.routes.ts - Shop routes → Shop operations: dispatches
backend/src/routes/shop.routes.ts - Inventory routes → User operations: dispatches
backend/src/routes/inventory.routes.ts - Inventory routes → Item queries: dispatches
backend/src/routes/inventory.routes.ts - Summon routes → Summon operations: dispatches
backend/src/routes/summon.routes.ts - User operations → User and inventory: calls
backend/src/controllers/user.controller.ts - User operations → Keys and cooldowns: calls
backend/src/controllers/user.controller.ts - Shop operations → User and inventory: calls
backend/src/controllers/shop.controller.ts - Shop operations → Keys and cooldowns: calls
backend/src/controllers/shop.controller.ts - Shop operations → Item operations: calls
backend/src/controllers/shop.controller.ts - Item queries → Item operations: calls
backend/src/controllers/item.controller.ts - Summon operations → Draw logic: calls
backend/src/controllers/summon.controller.ts - Draw logic → User and inventory: uses
backend/src/models/summon.model.ts - Draw logic → Keys and cooldowns: uses
backend/src/models/summon.model.ts - Draw logic → Item operations: uses
backend/src/models/summon.model.ts - User and inventory → Image file handling: saves images
backend/src/models/user.model.ts - User and inventory → Prisma database: reads and writes
backend/src/models/user.model.ts - Keys and cooldowns → Prisma database: reads and writes
backend/src/models/key.model.ts - Item operations → Prisma database: reads and writes
backend/src/models/item.model.ts