ZTS Docs

Folder Structure

Monorepo layout and Next.js App Router conventions in apps/web.

Monorepo overview

Application UI and API route handlers live in apps/web. Shared business logic (tRPC, auth, database) lives in packages/*. See Monorepo layout for the full tree.

This page describes routing and colocation inside the web app: apps/web/src/app/.

Core concepts (App Router)

  • Route groups (...): Parentheses folders are omitted from the URL. They organize routes and layouts without changing paths. Example: apps/web/src/app/(app)/dashboard/page.tsx/dashboard.

  • Private folders _...: Underscore-prefixed folders are not routes. Use them for colocated components, hooks, and utilities. Next.js: private folders

Top-level structure: (landing) vs (app)

Under apps/web/src/app/:

  • (landing): Routes for unauthenticated users — marketing (/home), blog, pricing, and auth (/signin, /signup, … under (auth)).
  • (app): Routes for authenticated users — main product UI after login.

The root path / has no page.tsx. apps/web/src/proxy.ts (Next.js proxy, formerly middleware) rewrites / to /home when logged out or /app when logged in. See Proxy / route protection.

(landing) group

  • Layout: apps/web/src/app/(landing)/layout.tsx — landing header/footer.
  • (auth): Sign-in, sign-up, password flows.
    • Layout: apps/web/src/app/(landing)/(auth)/layout.tsx — centered auth shell.

(app) group

  • Layout: apps/web/src/app/(app)/layout.tsx — app shell (sidebar, header).

Nested layout behavior

  • (full-page) (apps/web/src/app/(app)/(full-page)/layout.tsx): Full viewport height; content scrolls inside the shell (e.g. /admin).
  • (scrollable) (apps/web/src/app/(app)/(scrollable)/layout.tsx): Normal document scroll for settings and content pages.

API routes (apps/web/src/app/api/)

Thin Next.js handlers wire transports to @zts/trpc:

PathFile
/api/trpcapi/trpc/[trpc]/route.ts
/api/restapi/rest/[...path]/route.ts
/api/openapi.jsonapi/openapi.json/route.ts
/api/mcpapi/[transport]/route.ts
/api/auth/*Better Auth (via packages/auth)
/api/uploadthingapi/uploadthing/route.ts

Procedure implementations belong in packages/trpc/src/routers/, not duplicated in apps/web.

Private folders (_components, etc.)

Example: apps/web/src/app/(app)/_components. Prefixing with _ marks non-route colocated code.

Other web paths

AreaPath
Componentsapps/web/src/components/
Server-only (uploadthing, MCP helpers)apps/web/src/server/
Hooksapps/web/src/hooks/
Web env re-exportsapps/web/src/env/ (schemas in packages/env)
tRPC React clientapps/web/src/trpc/

Mobile and extension

  • Mobile screens: apps/mobile/src/ (Expo Router)
  • Extension: apps/extension/src/entrypoints/

Both consume @zts/trpc instead of duplicating apps/web/src/app routes.

On this page