Next.jsReactSaaSStarter

litesaas — Next.js SaaS Template

By locionic

LiteSaaS is a SaaS starter template built on Next.js 15 and SQLite, using Drizzle ORM, self-hosted session authentication, and Litestream S3 backup, under the MIT license.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-01View source

What stands out

A quick read of the recorded project description.

01

SaaS starter template built with Next.js 15 App Router and Server Components

02

SQLite + Drizzle ORM, providing type-safe queries and a db:push migration script

03

Preset production PRAGMAs including WAL, page_size, synchronous, busy_timeout, and foreign_keys

04

Self-hosted session authentication using crypto.scrypt for password hashing and HttpOnly cookies

05

Integrates Litestream to continuously replicate WAL frames to Cloudflare R2 or AWS S3

06

Includes code for Stripe and LemonSqueezy checkout sessions and webhook handling

Template Details

LiteSaaS is a SaaS starter template aimed at indie developers. Its core idea is to replace managed PostgreSQL with embedded SQLite and third-party authentication services with self-hosted session cookies, thereby reducing external dependencies for database and authentication. The template is built on Next.js 15's App Router and Server Components, uses Drizzle ORM for the data layer, and provides a db:push script to sync the schema. Authentication uses Node.js crypto.scrypt for password hashing, paired with HttpOnly cookies to store sessions. The database runs in WAL mode with preset PRAGMA parameters such as page_size, synchronous, busy_timeout, and foreign_keys. For backup, it integrates Litestream to continuously replicate WAL frames to Cloudflare R2 or AWS S3; on container startup, if an existing backup is detected, the database is restored first. The template also includes code for creating checkout sessions and handling webhooks for Stripe and LemonSqueezy, as well as a dark interface built with Tailwind CSS.

Usage limitations: SQLite uses a single-writer model, so write concurrency is limited to one active writer; busy_timeout only retries rather than increasing write throughput. Therefore, this template is better suited for read-heavy, write-light scenarios or small-to-medium write volumes. Litestream backup depends on external object storage, so you need to prepare R2 or S3 credentials yourself. The login credentials provided on the demo site are for evaluation only and should not be reused in production. The performance comparison data listed in the README comes from the author's self-reported benchmarks; no reproducible testing method is provided in the template materials, so you should validate against your own workload before use.

Next.jsSaaSStarter Kit

Is it right for your project?

Use Cases

  • SaaS projects looking to reduce reliance on managed databases and third-party authentication services
  • Small web applications deployed on a single VPS or in a Docker Compose environment
  • Scenarios requiring continuous backup of SQLite databases to S3-compatible object storage
  • Rapidly building an MVP with login, subscription checkout, and a dark interface

Suitable For

  • Indie developers familiar with Next.js and TypeScript
  • Projects that accept SQLite's single-writer model and do not require high write concurrency
  • Teams willing to maintain their own VPS, Docker, and object storage backups
  • Users who need an MIT-licensed starter template that can be freely modified and used commercially

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    After cloning the repository, run npm install and copy .env.example to .env to fill in configuration

  2. 2

    Run npm run db:push to initialize the SQLite database, then run npm run dev to start the development server

  3. 3

    For production deployment, use docker compose up -d or configure a Node runtime yourself

  4. 4

    To enable Litestream backup, set LITESTREAM_BUCKET, LITESTREAM_ENDPOINT, LITESTREAM_ACCESS_KEY_ID, and LITESTREAM_SECRET_ACCESS_KEY in .env

  5. 5

    The demo credentials [email protected] / password123 are for evaluation only; change or remove them before deployment

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in the public repository; the free scope applies to that version's code and does not mean external services or third-party assets are free.

Must comply with when using

  • You may use, modify, commercially use, and distribute the code of this version for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Authentication uses self-hosted session cookies and crypto.scrypt hashing, does not rely on third-party authentication services such as Clerk/Auth0, and requires no payment for them.
  • Enabling Litestream backup requires you to provide Cloudflare R2 or AWS S3 credentials (bucket, endpoint, access key, secret key), which is an external service dependency.
  • Stripe and LemonSqueezy checkout and webhooks require you to register accounts with the respective payment services and configure keys, which may incur third-party fees.
  • Demo site credentials are for evaluation only; change or remove them before production deployment and do not reuse them.
  • SQLite uses a single-writer model, so write concurrency is limited to one active writer; busy_timeout only automatically retries rather than increasing write throughput, making it suitable for read-heavy, write-light scenarios.
  • Performance comparison data comes from the author's self-reported benchmarks without a reproducible method; validate against your own workload before use.
  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses; do not judge solely based on the code's MIT license.
  • External services such as domain, hosting, database, payment, or AI may incur additional charges.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

