2.5 KiB
2.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Essential Commands
Development
yarn dev # Start Vite development server on port 5173
yarn preview # Preview production build locally
Build & Deploy
yarn build # Create production build with Vite
make build # Build Docker image (tuxpa.in/a/lto:v0.0.2)
make push # Push Docker image to registry
Code Quality
yarn lint # Check code with Biome
yarn lint:fix # Auto-fix linting issues
yarn format # Format code with Biome
Architecture Overview
This is a React-based inventory management system for the game "Trickster Online" via the lifeto.co platform.
Key Technologies
- React 19 with TypeScript
- Vite for bundling and dev server
- Jotai for atomic state management
- TanStack Query for server state and caching
- Tailwind CSS for styling
- Axios for HTTP requests
Core Architecture
-
State Management Pattern:
- Jotai atoms in
src/state/atoms.tshandle all application state - Uses
atomWithQueryfor server data integration - Persistent storage via
atomWithStoragewith superjson serialization - Actions are implemented as write-only atoms (e.g.,
doLoginAtom,orderManagerAtom)
- Jotai atoms in
-
API Integration:
- All API calls go through
LTOApiinterface (src/lib/lifeto/api.ts) - Token-based authentication via
TokenSession - Development: Vite proxy to
https://beta.lifeto.co - Production: Caddy reverse proxy configuration
- All API calls go through
-
Component Structure:
- Entry:
src/index.tsx→App.tsx - Main sections: Login, Character Selection, Inventory Management
- Components follow atomic design with clear separation of concerns
- Entry:
-
Business Logic:
- Domain models in
src/lib/trickster.ts(Character, Item, Inventory) - Order management via
OrderManagerclass for item transfers - Item filtering uses Fuse.js for fuzzy search
- Domain models in
-
Data Flow:
User Action → Component → Jotai Action Atom → API Call → Server Response → Query Cache → Atom Update → UI Re-render
Development Notes
- The app uses a proxy setup to avoid CORS issues with the lifeto.co API
- All API responses are strongly typed with TypeScript interfaces
- State persistence allows users to maintain their session and preferences
- The inventory system supports multi-character management with bulk operations