Architecture
Apps
apps/web/— Next.js 16 App Router. Routes split between(marketing)/(public — landing, pricing, blog, docs, changelog, legal, auth flows),[locale]/(app)/...(signed-in product + settings),(admin)/(super-admin console), andapi/(auth, webhooks, cron, OG).
Packages
@saas-kit/ui— shadcn primitives + composites + layouts (M3)@saas-kit/auth— BetterAuth config + owner-safe session helpers + Polar plugin (M1, M2, M4)@saas-kit/db— Drizzle schema + owner-scoped repos (M1, M2, M6)@saas-kit/billing— Polar / PayPal / Sepay providers (M4)@saas-kit/email— Resend + React Email templates (M5)@saas-kit/notifications— in-app + email notification dispatch (M5)@saas-kit/observability— pino + Sentry + PostHog (M5)@saas-kit/audit— transactional audit log + sanctioned cross-user variant (M6)@saas-kit/content— velite collection schemas + reader factory (M7)@saas-kit/context— AsyncLocalStorage carrier (zero deps)
Owner isolation
saas-kit is a single-user B2C foundation. Owned rows carry user_id; authenticated
requests put the caller's user ID in AsyncLocalStorage, and repositories bind every
owned query to that ID. Cross-user admin and system operations live in explicitly
reviewed *.cross-user.ts modules. ESLint and the cross-user integration suite guard
the boundary.