Skip to content

Commit 6a9b9ee

Browse files
Userclaude
andcommitted
Add CLAUDE.md for Claude Code guidance
Add comprehensive documentation file to help future Claude instances understand: - Essential commands for development, testing, and deployment - High-level architecture patterns for both backend and frontend - Database migration workflow - Authentication flow details - Development environment URLs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f812bf7 commit 6a9b9ee

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed

CLAUDE.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Full-stack FastAPI + React application with:
8+
- **Backend**: FastAPI, SQLModel, PostgreSQL, Alembic, JWT auth
9+
- **Frontend**: React, TypeScript, Vite, TanStack Query/Router, Chakra UI
10+
- **Infrastructure**: Docker Compose, Traefik proxy
11+
12+
## Essential Commands
13+
14+
### Backend Development
15+
```bash
16+
# Run tests
17+
cd backend && bash ./scripts/test.sh
18+
19+
# Run specific test
20+
cd backend && python -m pytest app/tests/api/routes/test_users.py::test_read_users -xvs
21+
22+
# Lint code
23+
cd backend && bash ./scripts/lint.sh
24+
25+
# Format code
26+
cd backend && bash ./scripts/format.sh
27+
28+
# Create migration
29+
cd backend && alembic revision -m "migration_name" --autogenerate
30+
31+
# Apply migrations
32+
cd backend && alembic upgrade head
33+
34+
# Database setup
35+
cd backend && bash ./scripts/setup_db.sh
36+
```
37+
38+
### Frontend Development
39+
```bash
40+
# Install dependencies
41+
cd frontend && npm install
42+
43+
# Run development server
44+
cd frontend && npm run dev
45+
46+
# Build for production
47+
cd frontend && npm run build
48+
49+
# Lint/format code
50+
cd frontend && npm run lint
51+
52+
# Generate API client from OpenAPI
53+
cd frontend && npm run generate-client
54+
55+
# Run E2E tests
56+
cd frontend && npx playwright test
57+
58+
# Run specific test
59+
cd frontend && npx playwright test tests/login.spec.ts
60+
```
61+
62+
### Docker Development
63+
```bash
64+
# Start all services
65+
docker compose up -d
66+
67+
# View logs
68+
docker compose logs -f backend
69+
70+
# Rebuild specific service
71+
docker compose build backend
72+
73+
# Run backend tests in Docker
74+
docker compose exec backend bash /app/scripts/test.sh
75+
76+
# Access database
77+
docker compose exec db psql -U postgres app
78+
```
79+
80+
## Architecture Patterns
81+
82+
### Backend Structure
83+
- **Models**: SQLModel with UUID primary keys and timestamp mixins (`app/models/`)
84+
- **Routes**: Modular route organization (`app/api/routes/`)
85+
- **Auth**: JWT with refresh tokens, OAuth support (`app/api/routes/auth/`)
86+
- **Config**: Pydantic Settings (`app/core/config.py`)
87+
- **Database**: Async SQLAlchemy sessions (`app/db/session.py`)
88+
89+
### Frontend Structure
90+
- **Routing**: File-based routing with TanStack Router (`src/routes/`)
91+
- **API Client**: Auto-generated from OpenAPI (`src/client/`)
92+
- **Auth**: Token management in localStorage (`src/hooks/useAuth.ts`)
93+
- **Components**: Organized by feature (`src/components/`)
94+
- **UI**: Chakra UI with custom theme (`src/theme.tsx`)
95+
96+
### Database Migrations
97+
Alembic manages migrations. When modifying models:
98+
1. Make changes to SQLModel classes
99+
2. Generate migration: `alembic revision -m "description" --autogenerate`
100+
3. Review generated migration file
101+
4. Apply: `alembic upgrade head`
102+
103+
### Authentication Flow
104+
- Login returns access and refresh tokens
105+
- Access token expires in 15 minutes
106+
- Refresh token used to get new access token
107+
- Frontend automatically refreshes tokens
108+
109+
## Development URLs
110+
- Frontend: http://localhost:5173
111+
- Backend API: http://localhost:8000
112+
- API Docs: http://localhost:8000/docs
113+
- Adminer (DB UI): http://localhost:8080
114+
- MailCatcher: http://localhost:1080
115+
- Traefik Dashboard: http://localhost:8090
116+
117+
## Environment Variables
118+
Create `.env` file from template. Key variables:
119+
- `POSTGRES_*`: Database connection
120+
- `FIRST_SUPERUSER*`: Initial admin account
121+
- `BACKEND_CORS_ORIGINS`: CORS configuration
122+
- `SMTP_*`: Email settings
123+
- `VITE_API_URL`: Frontend API endpoint

0 commit comments

Comments
 (0)