Inside the SaaS Engine
A headless SaaS foundation with auth, payments, subscriptions, credits, Super Admin access, and i18n pre-wired so you can focus on your product.
This project is a headless SaaS engine: pre-wired business logic with minimal UI. Instead of shipping another themed template, it provides the machinery every SaaS needs — authentication, payments, subscriptions, a credit system, simple administrator access, and internationalization — while staying out of the way of your product pages.
Why headless?
Most SaaS boilerplates couple their business logic to a specific landing page design. The moment you rebrand, you fight the template. This codebase splits along a different line:
src/components/— durable primitives. Pricing tables, headers, sidebars, and shadcn/ui. These survive a rebrand.src/blocks/— disposable page sections. They read your translations and wire content into the primitives. Rewrite them per project.src/modules/— pure business logic. Payments, credits, subscriptions, and admin access. Services keep business logic separate from routes. Payments coordinate subscriptions and credits, AI tasks use credits, and payment/storage configuration comes from the config service; check these dependencies and route imports before removing a module.
What's in the box
- Authentication — email/password and OAuth via better-auth, with session management and account linking.
- Payments — Stripe, Creem, Alipay and WeChat Pay are wired through
PaymentManager. The native Alipay/WeChat integrations accept CNY one-time orders. A PayPal adapter is available for projects that wire it into their payment service. - Credits — FIFO consumption, expiration, auto-grant on signup, and revocation for usage-based billing.
- Admin access — explicit Super Admin membership with a full admin panel.
- Multi-database — Drizzle ORM with PostgreSQL, MySQL, SQLite, Turso, and Cloudflare D1 support.
- i18n — English enabled by default, with an extensible locale-aware routing system powered by Paraglide JS.
Getting started
pnpm install
cp .env.example .env.development
pnpm db:push
pnpm dev
The engine runs on SQLite out of the box, with a generated schema entry for the selected dialect. Changing providers also requires matching connection settings, a compatible version-controlled schema source, and a data migration plan for an existing deployment. Build your product on top, not the plumbing underneath.