Skip to content

dremnik/microprojects

Repository files navigation

microprojects – Modern SaaS Starter Template

A battle-tested Next.js 15 boilerplate that ships with everything you need to launch a multi-tenant SaaS product:

  • Authentication, organizations and SSO powered by Clerk
  • Subscription & usage-based billing with Stripe
  • SQL migrations & type-safe queries via Drizzle ORM
  • Beautiful component library from shadcn/ui + Tailwind CSS
  • End-to-end TypeScript, ESLint, Prettier & Rocket-fast pnpm workflow

Built so you can focus on your product, not plumbing.


Quick start

  1. Clone & install
    git clone https://github.com/your-org/microprojects.git
    cd microprojects
    pnpm install # or npm / yarn
  2. Configure environment – create a .env.local file and add your secrets:
    # example
    NEXT_PUBLIC_APP_URL=http://localhost:3000
    CLERK_SECRET_KEY=sk_test_...
    # ...see full list below
    Required keys:
    Key Notes
    NEXT_PUBLIC_APP_URL Base URL used in emails & OAuth callbacks
    Clerk
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
    CLERK_SECRET_KEY
    Stripe
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
    STRIPE_SECRET_KEY
    STRIPE_WEBHOOK_SECRET see billing setup guide
  3. Run locally
    pnpm dev
    Link is printed (default http://localhost:3000).

That's it – you now have auth, org switcher, billing pages and a dashboard running locally.


Tech stack in 30 seconds

Layer Package(s) What it gives you
UI Next.js 15 / App Router, shadcn/ui, Tailwind CSS SSR/ISR, React Server Components, accessible components
Auth Clerk Passwordless, social login, multi-org, JWTs
Billing Stripe, Usage metering helpers Checkout, customer portal, metered usage limits
Data Drizzle ORM + SQL (vendor-agnostic) Type-safe queries & migrations
Tooling TypeScript, ESLint, Prettier, pnpm Fast DX & code quality

Project layout (high-level)

src/
  app/              ← Next.js routes (pages & API)
  components/       ← Re-usable UI & feature components
  lib/              ← Server helpers (billing, db, utils …)
  db/               ← Drizzle schema + index
  middleware.ts     ← Auth & rate-limiting middleware
config/
  billing-plans.yml ← Declarative plan definitions
scripts/            ← One-off utility scripts (Stripe setup, code-gen …)
docs/               ← Comprehensive documentation

Common tasks

Task Command
Start dev server pnpm dev
Lint & type-check pnpm lint / pnpm typecheck
Run Drizzle migrations pnpm db:migrate
Create a DB snapshot pnpm db:snapshot
Generate billing plan types pnpm generate-plans
Set up Stripe products pnpm setup:stripe
Format code pnpm format

See package.jsonscripts for the full list.


Billing at a glance

Plans are defined declaratively in config/billing-plans.yml. The Stripe setup script (pnpm setup:stripe) reads that file and creates/updates products & prices with the correct metadata. Webhook handlers under src/app/api/webhooks/stripe/* keep the local subscription table in sync.

Complete billing documentation - Setup, configuration, and API reference • Quick start guide - Get billing running in 5 minutes • Database schema - Required tables and setup


Documentation

Topic Location
Billing System docs/billing/
API Reference docs/billing/2_billing_guard.md
Development Guidelines CLAUDE.md

Deployment

The template is designed for Vercel, but any Node 18+ platform will work. Make sure to set the same environment variables in production and point Stripe webhooks at the /api/webhooks/stripe route.

For detailed deployment instructions, see the billing setup guide.


Want to contribute?

Bug reports, suggestions and PRs are very welcome! Please follow the existing code patterns and ensure your changes pass linting and type checking.


License

Add your license of choice here.

About

A Next.js starter template with auth, payments, and boilerplate.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published