Docs

Search documentation

Jump to a documentation page.

PricingMarketingApp

Search documentation

Jump to a documentation page.

Monorepo

Monorepo and subdomains

The project is a pnpm workspace with three deployable surfaces:

HostPackageRole
yournextsaas.xyzapps/marketingLanding, pricing, legal, sitemap
app.yournextsaas.xyzapps/webDashboard at /, auth, API, onboarding
docs.yournextsaas.xyzapps/docs (TanStack Start, port 3002 in dev)Developer documentation

Shared UI and libraries live in packages/shared, packages/core (config + small shared types), and packages/server (database, Better Auth, billing, webhooks).

Environment

  • BETTER_AUTH_URL: origin of the app deployment (where /api/auth is served).
  • BETTER_AUTH_TRUSTED_ORIGINS: include both marketing and app origins in production.
  • BETTER_AUTH_COOKIE_DOMAIN: optional, e.g. .yournextsaas.xyz, so the session cookie is visible on both apex and app (for marketing loaders that call getSession()).
  • VITE_SITE_URL: canonical base for each app (marketing vs app may differ).
  • VITE_APP_ORIGIN / VITE_MARKETING_ORIGIN: used by appHref() / marketingHref() in shared code for cross-app links when origins differ.

Local development

  • Marketing: pnpm dev:marketing (default port 3000).
  • Docs: pnpm dev:docs (default port 3002); root URLs like /guide/monorepo (no /docs prefix).

For Sign in / Dashboard links on the landing page to reach the product app, set VITE_APP_ORIGIN=http://localhost:3001. For Better Auth not to reject requests with Invalid origin, set BETTER_AUTH_TRUSTED_ORIGINS to include both http://localhost:3000 and http://localhost:3001. For links from marketing to the docs app, set VITE_DOCS_ORIGIN=http://localhost:3002 (or your production docs URL). Details: Environment variables.

Related