# Ship your SaaS to the edge.

A modern SaaS template built with Next.js 16 and Cloudflare Workers, designed for scalability and performance.

Source: https://nextjs-saas-template.lubomirgeorgiev.com
Index: https://nextjs-saas-template.lubomirgeorgiev.com/llms.txt

A complete, production-ready starter for building SaaS apps on Cloudflare Workers. Auth, database, billing, email, and admin tooling are already wired up — clone it and deploy globally in minutes.

[Star on GitHub](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template) [Try the live demo](https://nextjs-saas-template.lubomirgeorgiev.com/sign-in)

\~/your-saas — deploy

$

// the whole stack, already assembled

### Cloudflare platform

- Workers
- D1
- KV
- R2
- Images
- Queues
- Turnstile

### App framework

- Next.js via Vinext
- React Server Components
- Drizzle ORM
- Lucia Auth
- Tailwind CSS
- Stripe

// what's in the box

## Skip the boilerplate. Build the product.

Every undifferentiated part of a SaaS is already here and tested. Open the repo and start writing the code that only your product needs.

auth

### Authentication, solved

Email and password sign-in, sign-up, password reset, and sessions on Lucia Auth — plus passkeys and Google OAuth.

data

### Database & email

Drizzle ORM over Cloudflare D1, KV-backed sessions, and transactional email sent straight from the Worker.

edge

### Deployed to the edge

Ship to Cloudflare Workers and serve from 330+ cities with zero cold starts. One command pushes to production.

runtime

### Modern runtime

Next.js App Router and React Server Components running on Vinext and Vite for an instant dev loop.

billing

### Billing built in

Per-team Stripe subscriptions with an embedded Payment Element are wired up, so you can charge customers without starting from scratch.

ui

### A real design system

Tailwind CSS with Shadcn and Base UI components, dark mode, and responsive layouts ready to extend.

teams

### Teams & admin

Multi-tenant teams, role-based access, and an admin panel for managing users and content out of the box.

dx

### Developer experience

TypeScript end to end, Oxlint, a CMS for blog and docs, and GitHub Actions deployment you don't have to write.

## One command to clone. Yours to ship.

Free and open source. No license fees, no attribution required. Fork it, rename it, and make it your own.

$ `git clone https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template.git`

[Star on GitHub](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template) [Explore the demo](https://nextjs-saas-template.lubomirgeorgiev.com/sign-in)

// faq

## Questions, answered

Still curious? The README covers everything else, and issues are always open.

### Is this template really free?

Yes, this template is completely free and [open source](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template)! You can use it for both personal and commercial projects without any licensing fees. You can fork, copy, modify, and distribute it as you see fit without any restrictions and attribution.

### What features are included?

The template includes a comprehensive set of features:

- Authentication with email/password and forgot password flow
- Database integration with Drizzle ORM and Cloudflare D1
- Email service powered by Cloudflare Email Service
- Modern UI components from Shadcn UI and Tailwind CSS
- Form validations and error handling
- Dark mode support
- Responsive design
- TypeScript throughout the codebase
- Automated deployments with GitHub Actions
- Captcha integration with Turnstile
- SEO optimization with Next.js
- And countless other features...

### What's the tech stack?

The template uses modern and reliable technologies:

- Next.js App Router with React Server Components through Vinext and Vite
- TypeScript for type safety
- Tailwind CSS and Shadcn UI for styling
- DrizzleORM with Cloudflare D1 for database
- Lucia Auth for authentication
- Cloudflare Workers for serverless deployment
- Cloudflare KV for session storage
- Cloudflare Email Service for transactional email

### How do I deploy my application?

Deployment is automated with GitHub Actions. You'll need to:

1. Create Cloudflare D1 and KV namespaces
2. Onboard your sending domain in Cloudflare Email Service
3. Enable Cloudflare Images for image optimization
4. Configure Turnstile for captcha
5. Add your Cloudflare API token to GitHub secrets
6. Push to the main branch

The deployment process is fully documented in the [GitHub repository](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template).

### What do I need to get started?

You'll need a Cloudflare account (free tier is fine), Node.js installed locally, and basic knowledge of React and TypeScript. The template includes detailed documentation to guide you through the setup.

You can also check out the [documentation](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template/blob/main/README.md) for more information.

### What are the upcoming features?

We have an exciting roadmap ahead! Planned features include:

- Multi-language support (i18n)
- Billing and payment processing
- Admin dashboard
- Email verification on sign up
- Notifications system
- Webhooks support
- Team collaboration features
- Real-time updates
- Analytics dashboard

### How are email templates handled?

Transactional email templates are rendered by the app and sent through Cloudflare Email Service from the Worker.

### How do I customize the template?

Before deploying to production, you should:

- Update project details in `src/constants.ts`
- Modify the footer in `src/components/footer.tsx`
- Optionally update the color palette in `src/app/globals.css`

### How can I contribute?

Contributions are welcome! Feel free to open issues, submit pull requests, or help improve the documentation on [GitHub](https://github.com/LubomirGeorgiev/cloudflare-workers-nextjs-saas-template). The project follows standard open source contribution guidelines.
