How dokpami/frontend works
1. Overall shape
- This is a client-side React + TypeScript app built with Vite.
- The repository is organized as a single frontend SPA with multiple feature areas rather than a backend/service split.
2. App bootstrapping and shell
- src/main.tsx is the entry point and mounts the React app.
- src/App.tsx, src/Layout.tsx, and src/Routers.tsx form the top-level shell: app-wide layout plus client-side route definition.
- Global styles come from src/index.css and the Slick carousel styles in src/styles/.
3. Routing and page boundaries
- The app is divided into route-level pages under src/pages/.
- Main routes appear to be:
- Landing
- Home
- Event
- BalanceGame
- QRTreasure
- TestBE
- NotFound
- This makes the architecture strongly page-driven, with each route owning its own subcomponents and local data flow.
4. Landing/Home content layer
- src/pages/Landing/ and src/pages/Home/ look like the public-facing entry pages.
- These pages likely provide navigation/intro content and funnel users into the interactive features.
5. Event subsystem
- src/pages/Event/ contains the event experience, with a characters.ts module suggesting the event is driven by character metadata.
- Static character assets live in public/characters/images and public/characters/names, so the page is likely assembled from bundled metadata plus public media files.
6. Balance Game subsystem
- src/pages/BalanceGame/ is a self-contained interactive flow.
- It is data-driven through src/data/BalanceGameQuestions.tsx and src/data/BalanceGameResult.tsx.
- The UI is split into smaller pieces for choice buttons, result capture, result display, and QR output.
- src/pages/BalanceGame/api.ts and src/hooks/useBuyProduct.tsx suggest the game may trigger an external API or commerce-related action as part of the experience.
7. QR Treasure subsystem
- src/pages/QRTreasure/ is another feature area with its own landing, result, admin, and container pages.
- _KakaoMap.tsx indicates map-based interaction, likely for location discovery or treasure placement.
- _QRHeader.tsx and QRMapData.ts imply a QR-centric flow backed by structured location/map data.
- The separate QRAdmin.tsx page suggests an operational/admin boundary distinct from the end-user experience.
8. Shared data model
- src/data/LegacyData.tsx, QRMapData.ts, and the Balance Game data modules act as the app’s content/data layer.
- These modules likely centralize static configuration, mappings, and result definitions so the pages stay presentation-focused.
9. Shared libraries and integrations
- src/lib/firebase.ts is the main backend integration point and likely encapsulates Firebase initialization/services.
- src/lib/share.ts handles sharing behavior, and src/lib/zksend.ts suggests an external payment/transfer or wallet-related integration.
- src/lib/utils.ts contains shared utility functions.
10. Reusable UI and design system
- src/components/ui/ contains reusable primitives such as accordion, dropdown menu, and toast/sonner.
- The presence of components.json suggests a shadcn/ui-style component setup.
- These components are shared across pages to keep interaction patterns consistent while feature pages remain isolated.
11. External-facing infrastructure boundaries
- The most important external dependencies are Firebase, Kakao Map, and the zksend integration.
- The app itself remains frontend-only, but several routes depend on remote services or externally hosted assets for dynamic behavior.
12. Key architectural takeaway
- The repo is best diagrammed as a routed SPA with a thin global shell and four major feature domains: Landing/Home, Event, Balance Game, and QR Treasure.
- Each feature owns its own components and data modules, while cross-cutting concerns are centralized in lib/, hooks/, and the shared UI layer.
Main entry points: Routers.tsx Routers · BalanceGame.tsx Balance Game · QRTreasure.tsx QR Treasure · ui UI kit
Components 21
App shell
Bootstrap, routing, and global layout for the SPA.
Route pages
Top-level route boundaries and feature areas.
- Landing · Public entry page and introduction flow.
src/pages/Landing/Landing.tsx - Home · Primary landing/home experience after entry.
src/pages/Home/Home.tsx - Event · Event experience driven by character metadata.
src/pages/Event/Event.tsx - Balance Game · Interactive balance-game flow with result handling.
src/pages/BalanceGame/BalanceGame.tsx - QR Treasure · QR treasure hunt experience and admin boundary.
src/pages/QRTreasure/QRTreasure.tsx - NotFound · Fallback page for unknown routes.
src/pages/NotFound.tsx - TestBE · Standalone page for backend or integration testing.
src/pages/TestBE.tsx - Characters · Character metadata used by the event page.
src/pages/Event/characters.ts
Shared layer
Reusable data, hooks, UI primitives, and integrations.
- Game data · Questions and result definitions for the balance game.
src/data/BalanceGameQuestions.tsx - Legacy data · Shared legacy configuration and mappings.
src/data/LegacyData.tsx - QR map data · Structured location and map data for the QR flow.
src/data/QRMapData.ts - Buy hook · Encapsulates product purchase or related game action.
src/hooks/useBuyProduct.tsx - Firebase · App-wide Firebase initialization and service access.
src/lib/firebase.ts - Share · Sharing behavior and platform-specific share helpers.
src/lib/share.ts - zksend · External transfer or wallet-related integration.
src/lib/zksend.ts - UI kit · Reusable UI primitives shared across pages.
src/components/ui
Public assets
Static media consumed by feature pages.
- Char assets · Character images and name assets served from public.
public/characters
Connections 28
- main → App: boots · Application entry renders the root app.
- App → Layout: wraps · App shell composes the shared layout.
- Layout → Routers: hosts · Layout delegates page selection to the router.
- Routers → Landing: route · Routes to the landing page.
- Routers → Home: route · Routes to the home page.
- Routers → Event: route · Routes to the event experience.
- Routers → Balance Game: route · Routes to the balance game.
- Routers → QR Treasure: route · Routes to the QR treasure flow.
- Routers → TestBE: route · Routes to the test page.
- Routers → NotFound: fallback · Unknown routes fall back to not found.
- Landing → Home: funnel · Landing directs users into the main experience.
- Event → Characters: uses · Event page renders from character metadata.
- Event → Char assets: loads · Event page consumes public character assets.
- Balance Game → Game data: drives · Game flow is driven by questions and results.
- Balance Game → Buy hook: triggers · Interactive choices can invoke purchase/action logic.
- Balance Game → Firebase: syncs · Balance flow may persist or read remote state.
- Balance Game → Share: shares · Results can be shared externally.
- Balance Game → zksend: connects · Game flow may invoke wallet or transfer integration.
- QR Treasure → QR map data: drives · QR treasure flow is backed by map/location data.
- QR Treasure → Firebase: syncs · QR flow may use backend services.
- QR Treasure → Share: shares · QR results or invites can be shared.
- QR Treasure → UI kit: renders · Feature pages reuse shared UI primitives.
- Home → UI kit: renders · Home page composes shared components.
- Landing → UI kit: renders · Landing page composes shared components.
- Balance Game → UI kit: renders · Balance game composes shared components.
- Event → UI kit: renders · Event page composes shared components.
- QR Treasure → UI kit: renders · QR treasure page composes shared components.
- Legacy data → Event: feeds · Shared legacy data supports feature content.