How mju-likelion/mju-festival-frontend works
Project Type and Purpose
• This is a front-end, single-page application (SPA) built with React (TypeScript) and Vite.
• It serves as the client for the “MJU Majesty” service, handling landing, authentication, booth QR‐code interactions, lost-and-found, timetable display, notices, and map viewing.
• The codebase is purely UI/UX and client-side logic; all persistent data and business-critical operations occur via RESTful HTTP calls to external/backend services.
File Structure Analysis
• Top-level: configuration (ESLint, Prettier, tsconfig, Vite), package.json, public (static assets & redirect rules), index.html.
• src/
• api/ Axios configuration + service modules (booth, lostItem, notice, postLogIn, setting, stamp, weather) → HTTP adapter layer.
• components/ Reusable UI widgets (FloatingButton, Footer, Header, QrBottomSheet, etc.).
• pages/ Feature pages organized per route (BoothList, CreateLostItem, LogIn, Main, Map, Stamp, TimeTable, etc.).
• hooks/ Custom React hooks encapsulating stateful logic (useBottomSheet, useDetermineRole, usePreventRefresh, useRouteTracker, useScreenSize).
• store/ Global state management (auth.ts) and store initialization.
• utils/ Helper modules (date formatting, encryption, error handling, download, openLink).
• styles/ Global styles, themes, fonts.
• types/ TypeScript interfaces for domain models (booth, lostItem, notice, timetable, auth).
• validation/ Validation schemas and messages.
Key Architectural Patterns
• “Feature-based” routing/pages.
• “Layered” structure: UI Components → Business Logic (hooks + store) → API Adapter → External Services.
• Centralized state (store/auth.ts) for authentication and likely role‐based routing.
• Separation of concerns: API interfaces isolated under src/api, domain types under src/types.
Main Components & Relationships
A. Client Browser
• Hosts the React SPA (index.html + bundled JS/CSS from Vite).
B. UI Layer
• Pages (React Router routes)
• Components (buttons, forms, layouts)
C. Business Logic Layer
• Hooks (custom logic, role determination)
• Store (global state, auth tokens)
D. API Adapter Layer
• Axios instance (src/api/Axios.ts)
• Service modules invoking endpoints (booth, lostItem, notice, stamp, weather, postLogIn, setting)
E. External/Backend Services
• Auth Service (login, token verification)
• Booth Service (QR issuance, booth CRUD)
• LostItem Service (create, edit, list, detail)
• Notice Service (create, edit, list, detail)
• Stamp Service (user stamp board)
• Weather API (external third-party weather data)
• API (external map tile service)
F. Static Assets & CDN
G. Build & Deployment
• Vite build → Bundler
• Hosting (Netlify/S3/Static host) + redirect rules (public/_redirects)
• Related modules in containers (e.g., “src/api”, “src/hooks + store”).