|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Modules |
| 4 | +- Turborepo monorepo: |
| 5 | + - `apps/desktop` (Tauri v2 + SolidStart), `apps/web` (Next.js), `apps/cli` (Rust CLI). |
| 6 | + - `packages/*` shared libs (e.g., `database`, `ui`, `ui-solid`, `utils`, `web-*`). |
| 7 | + - `crates/*` Rust media/recording/rendering/camera crates. |
| 8 | + - `scripts/*`, `infra/`, and `packages/local-docker/` for tooling and local services. |
| 9 | + |
| 10 | +## Build, Test, Develop |
| 11 | +- Install: `pnpm install`; setup: `pnpm env-setup` then `pnpm cap-setup`. |
| 12 | +- Dev: `pnpm dev` (web+desktop). Desktop only: `pnpm dev:desktop`. Web only: `pnpm dev:web` or `cd apps/web && pnpm dev`. |
| 13 | +- Build: `pnpm build` (Turbo). Desktop release: `pnpm tauri:build`. |
| 14 | +- DB: `pnpm db:generate` → `pnpm db:push` → `pnpm db:studio`. |
| 15 | +- Docker: `pnpm docker:up | docker:stop | docker:clean`. |
| 16 | +- Quality: `pnpm lint`, `pnpm format`, `pnpm typecheck`. Rust: `cargo build -p <crate>`, `cargo test -p <crate>`. |
| 17 | + |
| 18 | +## Coding Style & Naming |
| 19 | +- TypeScript: 2‑space indent; Biome formats/lints (`pnpm format`). |
| 20 | +- Rust: `rustfmt` + workspace clippy lints. |
| 21 | +- Naming: files kebab‑case (`user-menu.tsx`); components PascalCase; Rust modules snake_case, crates kebab‑case. |
| 22 | +- Runtime: Node 20, pnpm 10.x, Rust 1.88+, Docker for MySQL/MinIO. |
| 23 | + |
| 24 | +## Testing |
| 25 | +- TS/JS: Vitest where present (e.g., desktop). Name tests `*.test.ts(x)` near sources. |
| 26 | +- Rust: `cargo test` per crate; tests in `src` or `tests`. |
| 27 | +- Prefer unit tests for logic and light smoke tests for flows; no strict coverage yet. |
| 28 | + |
| 29 | +## Commits & PRs |
| 30 | +- Conventional style: `feat:`, `fix:`, `chore:`, `improve:`, `refactor:`, `docs:` (e.g., `fix: hide watermark for pro users`). |
| 31 | +- PRs: clear description, linked issues, screenshots/GIFs for UI, env/migration notes. Keep scope tight and update docs when behavior changes. |
| 32 | + |
| 33 | +## Agent‑Specific Practices (inspired by CLAUDE.md) |
| 34 | +- Do not start extra servers; use `pnpm dev:web` or `pnpm dev:desktop` as needed. |
| 35 | +- Never edit auto‑generated files: `**/tauri.ts`, `**/queries.ts`, `apps/desktop/src-tauri/gen/**`. |
| 36 | +- Prefer existing scripts and Turbo filters over ad‑hoc commands; clear `.turbo` only when necessary. |
| 37 | +- Database flow: always `db:generate` → `db:push` before relying on new schema. |
| 38 | +- Keep secrets out of VCS; configure via `.env` from `pnpm env-setup`. |
| 39 | +- macOS note: desktop permissions (screen/mic) apply to the terminal running `pnpm dev:desktop`. |
| 40 | + |
| 41 | +## Effect Usage |
| 42 | +- Next.js API routes in `apps/web/app/api/*` are built with `@effect/platform`'s `HttpApi` builder; copy the existing class/group/endpoint pattern instead of ad-hoc handlers. |
| 43 | +- Acquire backend services (e.g., `Videos`, `S3Buckets`) inside `Effect.gen` blocks and wire them through `Layer.provide`/`HttpApiBuilder.group`, translating domain errors to `HttpApiError` variants. |
| 44 | +- Convert the effectful API to a Next.js handler with `apiToHandler(ApiLive)` from `@/lib/server` and export the returned `handler`—avoid calling `runPromise` inside route files. |
| 45 | +- On the server, run effects through `EffectRuntime.runPromise` from `@/lib/server`, typically after `provideOptionalAuth`, so cookies and per-request context are attached automatically. |
| 46 | +- On the client, use `useEffectQuery`/`useEffectMutation` from `@/lib/EffectRuntime`; they already bind the managed runtime and tracing so you shouldn't call `EffectRuntime.run*` directly in components. |
0 commit comments