# Repository Guidelines ## Project Structure & Module Organization - `backend/`: Go API server (Fiber) + services + DB models/migrations. - `backend/app/http/`: HTTP modules (e.g. `super/`, `tenant/`, `tenant_public/`). - `backend/app/services/`: business logic; prefer GORM-Gen queries (`backend/database/models/*`). - `backend/database/migrations/`: SQL migrations. - `backend/docs/`: generated Swagger (`swagger.json/yaml`, `docs.go`). - `frontend/`: - `frontend/superadmin/`: platform super admin UI (Vite + Vue 3 + PrimeVue). - `frontend/admin/`, `frontend/user/`: tenant admin/user apps. - `specs/`: source-of-truth specs (e.g. DB schema). ## Coding Style & Naming Conventions - **Backend rule of law**: all backend development MUST follow `backend/llm.txt` (HTTP/module layout, generated-file rules, GORM-Gen usage, transactions, comments, and route conventions). - Go: run `gofmt` on changed files; keep HTTP handlers thin (bind → `services.*` → return). - Backend layering: controllers must not call `models.*`, `models.Q.*`, or raw `*gorm.DB` CRUD directly; all DAO/DB operations must live in `backend/app/services/*` (controller only does bind/validate → `services.*` → return). - HTTP module directories are `snake_case`; path params are `camelCase` and prefer typed IDs like `:orderID` to avoid route conflicts. - Avoid editing generated files (e.g. `backend/app/http/**/routes.gen.go`, `backend/docs/docs.go`); regenerate via `atomctl` instead. ## Testing Guidelines - Go tests: `go test ./...` (some service tests exist under `backend/app/services/*_test.go`). - Frontend: build + lint are the main checks (`npm -C frontend/superadmin run build && npm -C frontend/superadmin run lint`). ## Commit & Pull Request Guidelines - Commits generally follow a simple convention like `feat: ...` / `fix: ...` / `chore: ...` (keep subject short and imperative). - PRs: describe behavior change, list impacted APIs/pages, and include screenshots for UI changes (especially `frontend/superadmin/`). ## Security & Configuration Tips - Configure API base via `VITE_API_BASE_URL` (superadmin). - Keep secrets out of git; prefer local `backend/config.toml` overrides for DB/JWT settings.