resta

Self-hosted SQL databases, one per user, tenant or agent.

Resta is an open-source server you run yourself. Your backend creates a database in one API call, your app queries it with the Turso client libraries, and idle databases cost only disk.

  • MIT licensed
  • 1 Docker Compose file
  • SQLite dialect and file format
From your backend
# create a database for a new customer
curl -X POST https://db.example.com/v1/databases \
  -H "Authorization: Bearer $RESTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "acme"}'
From your app
import { connect } from '@tursodatabase/serverless';

const db = connect({ url, authToken });
await db.all('SELECT * FROM invoices');

Why one database per tenant

Split data by the boundary it already has. Each database is its own SQLite-format file.

Isolation without filters
A query can only see one customer’s data, because that is all the database holds. No WHERE tenant_id = ? to forget.
Lifecycle per customer
Back up, restore, export or delete one customer at a time. A restore never rolls back anyone else.
Writes that don’t queue
Each database has its own writer, so a busy tenant doesn’t block the rest.

How it runs

Five containers behind one domain. Your data stays in Docker volumes on your server.

  1. API

    POST /v1/databases creates a database. It costs a directory on disk until first written.

  2. Token

    Mint a token for one database: read-only or read/write, expiring in minutes or days.

  3. Query

    Apps send SQL to /db/<id>. It opens on first use and closes after 5 minutes idle.

  4. Backup

    Changed databases are snapshotted hourly to a volume or an S3-compatible bucket.

Architecture in detail

Install

One Docker Compose file. On Coolify, set a domain and deploy; anywhere else, fill in .env and run docker compose up -d.

Coming soon

The repository is being prepared for its first public release. The install command will be here. Until then, the Coolify and Docker guides describe exactly what it will be.

Defaults
Backupshourly, 72 kept
Database size limit1 GiB
Open at once10,000
Statement timeout5 seconds
Longest token30 days

Where it fits

Resta is for data that splits into many independent databases, on a server you control.

RestaSQLite in your appOne shared Postgres
Where it runsYour server, DockerInside your app processYour server or a cloud
Reached overHTTPS with tokensLocal filePostgres protocol
Unit of isolationA database per tenantA fileRows, schemas or policies
Create a tenantOne API callCreate a fileInsert rows or a schema
Restore one tenantBuilt inCopy a fileManual
Cross-tenant queriesNoNoYes

Questions

What is Resta?

Resta is an open-source, self-hosted server that runs many small SQL databases, one per user, tenant, agent or task. You create databases through an HTTP API and query them with the Turso client libraries.

Is Resta free?

Yes. Resta is MIT-licensed. You pay only for the server you run it on; there is no hosted Resta service.

How is it different from Turso?

Resta uses the open-source Turso engine and speaks the same HTTP protocol as Turso’s serverless driver, but you host it yourself. Resta is not affiliated with Turso.

Does it run on Coolify?

Yes. Resta ships one Docker Compose file that uses Coolify’s generated domain and password variables. It also runs with plain docker compose on any server.

Is it production-ready?

Not yet. Resta has not had its first public release, and the Turso engine is pre-1.0. Keep backups off the server.

All questions