You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document provides guidance for AI coding agents (GitHub Copilot, Claude, etc.) working on the KeepWiz codebase.
Project Overview
KeepWiz is a full-stack Progressive Web Application (PWA) for tracking card game scores, specifically designed for the Wizard card game. It features offline-first capabilities, player statistics, and real-time sync.
State Management: React Context API + custom hooks (no Redux)
Data Fetching: TanStack React Query for server state
Local Database: Dexie.js wrapping IndexedDB for offline storage
Routing: React Router v7 with nested routes
Styling: CSS Modules and plain CSS (no Tailwind/styled-components)
PWA: Custom service worker with caching strategies
Icons: Lucide React icons
Charts: Chart.js with react-chartjs-2 and Recharts
Backend Patterns
Authentication: JWT tokens with bcrypt password hashing
Middleware: Custom auth, error handler, and rate limiter
Validation: express-validator
ODM: Mongoose with schema definitions in /models
Caching: Redis for rate limiting and session caching
Database Models
Model
Purpose
User
User accounts and authentication
Game
Generic game records
WizardGame
Wizard-specific game data
TableGame
Table-based game tracking
GameEvent
Game action events for sync
GameSnapshot
Point-in-time game state
PlayerIdentity
Player identification system
PlayerAlias
Alternate player names
GameTemplate
Custom game configurations
SystemGameTemplate
Built-in game templates
UserGameTemplate
User-created templates
Development Commands
Essential Commands
# Initial setup
npm run setup # Full first-time setup# Development
npm run dev # Start all services via Docker
npm run dev:manual # Start backend + frontend manually
docker compose up # Start Docker containers# Testing
npm test# Run all tests
npm run test:backend # Backend tests only
npm run test:frontend # Frontend tests only# Code Quality
npm run lint # Run ESLint
npm run format # Format with Prettier
npm run precommit # Lint + format check + tests
VS Code Tasks
Run Tests: Execute all tests (Ctrl+Shift+P → "Tasks: Run Test Task")
Update Version: Update version numbers and run tests
Start Frontend Dev: Start frontend with hot reload
Docker Compose Up: Full rebuild with no cache
Code Style Guidelines
JavaScript/React
Use functional components with hooks
Prefer named exports over default exports for utilities
Use destructuring for props and imports
Follow existing patterns in adjacent files
Use async/await over .then() chains
File Naming
Components: PascalCase.jsx (e.g., GameCard.jsx)
Utilities: camelCase.js (e.g., gameUtils.js)
Styles: ComponentName.css or component-name.css
Tests: *.test.js in __tests__ folders or tests/ directory