# Dyolink — Agent guide This file orients Cursor agents at the start of a **new chat**. Project conventions live in **`.cursor/rules/`** (auto-loaded). Workflow playbooks live in **`.cursor/skills/`**. ## What Dyolink is Dental clinic ↔ lab platform (monorepo): | Path | Stack | |------|--------| | `backend/` | NestJS, Prisma, PostgreSQL | | `frontend/` | Next.js 16, React 19, next-intl, Tailwind | | `infrastructure/` | Docker — staging `https://wixur.ir` (Windows, `STAGING-DEPLOY.md`); prod `https://nudentic.ir` (Linux, `DEPLOY.md`) | **Organization types:** `CLINIC` (patients, appointments, treatment) and `LAB` (cases, tasks). Many features are org-type-specific. Permissions use `TAB_*_READ` / `TAB_*_EDIT` codes — see `backend/src/common/permissions.ts`. ## Before you code 1. **Read applicable rules** in `.cursor/rules/` (especially `dyolink-overview` and the file-scoped rule for the area you touch). 2. **Match existing patterns** in the nearest feature folder — do not invent parallel structures. 3. **Keep diffs small** — one concern per change unless the user asks for a refactor. 4. **Verify:** `npm run build` (backend) and `npx tsc --noEmit` (frontend) when you change types or cross-cutting code. ## Frontend layout (critical) ``` frontend/src/ app/ → thin page.tsx only; compose from ui/ components/ ui/shared/ → cross-feature UI (Button, Sidebar, …) ui/{feature}/ → feature UI (+ {Feature}Page.tsx for route logic) shared/ → cross-feature non-UI (formatApiError, permissions, …) {feature}/ → feature non-UI (helpers, config, pure functions) lib/ → api clients, hooks types/ → shared TS types assets/brand|fdi/ → brand + FDI SVG sources (not public/) — see `.cursor/rules/frontend-assets.mdc` messages/{en,fa,nl}.json → all user-facing strings ``` **Example thin page:** `app/.../treatment/page.tsx` → imports `TreatmentWorkspace` from `components/ui/treatment/`. **i18n formatting:** Display dates/times/numbers via `lib/i18n/format.ts` + `useLocale()`. Form dates: **`AppDateInput`** (all locales — same component, masked typing + calendar popup). Appointments / Treatment headers: **`ScheduleDayPicker`** (`compact` centers the date). Filter `