Self-Hosted Session Cookies (crypto.scrypt) - **$0/mo**

Original README

LITESTREAM_BUCKET=my-app-db-backup

Original README

Stripe & LemonSqueezy Ready

Original README

Instant login: `[email protected]` / `password123`

Original README

1 Active Writer (busy_timeout = 5000ms auto-retries)

Original README

Benchmarked on a $5/mo AWS Lightsail instance (2 vCPU, 2GB RAM):

Original README
https://github.com/locionic/litesaas/blob/main/LICENSEhttps://github.com/locionic/litesaas/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-01. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 85 / 100
Technologies
Next.js · React
Website type
SaaS · Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-09-24
Screenshot last checked
2026-10-01

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Automatically checked against source and license rules; no manual editorial review.

Inspect the recorded source material

SHA-256: a73a09e14bbd7820fdae339a1318b6d5b17f82c0884bb84eaf4ada4a101769c5

2026-10-01T00:41:27.345Z

Source file / repository
# 🚀 LiteSaaS

> **The 100% Free, Zero-Cost Production Next.js 15 + SQLite SaaS Starter Kit.**  
> *Stop burning $25/mo on managed PostgreSQL instances for your side projects. Ship production apps with microsecond latencies and $0 database bills.*

[![Next.js 15](https://img.shields.io/badge/Next.js-15.1-black?style=flat&logo=next.js)](https://nextjs.org)
[![Live Demo](https://img.shields.io/badge/Live_Demo-Online-10b981?style=flat&logo=railway)](https://litesaas-production.up.railway.app)
[![SQLite WAL](https://img.shields.io/badge/SQLite-WAL_Mode-003B57?style=flat&logo=sqlite)](https://locionic.com/en/blog/sqlite-wal-mode-production-concurrency)
[![Drizzle ORM](https://img.shields.io/badge/Drizzle_ORM-0.38-C5F74F?style=flat)](https://orm.drizzle.team)
[![Tailwind CSS](https://img.shields.io/badge/Tailwind-3.4-38B2AC?style=flat&logo=tailwind-css)](https://tailwindcss.com)
[![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](LICENSE)

👉 **Live Interactive Demo:** [https://litesaas-production.up.railway.app](https://litesaas-production.up.railway.app) *(Instant login: `[email protected]` / `password123`)*

---

## ⚡ The Problem: "SaaS Bill Creep"

Every indie hacker knows the story: You build 3 or 4 side project MVPs. Even before getting your first paying customer, you are bleeding **$840+/year** on idle database hosting:

| Service | Traditional SaaS Boilerplate | LiteSaaS |
| :--- | :--- | :--- |
| **Database** | Managed PostgreSQL (Supabase/Neon) - **$25/mo** | Embedded SQLite with WAL Mode - **$0/mo** |
| **Authentication** | Clerk / Auth0 - **$25/mo** | Self-Hosted Session Cookies (crypto.scrypt) - **$0/mo** |
| **Database Backups** | Paid add-on snapshot storage | Litestream S3 / Cloudflare R2 Streaming - **$0/mo** |
| **Compute** | Serverless cold starts & overages | $4/mo VPS (Hetzner / Lightsail / Coolify) |
| **Annual Cost (3 MVPs)** | **$2,520 / year** | **$48 / year** |

LiteSaaS gives you the **exact same developer experience and safety** as a heavy Postgres setup, but runs on a single $4 VPS with zero database bills.

---

## 🏗️ Architecture: Why SQLite in Production Works

Most developers believe SQLite cannot handle production web traffic. That reputation comes from SQLite's **year-2000 legacy defaults**, not the engine itself. 

When tuned with production PRAGMAs, SQLite delivers **5,000+ req/sec concurrency** with **microsecond in-memory reads**:

```
[ Client Request ]
       │
       ▼
[ Next.js 15 App Router / Server Actions ]
       │
       ▼
[ SQLite Engine in WAL Mode ] ── (0.02ms in-memory C read, zero network lag)
       │
       ├─► 50 Concurrent Readers (Non-blocking)
       ├─► 1 Active Writer (busy_timeout = 5000ms auto-retries)
       │
       ▼
[ Litestream Daemon ] ────────── (Asynchronous physical WAL streaming)
       │
       ▼
[ Cloudflare R2 / AWS S3 ] ───── (Disaster recovery with < 1s RPO)
```

Read our complete research paper on SQLite concurrency mechanics:  
👉 **[Running SQLite in Production with WAL Mode & 1-Writer Pools (Locionic)](https://locionic.com/en/blog/sqlite-wal-mode-production-concurrency)**

---

## 📦 What's Inside

- **Next.js 15 (App Router & React 19)**: Built with modern Server Components and Server Actions.
- **SQLite + Drizzle ORM**: Fully type-safe relational queries with automatic schema migrations (`npm run db:push`).
- **Production PRAGMAs Pre-Wired**:
  - `PRAGMA page_size = 4096;` (aligned with NVMe block clusters)
  - `PRAGMA journal_mode = WAL;` (readers never block writers, writers never block readers)
  - `PRAGMA synchronous = NORMAL;` (crash-safe ACID without filesystem fsync stall)
  - `PRAGMA busy_timeout = 5000;` (eliminates `SQLITE_BUSY` errors during write bursts)
  - `PRAGMA foreign_keys = ON;` (enforces relational integrity)
- **Self-Hosted Session Auth**: Secure password hashing with Node.js `crypto.scrypt` and HttpOnly cookies. Zero third-party fees.
- **Stripe & LemonSqueezy Ready**: Checkout session creation and webhook handling pre-configured.
- **Streaming S3 Disaster Recovery**: Bundled with [Litestream](https://litestream.io) to continuously replicate WAL frames to Cloudflare R2 or S3.
- **Modern Linear-Style Dark Mode**: Crafted with Tailwind CSS and Radix-inspired aesthetics.

---

## 🚀 Quick Start (Under 60 Seconds)

### 1. Clone & Install

```bash
git clone https://github.com/locionic/litesaas.git
cd litesaas
npm install
```

### 2. Configure Environment

```bash
cp .env.example .env
```

### 3. Initialize Database & Run

```bash
npm run db:push
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) in your browser. 

> **Instant Demo Credentials:**  
> Email: `[email protected]`  
> Password: `password123`

---

## 🐳 Production Deployment

### Option A: Docker Compose (Coolify / Dokku / VPS)

```bash
docker compose up -d
```

### Option B: Deploying with Litestream S3 Backup

Set your Cloudflare R2 or AWS S3 credentials in `.env`:

```env
LITESTREAM_BUCKET=my-app-db-backup
LITESTREAM_ENDPOINT=https://<account_id>.r2.cloudflarestorage.com
LITESTREAM_ACCESS_KEY_ID=xxx
LITESTREAM_SECRET_ACCESS_KEY=yyy
```

When the Docker container starts, Litestream automatically checks S3:
1. If an existing backup exists, it **restores your database in 2 seconds**.
2. As Next.js writes new transactions, Litestream **streams WAL frames continuously** to your bucket.

---

## 📊 Benchmark: SQLite vs Network PostgreSQL

Benchmarked on a $5/mo AWS Lightsail instance (2 vCPU, 2GB RAM):

| Metric | Managed PostgreSQL (over network) | LiteSaaS (Embedded SQLite) |
| :--- | :--- | :--- |
| **Single Row Read Latency** | 12ms – 24ms (network roundtrip) | **0.02ms – 0.05ms** (500x faster) |
| **Complex Relational Join** | 25ms – 45ms | **0.15ms** |
| **Max Concurrent Readers** | Pool limited (usually 20–50) | **Unlimited** (WAL concurrent readers) |
| **Memory Footprint** | ~350MB – 600MB daemon RAM | **~15MB RAM** |
| **Maintenance Burden** | Connection pools, SSL certs, users | **Zero ops (single file on disk)** |

---

## 🛠️ Tech Stack & Credits

- Framework: [Next.js](https://nextjs.org) by Vercel
- ORM: [Drizzle ORM](https://orm.drizzle.team)
- Database: [SQLite](https://www.sqlite.org) / [better-sqlite3](https://github.com/WiseLibs/better-sqlite3)
- Replication: [Litestream](https://litestream.io) by Ben Johnson
- Styling: [Tailwind CSS](https://tailwindcss.com) & [Lucide Icons](https://lucide.dev)

---

## 👨‍💻 Author & Attribution

Developed and maintained by **[Loc Truong](https://locionic.com)** ([@locionic](https://github.com/locionic)).

For interactive SQLite tuning, check out our companion tool:  
👉 **[SQLite Production PRAGMA Configurator](https://locionic.com/en/tools/sqlite-configurator)**

---

## 📄 License

MIT License — Feel free to use this template for personal, open-source, or commercial SaaS projects!
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.