Docs

Search documentation

Jump to a documentation page.

PricingMarketingApp

Search documentation

Jump to a documentation page.

Overview

System overview

High-level architecture for the YourNextSaaS monorepo: deployable apps, shared packages, auth, admin, and cross-cutting features.

Monorepo layout

  • pnpm workspace: apps/web (TanStack Start, product), apps/docs (developer documentation site), apps/marketing (public site).
  • Shared code: packages/core (config, origins), packages/server (DB, auth, billing, webhooks), packages/shared (UI, hooks, features).

Production hosts

  • Marketing apex — landing, pricing, legal, SEO, sitemap.
  • app.* — authenticated product (dashboard shell, settings, APIs).
  • docs.* — this documentation site.

Better Auth

  • BETTER_AUTH_URL must be the product origin (where /api/auth is served).
  • BETTER_AUTH_TRUSTED_ORIGINS must list every browser origin in use (marketing + app in production).
  • Optional BETTER_AUTH_COOKIE_DOMAIN (e.g. .yournextsaas.xyz) for shared cookies across subdomains.

Details: Auth & sessions.

Operator console

  • /admin/* on the product app (same shell as the dashboard).
  • Dashboard / includes usage analytics via server functions scoped to the user’s orgs.
  • Platform admins also load aggregate KPIs and catalog-based estimates where implemented.

Settings and workspace

  • Settings layout wraps /settings/*.
  • Workspace actions: packages/server/src/org/workspace-actions.ts (profile name, create org, list members).
  • Onboarding checklist: /onboarding.

Audit log

  • Org-scoped audit_log_entries (actor, action, resource, metadata, IP).
  • Settings UI: /settings/audit-log.
  • Server: packages/server/src/audit/*.
  • Typical writes: workspace create, API key create/revoke, Stripe checkout/portal, invitation create/revoke/accept.

Invitations

  • Table organization_invitations with token hash.
  • Create/list/revoke on Team settings; accept at /invite/$token.
  • Sign-in/up support ?redirect= for returning to the invite link.

Webhooks (outbound)

  • Tables webhook_endpoints and webhook_deliveries.
  • Settings: /settings/webhooks.
  • Server: packages/server/src/webhooks/*.
  • Signed POSTs: X-YNS-Signature, X-YNS-Event, X-YNS-Delivery.
  • Dispatched on workspace/invite lifecycle and manual webhook.ping tests.

SEO and marketing

  • Public routes use SEO helpers, VITE_SITE_URL, dynamic sitemap.xml, and public/robots.txt on the marketing app.

See SEO & discoverability.

i18n and RTL

  • Root route context exposes locale (en | ar) from cookie yns_locale and Accept-Language.
  • AppI18nProvider + messages under shared i18n paths; RTL via dir="rtl" on <html> for Arabic.

See i18n & RTL.

Related