22
33This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44
5- ## Development Commands
6-
7- ### Running the application
5+ ## Useful Commands
86
97``` bash
10- npm run dev # Start dev server on http://localhost:8080
11- npm run dev:e2e # Start dev server in e2e mode for Cypress tests
12- npm run build # Build for production (runs tsc + vite build)
13- ```
8+ npm test # Run all Vitest unit tests (runs with TZ=UTC)
9+ npm test -- < pattern> # Run specific test file(s) matching pattern
1410
15- ### Testing
16-
17- ``` bash
18- npm test # Run all Vitest unit tests (runs with TZ=UTC)
19- npm test -- < pattern> # Run specific test file(s) matching pattern
20- npm run test:e2e # Start dev server and open Cypress for e2e tests
21- npm run cypress:open # Open Cypress (dev server must be running)
22- ```
23-
24- ### Code Quality
25-
26- ``` bash
27- npm run lint # Run Oxlint on src/**/*.{js,jsx,ts,tsx}
11+ npm run lint -- --type-check # Run linter and tsc simultaneously
2812```
2913
3014### Directory Structure
@@ -33,13 +17,6 @@ npm run lint # Run Oxlint on src/**/*.{js,jsx,ts,tsx}
3317src/
3418├── api/ # SWR hooks and API functions (91 files)
3519├── components/ # Reusable UI components
36- │ ├── billing/
37- │ ├── charts/
38- │ ├── events/
39- │ ├── saves/
40- │ ├── tables/
41- │ ├── toast/
42- │ └── toggles/
4320├── constants/ # App constants (routes, nav, user types)
4421├── entities/ # TypeScript types and Zod schemas (29 domain models)
4522├── modals/ # Modal dialog components
4825├── state/ # Recoil atoms (8 state files)
4926├── styles/ # CSS files
5027├── utils/ # Utilities and custom hooks
51- │ ├── group-rules/
52- │ └── validation/
5328├── App.tsx # Main app component (handles auth and routing)
5429├── Router.tsx # Route definitions with lazy loading
5530└── index.tsx # App entry point
7348 - ` gamesState ` - User's games list
7449 - ` organisationState ` - Organization data
7550 - ` devDataState ` - Dev data inclusion flag
76- - State consumed via ` useRecoilValue() ` , ` useRecoilState() ` , ` useSetRecoilState() `
77-
78- ### Data fetching
79-
80- 1 . ** SWR hooks** (23 hooks): Pattern is ` use{Entity}(game, params) ` returning ` { data, loading, error } `
81- - Examples: ` useEvents ` , ` useLeaderboards ` , ` useStats `
82- - Uses ` makeValidatedGetRequest() ` for Zod validation
83- - Automatic caching, revalidation, and deduplication
84-
85- 2 . ** Mutation functions** (68 functions): Named after action (e.g., ` createLeaderboard ` , ` updatePlayer ` )
86- - Uses ` makeValidatedRequest() ` wrapper for Zod validation
87- - Returns validated, typed responses
8851
8952### Authorization
9053
9154- Route-level checks with ` canViewPage() ` in Router
9255- Action-level checks with ` canPerformAction() ` throughout components
9356- Based on user type (ADMIN, OWNER, DEV, DEMO)
94-
95- ## Git Workflow
96-
97- Main branch for PRs: ` develop `
0 commit comments