# Agents & Copilot Instructions > **Last reviewed:** 2026-04-09 --- ## Project Overview Showy React frontend — a single-page application for personal movie & TV series tracking. Built with React 19, TypeScript, Vite, Tailwind CSS 4, and shadcn/ui. --- ## Architecture Summary | Layer | Directory | Purpose | | ----------- | ------------------ | ----------------------------------------------------------------------- | | Pages | `src/pages/` | Route entry-points, compose components, manage local UI state | | Components | `src/components/` | Reusable UI blocks (entries, dialogs, charts, layout, skeletons) | | Hooks | `src/hooks/` | React Query wrappers — queries, mutations, cache invalidation | | API | `src/api/` | Thin Axios wrappers (one file per backend domain) | | Stores | `src/stores/` | Zustand stores — library cache (`Map`), theme preference | | Lib | `src/lib/` | Utilities — Axios instance, media URLs, normalisers, `cn()` | | Types | `src/types/` | All TypeScript interfaces (`index.ts`) | | UI | `src/components/ui/` | shadcn/ui primitives (copied, not installed as a dependency) | --- ## Code Conventions | Rule | Detail | | ------------------------ | --------------------------------------------------------------------------- | | File naming | PascalCase for components/pages; camelCase for hooks, api, utils, stores | | Exports | Named exports for hooks & utils; default exports for pages | | Path alias | `@/` → `src/` | | State management | Zustand for sync client state; React Query for async server state | | Data fetching | Always through `hooks/` → `api/` → Axios. Never fetch directly in components | | Normalisation | `lib/normalizers.ts` transforms backend responses before caching | | Styling | Tailwind CSS utility classes + CSS custom property tokens | | Component lib | shadcn/ui primitives in `components/ui/`, extended via `cn()` utility | | Forms | React Hook Form + Zod resolvers | | Toasts | Sonner — `toast.success()` / `toast.error()` on mutations | | Charts | Recharts with `ResponsiveContainer` | | Lazy loading | All pages via `React.lazy()` + `` with skeleton fallbacks | | Infinite pagination | `useInfiniteQuery` for TMDB browse/search endpoints | --- ## Data Flow ``` Page → Hook (useQuery/useMutation) → API module (Axios) → Backend REST API ↓ normalise Zustand store (library entries) ``` - Library entries are cached in a Zustand `Map` for O(1) lookups. - TMDB entries are checked against the library store by TMDB ID — if present, the richer local version is displayed. - Mutations update the Zustand store immediately, then invalidate React Query caches. --- ## Backend API - **Base URL:** `/api/v1` (proxied via Vite dev server to the backend) - **Configurable:** `VITE_API_URL` environment variable - **Proxy config** in `vite.config.ts`: `/api` → backend origin All backend endpoints are documented in `backend/docs/api_reference.md`. --- ## Key Files | File | Purpose | | ------------------------ | -------------------------------------------------------------- | | `src/main.tsx` | Entry point — `ReactDOM.createRoot` | | `src/App.tsx` | Root component — `QueryClientProvider` + `RouterProvider` | | `src/router.tsx` | Route definitions with lazy imports and Suspense wrappers | | `src/index.css` | Global styles, Tailwind imports, OKLCH theme tokens | | `src/lib/api.ts` | Axios instance, base URL, image URL helpers | | `src/lib/normalizers.ts` | Backend → frontend data transformation | | `src/types/index.ts` | All TypeScript interfaces | | `components.json` | shadcn/ui CLI configuration | | `vite.config.ts` | Vite config — Tailwind plugin, React plugin, API proxy | --- ## Documentation Detailed documentation lives in `docs/`: - [README](docs/README.md) — Overview - [Tech Stack](docs/tech_stack.md) - [Project Structure](docs/project_structure.md) - [Architecture](docs/architecture.md) - [Routing](docs/routing.md) - [State Management](docs/state_management.md) - [API Layer](docs/api_layer.md) - [Components](docs/components.md) - [Pages](docs/pages.md) - [Styling & Theming](docs/styling.md)