Architecture
Before changing app structure, route boundaries, or shared ownership rules, read and follow b2b2c-architecture-contract.md.
Workspace Shape
apps/appUnified product app fororg,portal, andplatform.apps/marketingOptional public marketing surface.apps/docsDocusaurus app that publishesdocs/apponly.packages/backendConvex backend package.packages/*Shared typed packages and repo-wide infrastructure.
There is no separate apps/web or apps/admin app in this starter.
Product App Shape
The product app is surface-first.
apps/app/src/app/[locale]/*Owns route entrypoints, layouts, and route-local page composition.apps/app/src/app/[locale]/org/**Owns organization-staff routes, supporting components, hooks, and helpers.apps/app/src/app/[locale]/portal/**Owns tenant portal routes and portal-specific UI.apps/app/src/app/[locale]/platform/**Owns platform-operator routes and platform-specific UI.apps/app/src/app/[locale]/_components/*,_hooks/*,_lib/*Own app-shared modules only after reuse is proven across surfaces.
Default placement rule:
- Start in the owning route tree.
- Keep the page body in
page.tsxby default. - Keep route-local support code in underscored folders next to the route.
- Promote code into app-shared folders only when it is intentionally shared across surfaces.
Import Rules
- Use
@/for cross-boundary imports insideapps/app. - Use relative imports only for tightly-coupled local files in the same module area.
- Do not deep-import another route tree's private
_components/*,_hooks/*, or_lib/*.
Convex Rules
All authored Convex source lives in packages/backend/convex.
apps/app/src/**may import app-facing references from@convex/*.@convex/*resolves intopackages/backend/convex/*through the app TypeScript config.apps/app/convexis generated-only and exists for app-side generated imports. Do not author backend code there.- Inside
packages/backend/convex/**, use local generated imports such as./_generated/server.
Root files in packages/backend/convex should stay runtime-global only:
auth.tsauth.config.tshttp.tscrons.tsschema.ts
Everything else belongs in an owning namespace such as org/, portal/, platform/, notifications/, or system/.
Shared Packages
Use packages/* for typed configuration, shared primitives, and cross-app infrastructure.
Promotion rule:
- Start app-local.
- Move into
packages/*only after reuse is real or the module is clearly repo-wide infrastructure.
Docs Split
docs/appDurable starter docs for product-facing architecture and app extension.docs/devDeveloper, backend, integration, deployment, and operations docs.
Older client-specific planning and product docs are archived from the main app-docs sidebar and should not be treated as starter-kit source of truth.