This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
NexusTimer is a full-stack speedcubing timer and analytics PWA built with Next.js 16, React 19, and TypeScript. It features real-time 3D cube visualization, statistical analysis, community leaderboards, multiplayer modes, and supports 10 languages.
pnpm dev # Dev server with Turbopack (localhost:3000)
pnpm build # Production build (uses webpack, not turbo)
pnpm lint # ESLint
pnpm test # Jest unit tests
pnpm test -- --testPathPattern="path/to/test" # Run single test file
pnpm test:watch # Jest watch mode
pnpm test:e2e # Playwright E2E tests (chromium only, needs dev server)The project follows Feature-Sliced Design (FSD) under src/:
app/— Next.js App Router. Route groups:(with-sidebar)for core app pages,(legal)for legal pages. API routes underapi/v1/.entities/— Domain models and types (user, solve, cube, statistics, achievement, settings, backup).features/— Feature modules withmodel/(logic, hooks, types) andui/(components) subdirectories. ~30+ features including timer, authentication, leaderboards, deep-statistics, manage-solves.widgets/— Composite UI components that combine multiple features (sidebar, navigation-header, stats-dashboard, cubes-dashboard).shared/— Cross-cutting concerns:config/— i18n, auth, firebase, mongodb connectionmodel/— Zustand stores (timerStore, settingsStore, overlayStore)lib/— Utility functionshooks/— Custom React hooksui/— Shared UI componentstypes/,const/,data/— Types, constants, static data
components/— Root-level components:ui/has Shadcn/ui primitives,providers/has context providers.
- State: Zustand stores for client state, SWR for server data fetching, IndexedDB (via
idb) for offline-first local persistence - Database: MongoDB via Mongoose for user data, solves, backups. Firebase Realtime Database + Firestore for multiplayer features.
- Auth: NextAuth v5 (beta) with Google and Discord OAuth providers. Config at
src/shared/config/auth/auth.ts. - i18n: next-intl with cookie-based locale selection. 10 locales in
messages/{locale}.json. English is the default fallback; messages are deep-merged. - UI: Shadcn/ui (Radix-based) + Tailwind CSS v4. 3D rendering with Three.js/React Three Fiber. Charts with Recharts.
- PWA: Serwist service worker (
src/app/sw.ts) - Multiplayer: PeerJS for P2P connections, Firebase for room management
- Prettier: no semicolons, single quotes, trailing comma "none", 120 char width, LF line endings
- Path alias:
@/*maps tosrc/* - Husky + lint-staged run on pre-commit
- Unit tests: Jest with jsdom environment,
*.test.tsfiles. Files matching*.spec.tsare excluded from Jest (those are Playwright). - E2E tests: Playwright in
e2e/directory, Chromium only, 120s timeout. Auto-starts dev server if not running.