Skip to content

Commit a57ab5a

Browse files
dietmarscharfclaude
andcommitted
feat(dev): add Claude Code development guidance and update gitignore
- Add comprehensive CLAUDE.md with project architecture documentation - Include development guidelines and essential commands for AI-assisted development - Remove CLAUDE.md from .gitignore to track development configuration - Enable proper Claude Code CLI integration with structured project guidance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a90e54b commit a57ab5a

File tree

2 files changed

+109
-2
lines changed

2 files changed

+109
-2
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,4 @@ docker-data/
9191
data/
9292
docs/
9393

94-
.claude/
95-
CLAUDE.md
94+
.claude/

CLAUDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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+
Claudable is a full-stack web application builder that combines AI agent capabilities with an intuitive app building experience. It allows users to generate code through natural language, with instant preview and deployment capabilities.
8+
9+
## Essential Commands
10+
11+
### Development
12+
```bash
13+
npm install # Install dependencies and auto-setup (creates Python venv)
14+
npm run dev # Start both frontend (port 3000) and backend (port 8080)
15+
```
16+
17+
### Database Operations
18+
```bash
19+
npm run db:reset # Reset database to initial state
20+
npm run db:backup # Create database backup
21+
```
22+
23+
### Cleanup
24+
```bash
25+
npm run clean # Remove all dependencies and virtual environments
26+
```
27+
28+
## Architecture Overview
29+
30+
### Monorepo Structure
31+
- **apps/api/**: Python FastAPI backend with WebSocket support
32+
- **apps/web/**: Next.js 14 frontend with App Router
33+
34+
### Backend Architecture (FastAPI)
35+
The API uses a layered architecture:
36+
- **app/api/**: Route handlers organized by feature (assets, chat, commits, github, projects)
37+
- **app/services/**: Business logic layer handling AI interactions, file operations, and external integrations
38+
- **app/models/**: SQLAlchemy models for database entities
39+
- **app/core/**: Shared utilities including WebSocket manager, crypto, and configuration
40+
41+
Key services:
42+
- **ChatService**: Manages AI conversations and code generation
43+
- **ProjectService**: Handles project creation and management
44+
- **AssetService**: Manages file uploads and storage
45+
- **EnvironmentService**: Manages environment variables
46+
- **ExternalService**: Integrates with GitHub, Vercel, and Supabase
47+
48+
### Frontend Architecture (Next.js)
49+
- **App Router**: Uses Next.js 14 app directory structure
50+
- **Component Organization**:
51+
- Common UI components in `components/ui/`
52+
- Feature-specific components in respective directories
53+
- Complex components like Editor, Preview, and Chat in dedicated folders
54+
- **State Management**: React Context (AuthContext) and local component state
55+
- **Real-time Communication**: WebSocket connection for chat and updates
56+
57+
### AI Integration
58+
The system integrates with Claude Code CLI through:
59+
- System prompt at `/apps/api/app/prompt/system-prompt.md`
60+
- Chat service that manages conversations and code generation
61+
- Support for both Claude Code and Cursor CLI agents
62+
63+
## Key Technical Details
64+
65+
### WebSocket Communication
66+
- Real-time chat and updates use WebSocket protocol
67+
- Connection managed through `WebSocketManager` in backend
68+
- Frontend uses custom `useWebSocket` hook for connection handling
69+
70+
### Authentication Flow
71+
- Token-based authentication using cryptography
72+
- Tokens stored in localStorage on frontend
73+
- Backend validates tokens for protected routes
74+
75+
### File System Operations
76+
- Project files stored in `apps/api/data/projects/`
77+
- Asset uploads handled by dedicated asset service
78+
- Git operations performed through subprocess calls
79+
80+
### Environment Configuration
81+
- Frontend env vars in `apps/web/.env.local`
82+
- Backend configuration through environment variables
83+
- Dynamic environment management UI for users
84+
85+
## Development Guidelines
86+
87+
### Adding New Features
88+
1. Backend routes go in `apps/api/app/api/`
89+
2. Business logic belongs in `apps/api/app/services/`
90+
3. Frontend pages use Next.js App Router in `apps/web/app/`
91+
4. Shared components go in `apps/web/components/`
92+
93+
### Database Changes
94+
- Models defined in `apps/api/app/models/`
95+
- Database migrations handled manually
96+
- Use `npm run db:reset` for clean slate during development
97+
98+
### Error Handling
99+
- Backend uses FastAPI's exception handling
100+
- Frontend displays errors through toast notifications
101+
- WebSocket errors trigger automatic reconnection
102+
103+
### External Service Integration
104+
When adding new external services:
105+
1. Add service configuration in backend
106+
2. Create connection modal in frontend
107+
3. Update `ExternalService` to handle new integration
108+
4. Add appropriate environment variables

0 commit comments

Comments
 (0)