Skip to content

Commit 021ed9f

Browse files
committed
docs: add CLAUDE.md project conventions
1 parent 3b2c028 commit 021ed9f

1 file changed

Lines changed: 181 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# Teedy — Conventions for Claude Code
2+
3+
Maintained fork of sismics/docs (Teedy). Document management system with OCR, tagging, workflows, and REST API. Java 21 backend, Vue 3 frontend, PostgreSQL storage.
4+
5+
## Tech Stack
6+
7+
- **Backend:** Java 21, Maven 3.9.9, Jakarta EE 10, Jetty 12, Jersey 3.1, Hibernate 6.6, Lucene 10
8+
- **Frontend:** Vue 3 (Composition API), TypeScript, Vite, PrimeVue 4 (Lara preset), Pinia, TanStack Vue Query, vue-i18n
9+
- **Database:** PostgreSQL 17 (production), H2 embedded (dev/test)
10+
- **Docker:** Ubuntu 24.04, OpenJDK 21, Jetty 12, Tesseract OCR, ffmpeg, mediainfo
11+
- **CI:** GitHub Actions → GHCR multi-arch images (amd64 + arm64)
12+
13+
## Project Structure
14+
15+
pom.xml # Maven parent (docs-parent)
16+
docs-core/ # Domain, persistence, services, Lucene, DB migrations
17+
docs-web-common/ # Shared web/security (JWT, API key filters)
18+
docs-web/ # JAX-RS REST API + Vue SPA
19+
src/main/java/.../resource/ # REST endpoints (@Path)
20+
src/main/webapp/ # Vue 3 SPA (Vite project)
21+
src/views/ # Page components
22+
src/components/ # Reusable components
23+
src/stores/ # Pinia stores
24+
src/api/ # API client modules
25+
src/assets/ # CSS tokens + theme
26+
src/theme/ # PrimeVue preset (primary palette)
27+
src/locale/ # i18n JSON files
28+
src/test/java/ # REST integration tests (JUnit 5)
29+
docs-importer/ # Separate Node.js bulk importer (optional)
30+
Dockerfile # Production image
31+
docker-compose.yml # Example stack (app + Postgres)
32+
33+
## Build & Run
34+
35+
Backend (from repo root):
36+
37+
./mvnw clean -DskipTests install # Dev build
38+
./mvnw -Pprod -DskipTests clean install # Production WAR (includes Vite build)
39+
40+
Frontend dev server (from docs-web/src/main/webapp/):
41+
42+
npm install
43+
npm run dev # Vite dev server with API proxy to :8080
44+
45+
Backend dev server (from docs-web/):
46+
47+
../mvnw jetty:run # Jetty on :8080, context /docs-web
48+
49+
Docker:
50+
51+
docker compose up -d # App + Postgres on :8080
52+
53+
## Tests
54+
55+
./mvnw test # All tests (JUnit 5, ~24 REST integration tests)
56+
./mvnw test -pl docs-web # Web module tests only
57+
./mvnw test -pl docs-core # Core module tests only
58+
59+
Tests use embedded H2 and Jersey Test Framework. CI also requires ffmpeg, mediainfo, tesseract-ocr on the host.
60+
61+
## Database Migrations
62+
63+
Custom incremental SQL, not Flyway/Liquibase:
64+
65+
docs-core/src/main/resources/db/update/dbupdate-NNN-M.sql
66+
67+
Current version: `db.version=36` in `config.properties`. `DbOpenHelper` reads `DB_VERSION` from `T_CONFIG` and runs upgrade scripts in order. When adding a migration, increment the version in `config.properties` and create the corresponding SQL file.
68+
69+
## REST API
70+
71+
All endpoints under `/api/*`. Auth via session cookie or `Authorization: Bearer tdapi_<hex>` (API keys).
72+
73+
Key resources: `/document`, `/tag`, `/file`, `/user`, `/apikey`, `/webhook`, `/app`, `/acl`, `/group`, `/comment`, `/metadata`, `/auditlog`, `/theme`, `/route`, `/routemodel`, `/tagmatchrule`, `/oidc`.
74+
75+
Content-Type for mutations: `application/x-www-form-urlencoded` (form params). File upload: `multipart/form-data` on `PUT /api/file`.
76+
77+
## Frontend Conventions
78+
79+
- PrimeVue components everywhere — no raw HTML form elements in new code
80+
- Colors via `--p-*` (PrimeVue semantic tokens) or `--teedy-*` aliases in `teedy-tokens.css`
81+
- Brand primary: `#2aabd2` defined in `src/theme/primary.ts`
82+
- Dark mode: `.dark-mode` class on `documentElement`, PrimeVue handles palette
83+
- Stores: Pinia (`auth.ts`, `tagFilter.ts`)
84+
- Data fetching: TanStack Vue Query for cacheable reads, direct Axios for mutations
85+
- i18n: `vue-i18n` with lazy-loaded locales, English bundled
86+
87+
## Deployment (Saturn)
88+
89+
Production runs on Saturn (Synology NAS). The production stack lives in the portainer-stacks repo, not here.
90+
91+
# Push code
92+
git push
93+
94+
# Pull on Saturn and rebuild
95+
ssh saturn.local "cd /volume1/docker-compose && /usr/local/bin/git pull"
96+
ssh saturn.local "cd /volume1/docker-compose/stacks/teedy && sudo /usr/local/bin/docker-compose up -d --build"
97+
98+
# Verify
99+
ssh saturn.local "sudo /usr/local/bin/docker ps --filter name=teedy"
100+
ssh saturn.local "sudo /usr/local/bin/docker logs teedy --tail 20"
101+
102+
CI publishes images to `ghcr.io/fmaass/teedy-docs` with tags: `v*` for releases, `latest` on main, `release-<branch>-rc-<sha>` for release branches.
103+
104+
## Homelab Context
105+
106+
- **Saturn** — Main Docker host (Synology NAS), 192.168.1.50, `ssh saturn.local`
107+
- **Merkur** — This machine (Mac), 192.168.1.51 — **NEVER SSH to it, run commands directly**
108+
- Domain: `*.discomarder.live` (Cloudflare DNS → Saturn:443 via Traefik)
109+
- Teedy URL: `https://teedy.discomarder.live` (behind Authelia + OIDC)
110+
- Database: shared `postgres17` container on Saturn
111+
112+
Saturn requires full paths and sudo:
113+
114+
ssh saturn.local "sudo /usr/local/bin/docker ps"
115+
ssh saturn.local "sudo /usr/local/bin/docker logs <container>"
116+
117+
## Git Workflow
118+
119+
- NEVER commit directly to `main`. Create `feature/<name>` or `fix/<name>` branch first.
120+
- Integration branch: `release/2.6` (current). Feature branches off release branch.
121+
- Squash merge to release branch when feature is done.
122+
- When release is complete: merge release branch to `main`, tag `vX.Y.Z`.
123+
- Delete branches after merge.
124+
- NEVER add `Co-authored-by` trailers or use `--trailer` flags. Subject + body only.
125+
- Global hook at `~/.config/git/hooks/commit-msg` strips trailers as safety net.
126+
127+
## Environment Variables
128+
129+
Key app config (set via Docker env or JVM system properties):
130+
131+
DOCS_BASE_URL # Public URL (e.g. https://teedy.discomarder.live)
132+
DOCS_DEFAULT_LANGUAGE # OCR language (e.g. deu)
133+
DOCS_ADMIN_PASSWORD_INIT # Bcrypt hash for initial admin password
134+
DOCS_TRASH_RETENTION_DAYS # Auto-purge trashed docs (default 30)
135+
DOCS_MAX_UPLOAD_SIZE # Max file upload in bytes (default 500MB)
136+
DATABASE_URL # JDBC URL
137+
DATABASE_USER / DATABASE_PASSWORD
138+
DOCS_SMTP_* # Email config
139+
140+
## Working Style
141+
142+
- Never suggest stopping, pausing, or deferring work. Just do it.
143+
- **Boy Scout Rule**: when touching files, clean up adjacent files in the same directory — stale references, dead docs, inconsistencies. Stay proportional, don't over-fix.
144+
145+
## Session Review
146+
147+
After completing an implementation session (all tasks done, committed, deployed/verified), automatically produce a **Session Review** before ending. Also produce one when prompted with "session review".
148+
149+
Use this exact format:
150+
151+
# Session Review — YYYY-MM-DD
152+
153+
## Delivered
154+
- **Branch**: `feature/xxx` → merged to `release/2.6` / still open
155+
- Feature/fix A: one-line description
156+
- Feature/fix B: one-line description
157+
- **Duration**: ~Xh (wall clock estimate)
158+
159+
## Issues
160+
161+
### 1. Short title
162+
- **Symptom**: What was observed (1-2 sentences)
163+
- **Root cause**: Why (1 sentence)
164+
- **Fix**: What was done (1 sentence)
165+
- **Rule**: Prevention rule for future sessions
166+
- **Repeat?**: No / Yes — see Session YYYY-MM-DD #N
167+
168+
## Observations
169+
- Non-urgent patterns, things that worked well, things to watch
170+
171+
## Action Items
172+
| # | Action | Priority | Effort | From |
173+
|---|--------|----------|--------|------|
174+
| 1 | Description | High/Med/Low | Small/Med/Large | #N |
175+
176+
Rules for writing the review:
177+
- **Delivered first.** Always record what shipped, not just what broke.
178+
- **No debugging narrative.** Each issue gets the 5-field structure above.
179+
- **Flag repeats.** If an issue matches a previous session's lesson, mark it.
180+
- **Action items link back** to the issue number via the `From` column.
181+
- **Keep it tight.** Each issue 5-8 lines max. Whole review fits on one screen.

0 commit comments

Comments
 (0)