Orienting in Knowtis
Knowtis is a real-time collaborative notes platform: Nx monorepo, pnpm, Node 22. React 19 + Vite frontend, NestJS 11 backend, PostgreSQL 16 + Drizzle, Redis, Yjs/Hocuspocus CRDT collaboration, Vercel AI SDK v6.
For the full layout and dependency rules load references/architecture-map.md. For Nx tags/boundaries and the dual alias namespaces load references/aliases-and-boundaries.md.
The five facts that prevent most wasted sessions
- There are TWO AI modules.
apps/api/src/modules/ai= single-shot AI features (inline assistant).apps/api/src/modules/agent= the conversational copilot (tool loop, HITL, threads). Both sit on the framework-free@knowtis/ai-gatewaypackage. Don't add copilot features toaior vice versa. - Two alias namespaces. 18 workspace entries import as
@knowtis/*; publishable auth/permissions/email packages import as@jovandyaz/*. There is no@knowtis/auth— that import will not resolve. - The
import typeDI footgun. Inapps/api/**,import typeon a constructor-injected class silently breaks NestJS DI (provider arrivesundefined). ESLint auto-fix is disabled there for this reason. - Migrations:
generate+migrate, neverpush. Schema lives inapps/api/src/database/schema/;pnpm db:generateproduces the migration; Railway's pre-deploy command is the only production migrator.drizzle-kit pushagainst shared DBs causes the schema drift that migrations were adopted to fix. - Deploys are CI-driven, not Git-integration-driven. Notes and backoffice deploy to separate Vercel projects; API and MCP deploy through
.github/scripts/railway-deploy.sh. Railway still applieswatchPatternsto uploaded snapshots;SKIPPEDmeans no new deployment became live and must be checked against Nx's affected set.
Working rules
- Everything runs through Nx:
pnpm nx affected -t lint test build,nx run <project> <target>. Alwayspnpm, never npm/yarn. - Module boundaries are ESLint-enforced via tags (
type:app → type:ui/data-access → type:util; scopesshared|notes|api). A new lib needs correct tags or imports will be rejected. - AI features are gated:
ANTHROPIC_API_KEYin env AND DB feature flags (ai_enabled,agent_byok, …) toggled on. A feature "not working" is often just a flag defaulting to off. - Repo docs are canonical:
docs/ARCHITECTURE.md,docs/AI.md,docs/MCP.md,docs/AUTH.md,docs/PERMISSIONS.md,docs/MIGRATIONS.md,docs/DEPLOYMENT.md. Verify behavior against those docs and the current code rather than relying on historical design notes.