This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a full-stack monorepo using Bun workspaces with TanStack Start frontend and Elysia backend. The project demonstrates clean architecture with feature-based organization.
- Frontend: TanStack Start (React Router + SSR), TanStack Query, Jotai (state), shadcn/ui
- Backend: Elysia.js with Better Auth, Swagger docs
- Database: Drizzle ORM with SQLite/Turso
- Runtime: Bun
- Styling: Tailwind CSS
# Start all apps in dev mode
bun dev
# Install dependencies
bun install
# Run specific app
bun --filter=backend dev
bun --filter=web dev# Type check all packages
bun typecheck
# Lint all packages
bun lint
bun lint:fix
# Format all packages
bun format
bun format:fix
# Check workspace dependencies
bun lint:ws# Generate migrations
bun db:generate
# Push schema to database
bun db:push
# Seed database
bun db:seed
# Open Drizzle Studio
bun db:studio# Build all packages
bun build
# Clean all node_modules and build artifacts
bun cleanapps/
├── backend/ # Elysia.js API server
└── web/ # TanStack Start frontend
packages/
├── backend-client/ # Type-safe API client (Eden Treaty)
└── db/ # Drizzle ORM schemas and migrations
tooling/ # Shared configs (ESLint, Prettier, TypeScript, Tailwind)
- Domain: Business entities, repository interfaces (
*-entity.ts,*-repository.ts) - Application: Services, use cases (
*-service.ts) - Infrastructure: Repository implementations (
*-drizzle-db-repo.ts,*-api-repo.ts) - Presentation: Controllers, components (
*-controller.ts,*-routes.ts)
Both frontend and backend use feature-based organization:
features/
└── feature-name/
├── _components/ # Feature-specific UI components
├── _controllers/ # State management controllers
├── _domain/ # Domain models and interfaces
├── _lib/ # Infrastructure implementations
└── _services/ # Business logic services
- Use Elysia instances as controllers with method chaining
- Group routes with prefixes and include Swagger
detailproperty - Class-based services with arrow function methods
- All methods accept/return objects for consistency
- Class-based controllers with Jotai atoms for state
- All hooks return objects (even single values):
return { isPending } - Repository pattern for data fetching with descriptive naming
- Component composition following shadcn/ui patterns
- Better Auth integration on both frontend and backend
- Session management with type-safe exports
- Authentication middleware in backend
- Drizzle ORM with type-safe schemas
- Repository pattern for data access
- Migrations managed via Drizzle Kit
- Use arrow functions for class methods
- Object parameters and returns for all functions
- Absolute imports with
~prefix - Direct imports (avoid barrel files)
- Feature-specific folders use underscore prefix
- kebab-case for all files and directories
- Descriptive repository names:
entity-infrastructure-type-repo.ts - Clear entity/model separation:
*-entity.tsvs*-model.ts
- Small, focused components with isolated re-renders
- Single-responsibility hooks
- Proper TypeScript with interfaces over types
The project uses a shared .env file at the root level. Backend and web apps access it via with-env scripts that load environment variables.
- Count: File-based persistence demo
- Messages: CRUD operations with database persistence
- Pokemon: External API integration with caching
- Auth: Complete authentication flow with Better Auth