# Supabase or SQLite with Litebackup for my app?

Supabase is hosted Postgres with auth and APIs around it, while SQLite with Litebackup keeps the database inside your app.

- [Install Litebackup](https://litebackup.com/install)
- [See pricing](https://litebackup.com/pricing)

## Why SQLite with Litebackup

- **Queries in your process**. No network or HTTP between your code and your data, so every query runs at local speed.
- **No connection limit**. A SQLite file has no server to connect to, so there is no pooler and no limit to buy.
- **Backups you own**. Restore any version you keep from your own server or bucket, into a new file.

## One page, a hundred small queries

A web page stacks many small queries, and each network round trip adds up before the database does any work.

- **About 1 ms** 100 SQLite queries in your process, at about 10 µs each
- **About 100 ms** 100 queries across the network, at a 1 ms round trip each inside one region
- **About 100×** Slower over the network, and more across regions

## Every query stays in your process

SQLite runs inside your app, so a query is a function call instead of a trip across the network.

- **No round trip**. A local query takes microseconds. A query across the network pays a round trip first, every time.
- **Many small queries stay fast**. Code that runs a hundred small queries to build a page stays fast and simple, as SQLite's authors explain.

- [Many small queries in SQLite](https://www.sqlite.org/np1queryprob.html)

## Simpler to run, cheaper to keep idle

A SQLite file has no server, so there is nothing to pool, size, or pay for while it sits idle.

- **No connection limit**. Supabase puts a pooler and a plan limit in front of Postgres, and SQLite needs neither.
- **Backups you own**. Every version your retention keeps sits in your bucket, and you restore any of them into a new file.

## A database per tenant

Give every customer or agent its own SQLite file, and Litebackup backs up thousands per machine.

- **Growth stays contained**. A tenant that grows or runs hot touches only its own file.
- **Idle costs nothing**. An idle tenant is a closed file, with no compute to wake up.
- **Migrate one tenant first**. Run a schema change on one tenant, and restore its file if it goes wrong.

- [One database per tenant](https://litebackup.com/sqlite-database-for-every-tenant-or-agent)

## What stays the same

Your app keeps using SQLite exactly as it does today.

- **Official SQLite**. The SQLite from sqlite.org and the driver you already use, with no extension or fork.
- **Plain files**. Every replica and restore is an ordinary SQLite file, checked with SQLite's quick integrity check.
- **WAL or rollback journal**. Litebackup backs up both modes and never changes yours, so a rollback-journal database stays one file that also works on network file systems.

## The trade-offs

### What if a machine dies before it syncs?

It loses its last few seconds of writes, because commits never wait for the network. When a write must be safe first, wait for your server or bucket before you answer.

### Can many writers share one database?

SQLite runs one write transaction at a time per file. With a database per tenant, that means one writer per tenant, which is rarely the limit.

### Do I run a server?

Yes, one small service on a Linux VM, installed with one command. It keeps recent versions on its disk and archives them to your own bucket.

### When is Supabase the better choice?

When you want auth, storage, realtime, and an API from one vendor, or when browsers and mobile apps talk to the database directly. SQLite lists its own limits at sqlite.org/whentouse.html.

## At a glance

| | Supabase | SQLite with Litebackup |
|---|---|---|
| Engine | Postgres, with auth, storage, realtime, and APIs around it | Official SQLite from sqlite.org |
| Each query | A network round trip to Supabase, or HTTP through its API | A function call in your process |
| Connections | A pooler and a connection limit per plan | No server to connect to |
| Tenants | Rows, schemas, and row-level security in one database | One SQLite file per tenant, if you want |
| Where data lives | Supabase's hosted service | Your disk, your server within seconds, and your bucket, encrypted with your key |
| Backups and restore | According to your plan and add-ons | Any version or time you keep, into a new file, checked before it finishes |
| Price | Free and paid plans | See [pricing](/pricing) |

## Install

Install your Litebackup server and back up a first database in minutes. Start at [install](/install), or see [pricing](/pricing).
