Project Rules
Project rules
Summary of PROJECT-RULES.md at the monorepo root — that file is the source of truth; this page is for browsing in the docs site.
In the repository, open
PROJECT-RULES.mdat the monorepo root for the exact wording used by contributors and automation.
Goal
This repo is a pnpm monorepo: product (apps/web, TanStack Start), documentation (apps/docs, deploy to docs.*), marketing (apps/marketing), and shared packages (packages/core, packages/server, packages/shared). It targets multi-tenant B2B SaaS with orgs/workspaces, Stripe billing, and solid DX.
Tech stack
- TanStack Start (router + full-stack)
- React + TypeScript
- TanStack Router
- TanStack Query
- Postgres + Drizzle
- Stripe for subscriptions
- shadcn/ui for the design system
Architecture rules
- Multi-tenant by default: business data is scoped with
organizationIdwhere it applies. - Users can belong to multiple organizations (roles: owner, admin, member).
- Product (
app.*/apps/web): authenticated dashboard at/(pathless_shelllayout); settings under/settings/*; platform admin under/admin/*. - Marketing (apex /
apps/marketing): public/,/pricing, legal, sitemap. - Documentation (
docs.*/apps/docs): Markdown undersrc/content/docs, routes at the site root (e.g./guide/monorepo). - Cross-host links use
appHref/marketingHref/docsHreffrom@yournextsaas/core(or@/config/originsin apps) plusVITE_APP_ORIGIN/VITE_MARKETING_ORIGIN/VITE_DOCS_ORIGIN. - Prefer feature-based organization in code where it helps; keep routing file-based.
Coding style
- Strongly typed TypeScript everywhere.
- Prefer hooks and feature modules over large “god” components.
- Server state: TanStack Query; route wiring: loaders/actions in TanStack Router.
- Keep domain logic out of presentational components (
packages/serveror feature modules underpackages/shared).
AI / change discipline
- For new features: propose a short plan, then implement in small steps.
- Avoid deleting or rewriting large files unless asked.
- Prefer small, focused changes per request.