Skip to content

Commit 25781fd

Browse files
committed
docs: add CLAUDE.md with codebase overview for AI assistants
Covers tech stack, project structure, commands, code style, architecture, key files, conventions, and CI/CD setup.
1 parent 801058f commit 25781fd

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# CLAUDE.md - Hazelnode
2+
3+
Workflow automation platform built on Frappe framework with React frontend.
4+
5+
## Tech Stack
6+
7+
**Backend:** Python 3.10+, Frappe 15.0+, MariaDB 10.6+, Redis
8+
**Frontend:** React 18, TypeScript, Vite, TanStack Router/Query, Zustand, ReactFlow, Tailwind CSS
9+
10+
## Project Structure
11+
12+
```
13+
hazelnode/
14+
├── hazelnode/ # Python backend (Frappe app)
15+
│ ├── hazelnode/doctype/ # Data models (workflows, nodes, logs)
16+
│ ├── nodes/ # Node implementations
17+
│ │ ├── actions/ # Email, API call, condition, create/update doc, etc.
18+
│ │ ├── triggers/ # Webhook, schedule, document events
19+
│ │ └── __init__.py # Abstract Node base class
20+
│ ├── fixtures/ # Standard node types (JSON)
21+
│ ├── hooks.py # Frappe hooks
22+
│ └── api.py # REST endpoints
23+
├── frontend/ # React app
24+
│ └── src/
25+
│ ├── components/ # UI, nodes, workflows
26+
│ ├── routes/ # TanStack Router pages
27+
│ ├── stores/ # Zustand state (editor.ts)
28+
│ └── queries/ # React Query definitions
29+
├── pyproject.toml # Python config + Ruff settings
30+
└── .pre-commit-config.yaml # Pre-commit hooks
31+
```
32+
33+
## Commands
34+
35+
```bash
36+
# Tests
37+
bench --site test_site run-tests --app hazelnode
38+
39+
# Frontend dev
40+
cd frontend && npm run dev # Port 8080
41+
cd frontend && npm run build # Build to ../hazelnode/public/frontend/
42+
43+
# Linting
44+
ruff check . # Python lint
45+
ruff format . # Python format
46+
cd frontend && npm run lint # TypeScript lint
47+
```
48+
49+
## Code Style
50+
51+
**Python:** Ruff formatter/linter. Line length 70, tabs, single quotes.
52+
**TypeScript:** ESLint + Prettier. Strict mode enabled.
53+
54+
Pre-commit hooks auto-run on commit (ruff format, ruff check, import sorting).
55+
56+
## Architecture
57+
58+
### Workflow Execution
59+
- Graph-based execution with context passing between nodes
60+
- Triggers: Schedule (CRON), Document Event, Webhook
61+
- Actions: Email, API Call, Condition, Create/Update Doc, Set Variable, Log, Delay
62+
- Condition nodes return `{branch: 'true'|'false'}` for branching
63+
64+
### Key Doctypes
65+
- `Hazel Workflow` - Workflow definition with nodes/connections
66+
- `Hazel Node` - Individual node config
67+
- `Hazel Node Type` - Node type definitions (fixtures)
68+
- `Hazel Workflow Execution Log` - Execution history
69+
70+
### Frontend State
71+
- Editor store (Zustand): nodes, edges, flow state
72+
- React Query: server state for workflows/users
73+
- ReactFlow: visual workflow editor
74+
75+
## Key Files
76+
77+
| File | Purpose |
78+
|------|---------|
79+
| `hazelnode/hazelnode/doctype/hazel_workflow/hazel_workflow.py` | Workflow execution logic |
80+
| `hazelnode/nodes/__init__.py` | Abstract Node base class |
81+
| `hazelnode/nodes/triggers/hazel_webhook_handler.py` | Webhook handler |
82+
| `hazelnode/hooks.py` | Frappe hooks, fixtures, routing |
83+
| `frontend/src/stores/editor.ts` | Zustand editor state |
84+
| `frontend/src/routes/workflow.$id.tsx` | Workflow editor page |
85+
86+
## Conventions
87+
88+
- Node IDs: `node_${counter}_${timestamp}`
89+
- Template vars in params: `{{ variable_name }}`
90+
- API endpoints: `@frappe.whitelist()` decorator
91+
- Error handling: `frappe.throw()` for user errors
92+
- Frontend basepath: `/hazelnode`
93+
94+
## CI/CD
95+
96+
- Triggers on `develop` branch push and all PRs
97+
- Services: MariaDB 10.6, Redis (ports 13000, 11000)
98+
- Python 3.14, Node 24
99+
- Runs: `bench --site test_site run-tests --app hazelnode`

0 commit comments

Comments
 (0)