Practical guide for agentic coding assistants working in domainak.
- Backend: Bun + Hono + Drizzle ORM in
server/ - Frontend: React 19 + Vite + TypeScript in
frontend/ - Data: PostgreSQL + Redis
- Proxy/tunnel: OpenResty + Cloudflare Tunnel
- Deployment: Docker Compose + GHCR images
server/- API entrypoint, routes, middleware, configserver/db/- Drizzle schema, Postgres bootstrap, Redis clientserver/routes/- feature routers:auth,admin,domains,statsfrontend/src/pages/- page-level screensfrontend/src/components/- reusable UIfrontend/src/lib/- API client, helpers, shared types.github/workflows/- deployment workflowsdocker-compose.yaml- container stacknginx.conf- OpenResty routing configsetup.sh- guided install/update script
- Use
bunfor root/backend work. - Use
buninfrontend/too. - Both packages are ESM (
"type": "module"). - Prefer package scripts over ad hoc equivalents.
Install:
bun install
cd frontend && bun installDev:
bun run server
cd frontend && bun run dev
cd frontend && bun run previewBuild:
cd frontend && bun run build
docker compose up -d --build
curl -fsSL https://raw.githubusercontent.com/z44d/domainak/main/setup.sh | bashLint:
bun run lint
bunx @biomejs/biome check server
cd frontend && bun run lint
bunx tsc --noEmitNotes:
- backend has no dedicated build script; it runs from
server/index.ts - root
lintrunsbiome check server --write --unsafe, so it mutates files
- There is no automated test script in either
package.json. - No repo-local unit/integration test runner is configured right now.
- There is no canonical
bun test,vitest, orjestcommand. - There is no single-test command yet.
- Verification currently means linting, building, and manual API/UI checks.
Single-test execution is not supported today because the repo has no configured test framework. If you add one, document all of these in this file:
- full-suite command
- single-file command
- single-test-by-name command
- env/setup requirements
bun run db:generate
bun run db:migrate
bun run db:push
bun run db:studio
docker compose up -d --build
docker compose down
docker compose ps
docker compose logs backend --tail=200
docker compose logs openresty --tail=200
docker compose logs cloudflared --tail=200biome.json is the main source of truth for backend/shared TS/JS.
- indentation: 2 spaces
- line width: 75
- line endings: LF
- strings: double quotes
- JSX strings: double quotes
- semicolons: required
- arrow function params: always use parentheses
import typewhere applicable- Node built-ins should use the
node:protocol - unused imports and variables are errors
Frontend eslint.config.js additionally enforces:
- JS/TS recommended rules
- React Hooks rules
- Vite React refresh rules
- Keep external imports before local imports.
- Use type-only imports where possible.
- Backend code currently prefers explicit relative imports.
- Frontend supports
@/*, but most existing code uses relative imports. - Keep imports organized; Biome may reorder them.
- React components: PascalCase (
Navbar,DomainStatsChart) - page files/components: PascalCase (
Admin.tsx,Dashboard.tsx) - functions and variables: camelCase
- constants: UPPER_SNAKE_CASE (
PAGE_SIZE,MAX_PAGE_SIZE) - table variables: lower camel case ending in
Table(userTable) - route files: lowercase feature names (
auth.ts,admin.ts) - interfaces/types: PascalCase (
User,PaginationMeta)
strictmode is enabled; keep code strict.noUncheckedIndexedAccessis enabled; guard indexed reads.- Avoid
anywhen practical, even though it is not globally banned. - Prefer typed response shapes and narrow unions over loose objects.
- Keep shared frontend response types in
frontend/src/lib/types.tsor nearby. - Current backend auth context still uses
Variables: { user: any }; improve carefully and consistently if you touch it.
- Backend routes usually return
c.json({ error: message }, status). - Catch unknown errors and log meaningful context with
console.error. - Frontend fetch code throws
ApiError; handle it explicitly. - Prefer
getErrorMessage()for user-facing frontend messages. - In React effects, use
AbortControllerand avoid post-abort state updates.
- Use functional components and hooks.
- Keep loading, error, and feedback state explicit in page components.
- Use
useCallback,useMemo, anduseRefwhen they help behavior or dependency stability. - Redirect unauthorized users in page logic when needed.
- Session token storage currently uses
localStoragekeysession_token.
- Mount feature routers from
server/index.ts. - Keep route-local helpers near the route file unless broadly reusable.
- Use Drizzle query builders directly; current code favors explicit queries.
- Pagination helpers are plain functions near route definitions.
- Middleware returns JSON errors instead of throwing framework exceptions.
- Backend env handling is centralized in
server/config.ts. - Frontend API base URL comes from
import.meta.env.VITE_API_URL, which deployment currently feeds fromBACKEND_URLduring the frontend image build. docker-compose.yamlbuilds local backend/frontend images and tags them with the GHCR image names.setup.shwrites deployment env vars into~/.domainak/.env.setup.shdownloadsdocker-compose.yamlandnginx.confinto~/.domainak.
No repo-specific rule files were found:
- no
.cursor/rules/ - no
.cursorrules - no
.github/copilot-instructions.md
- Check
git statusbefore editing; the worktree may be dirty. - Do not overwrite unrelated local changes.
- Match existing code patterns before introducing abstractions.
- Run fresh verification commands before claiming success.
- If you add new commands or tooling, update
AGENTS.mdtoo.