Guidance for Claude Code (and other coding agents) working in this repository.
The authoritative architecture rules live in AGENTS.md and are imported below —
keep rules there, not here, so there is a single source of truth.
@AGENTS.md
Dompetku (repo dompetku, formerly fintrack) is a single-user personal finance tracker: web app +
Telegram bot (forwarded by n8n) + receipt OCR. Stack: TanStack Start (React 19,
TanStack Router/Query), Tailwind CSS 4 + shadcn/ui, Supabase (Postgres + Storage,
server-side only), Vitest. Deployed on Lovable and Vercel from the same code.
| Path | What lives there |
|---|---|
src/routes/_app/* |
Authenticated pages (dashboard, transactions, reports, …) |
src/routes/api/public/n8n/* |
N8N_API_KEY-guarded automation endpoints |
src/lib/*.server.ts |
Server-only code (DB, AI, email, bot). Never import from the client |
src/lib/*.functions.ts |
createServerFn wrappers (with requireAuth) |
src/lib/*.ts (no suffix) |
Pure, client-safe helpers — unit-tested in src/test/ |
src/components/ |
Shared UI; ui/ is shadcn, charts/ are lazy Recharts wrappers |
supabase/schema.sql |
Idempotent, append-only vN schema sections |
docs/ |
Architecture, self-hosting, env vars, n8n, demo, releasing |
bun run dev # dev server
bun run lint # eslint
bun run typecheck # tsc --noEmit
bun run test # vitest run (src/test/**)
bun run build # production buildCI installs with bun install --frozen-lockfile; bun.lock is the only lockfile (npm install works as a fallback, npm ci does not). Use bun run test, not bun test (that is Bun's own runner, not Vitest).
CI (.github/workflows/ci.yml) runs lint, typecheck, test and build — run all four
before committing; keep them green.
- Don't break what works. Prefer small, additive changes; reuse existing helpers
(
Pagination,money(),invalidateFor,isMissingTable, …) before adding new ones. - Pure logic first. Put math/parsing/formatting in a client-safe
src/lib/*.tsmodule with a Vitest test; keep components and*.server.tsthin. - UI checklist: mobile-first (check a ~375 px viewport and landscape
short:), semantic color tokens only (light + dark), every string throught(...)with an English entry inDICT(src/lib/i18n.tsx), amounts viamoney()/compact()withusePrivacy(), respectprefers-reduced-motionfor any animation or smooth scroll. - Schema changes: new idempotent
vNsection +database.types.ts+RESTORE_TABLESinbackup.ts+ graceful fallback when the section isn't run. - New env vars: optional where possible, add to
.env.exampleanddocs/ENVIRONMENT.md. - When a change adds or alters an architectural rule, add a one-line rule to
AGENTS.md(same terse style as the existing bullets).
- Never commit directly to
main; branch withfeat/,fix/,docs/,chore/,refactor/ortest/. - Conventional Commits:
type(scope): imperative lower-case summary, with a body explaining what and why. Several small logical commits beat one large one. - The PR title becomes the squash commit and drives release-please
(
feat→ minor,fix→ patch,!→ major). Don't editCHANGELOG.mdversioned entries orpackage.jsonversionby hand. - Fill in
.github/pull_request_template.md: summary, linked issue, testing done, screenshots for UI (mobile + desktop, light + dark). - Lovable sync: never force-push or rewrite already-pushed history (see the note at
the top of
AGENTS.md); add new commits instead.
Follow CONTRIBUTING.md and the
CODE_OF_CONDUCT.md. Security issues go through
SECURITY.md, never public issues or PRs. No secrets, personal data or
real API keys in code, fixtures, screenshots or logs.