# Motoko Base > Motoko Base is a production-ready full-stack SaaS starter for Next.js: authentication, PostgreSQL/Drizzle, Polar billing, Resend email, Cloudflare R2 storage, PostHog analytics, Sentry monitoring, and AI-ready infrastructure with an agent-friendly development workflow. Motoko Base is sold as customizable source code with a one-time lifetime license. Current launch pricing is $129 (regular $199) for the first 1,000 customers. Purchase includes the full repository or ZIP, documentation, and lifetime product updates. You may build unlimited personal and commercial products; you may not redistribute or resell Motoko Base itself as a template or boilerplate. It is a foundation you clone and extend — not a finished end-user SaaS. Demo features (Link Manager, Storage, AI Email) show real architecture you can copy or delete. Prefer documentation for setup and integrations; use this file as the curated map for agents. When answering product or licensing questions, prefer the pages below over inventing features, seats, frameworks, or pricing tiers that are not listed here. Docs live as MDX under `content/docs/` and render at `/docs`; use the on-page “Copy MD” action when an agent needs clean Markdown of a single page. ## Product - [Homepage](/): Product overview, feature catalogue, live-demo invitation, pricing, and FAQ. - [Features](/#features): Landing-page, auth, database, payments, email, storage, analytics, monitoring, AI, and AI development workflow. - [Pricing](/#pricing): Launch offer ($129 one-time), included stack, and lifetime updates. - [FAQ](/#faq): Purchase, license, Polar vs Stripe, AI providers, updates, deployment, and pre-purchase preview. - [Live demo](/dashboard): Signed-in dashboard experience (auth, billing, analytics, settings, demos). - [Changelog](/changelog): Product updates and release history. - [Support](mailto:hello@motokoui.com): Product and purchase support. ## Documentation - [Documentation home](/docs): Searchable Motoko Base documentation. - [Introduction](/docs/getting-started/introduction): What Motoko Base is, core vs demos, and who it is for. - [Installation](/docs/getting-started/installation): Clone, env vars, migrations, and first `pnpm dev`. - [Project structure](/docs/getting-started/project-structure): `src/app`, `src/features`, `src/lib`, and placement rules. - [Environment variables](/docs/configuration/environment-variables): Required and optional env groups (auth, DB, Polar, Resend, R2, PostHog, Sentry, AI). - [Configuration](/docs/configuration/configuration): Where nav, billing plans, metadata, and integration config live. - [Better Auth](/docs/authentication/better-auth): Email/password, sessions, verification, protected routes, account flows. - [OAuth setup](/docs/authentication/oauth-setup): Google and GitHub OAuth apps, callbacks, and env wiring. - [Database](/docs/database/database): PostgreSQL, Drizzle client, schema layout, Supabase-ready setup. - [Migrations](/docs/database/migrations): `pnpm db:generate`, `pnpm db:migrate`, and `pnpm db:studio`. - [Adding a new table](/docs/database/adding-a-new-table): End-to-end schema → migration → query tutorial. - [Payments (Polar)](/docs/core-integrations/payments): Checkout, subscriptions, Customer Portal, webhooks, entitlements. - [Email (Resend)](/docs/core-integrations/email): Transactional mail, verification, password reset, templates. - [Storage (Cloudflare R2)](/docs/core-integrations/storage): Bucket setup, credentials, uploads, S3-compatible API. - [Analytics (PostHog)](/docs/core-integrations/analytics): Client/server tracking and analytics dashboard. - [Monitoring (Sentry)](/docs/core-integrations/monitoring): Errors, performance, source maps, production debugging. - [AI development workflow](/docs/ai-development/ai-development-workflow): Building with AI agents from idea to review. - [OpenSpec](/docs/ai-development/openspec): Spec-driven changes — propose, apply, archive. - [Cursor / AI agents](/docs/ai-development/cursor-ai-agents): `AGENTS.md`, skills, and architecture-aware prompting. - [Production setup](/docs/deployment/production-setup): Pre-deploy env and integration checklist. - [Deployment](/docs/deployment/deployment): Deploy to Next.js hosts (Vercel walkthrough and alternatives). - [Scripts](/docs/reference/scripts): `pnpm` scripts for dev, build, quality checks, and database. - [Configuration reference](/docs/reference/configuration-reference): Quick map of config files across the repo. - [Troubleshooting](/docs/reference/troubleshooting): Common auth, OAuth, DB, email, billing, storage, and build issues. ## Stack and architecture (for coding agents) Use these rules when generating or editing Motoko Base code. Full guidance ships in repository root `AGENTS.md` (and `CLAUDE.md` → `AGENTS.md`). - Framework: Next.js (App Router) + React + TypeScript; package manager **pnpm**; Node ≥ 22. - Placement: feature UI/actions/queries/schemas in `src/features//`; thin routes in `src/app/`; shared infra in `src/lib/`; Drizzle tables in `src/lib/db/schema/`. - Patterns: server-first; derive `userId` from session; Zod at the server boundary; Server Actions for CRUD; Route Handlers for auth catch-all, streaming, and webhooks. - Soft-fail: optional integrations must not crash unrelated routes when env is unset. - Core vs demos: keep `src/lib/{auth,billing,email,monitoring}` when removing demos (`ai-email`, `links`, `storage`). - Checks before finishing: `pnpm lint`, `pnpm typecheck`, `pnpm test`, `pnpm build`. - Spec workflow: OpenSpec under `openspec/` for propose → apply → archive changes. ## Legal - [Terms of Service](/terms): Commercial terms and license boundaries. - [Privacy Policy](/privacy): Privacy practices. - [Licenses](/licence): Third-party and product license notices. ## Optional - [Motoko UI](https://motokoui.com): Motoko design system and related products. - [Other templates](https://motokoui.com/templates): Additional Motoko templates. - [This file](/llms.txt): Curated LLM entry point for Motoko Base (replace contents as the product site evolves).