How yongsin0129/project-cheapskate-fe works
Project type and purpose
• This is a TypeScript‑based React single‑page application (SPA) built with Vite.
• Its purpose is to serve as the frontend for “小氣鬼的電影追蹤工具,” a movie‑tracking tool that lets users browse, follow, and save movies via a GraphQL backend API.
Top‑level components
a. User & Browser (Client)
b. Static Asset Host / CDN (Vercel)
c. Frontend SPA (React + Vite)
• Entry point: vite.dev server (dev mode) & built static files (prod mode)
• UI Components & Pages (src/pages, src/components)
• Context Providers (ApolloClientContext, ReactQueryContext, ColorModeContext, AppBarStateContext, HomePageStateContext, MeContext)
• Routing & Guards (ProtectedRoute)
• Custom Hooks & GraphQL (useFetchMovieDetails, useTriggerMovieDetails; generated/graphql.ts; gqlQuerys)
• Styling (SCSS modules under src/components/styles, src/pages/styles, src/style)
d. Backend GraphQL API (external repo)
e. Database (e.g., PostgreSQL/MySQL behind the backend)
f. Authentication Service (JWT / session managed by backend)
Relationships & data flows
• Browser → (HTTPS) → CDN/Vercel → serves static SPA
• SPA → (GraphQL queries & mutations) → Backend API
• Backend → (ORM) → Database
• Backend → issues JWT tokens → SPA stores tokens (e.g., in memory or cookies)
Architectural patterns & design principles
• Component‑based UI (atomic components under src/components, page‑level under src/pages)
• Context API for cross‑cutting concerns (authentication, theming, global state)
• GraphQL client via Apollo + React Query for data fetching & caching
• Hook abstraction for API interactions
• SCSS modules for local‑scoped styling
• SPA routing with protected routes