System overview
How the platform fits together: apps, packages, request flow, and the core domains.
The platform is a single Next.js product (apps/saas) backed by a typed RPC API and a set of
focused domain packages. A request starts at a React surface, passes through the oRPC API and its
middleware, runs business logic in a domain package, and reads or writes PostgreSQL and object
storage.
Request flow
Browser (React surface)
│ typed oRPC client
▼
@repo/api ── middleware: auth, plan backstop, usage caps, org scoping
│
▼
Domain packages
├─ @repo/auth identity, sessions, organizations, roles
├─ @repo/ingestion parse, chunk, embed, index — plus template/KPI extraction
├─ @repo/rag tenant-scoped retrieval
├─ @repo/advisor grounded answering + conversation persistence
├─ @repo/ai embedding/chat model resolution + per-task routing
└─ @repo/jobs ingestion worker, retries, dead-lettering, retention purge
│
▼
PostgreSQL (pgvector) + S3-compatible object storageCore domains
| Domain | What it owns | Where it lives |
|---|---|---|
| Tenancy & identity | Users, organizations, members, sessions, roles, plan tiers, suspension. | @repo/auth, @repo/database |
| Knowledge ingestion | Turning an uploaded document into searchable, embedded chunks. | @repo/ingestion, @repo/jobs, @repo/storage |
| Retrieval | Finding the right chunks for a question, scoped to the tenant and plan. | @repo/rag |
| Advisor | Producing grounded answers, persisting conversations, recording usage. | @repo/advisor, @repo/ai |
| LP Reporting | LPs, templates and versions, KPI dictionary and mapping, field bindings, submissions, quality checks, aggregation, report generation and export, cycle automation. | @repo/api reporting router, @repo/ingestion, @repo/database |
| Operations | Cross-tenant administration, intelligence, and audit. | @repo/api operator routers, @repo/database |
Two contexts, one application
The saas app serves two route groups:
- The Command Center (
/operator/*and/admin/*), for platform operators. Gated on the globaladminrole. - The GP workspace (
/{organizationSlug}/*), for fund teams. Scoped to a single organization and gated by the organization's plan tier. The reporting screens sit in a nested(reporting)route group gated on both thefullplan and the per-organizationlp_reportingfeature flag.
The operator side is covered in the Command Center section; the fund-facing side in LP Reporting and Getting started.
How multi-tenancy works
Every row of tenant data carries an organizationId, and knowledge rows also carry a tenantScope
of global or org. The API enforces that callers only read and write within an organization they
belong to. Operators can act across tenants, but only through audited procedures. See
Authentication & multi-tenancy.
Technology choices
For engineers: the API is built with oRPC over Hono. Data access uses Drizzle ORM against PostgreSQL with the pgvector extension. Authentication uses better-auth. Embeddings and chat are resolved through OpenRouter, with an optional local Ollama path for development. This documentation site uses Fumadocs.