on this page

GlossaryWhat is SQLite at the edge?

What is SQLite at the edge?

SQLite at the edge means giving serverless and edge functions a SQLite database to use, instead of a separate database server they connect to over a pool of connections. The function sends SQL and gets rows back. The database behind it is SQLite, the small, file-based SQL engine that runs inside phones, browsers and countless applications.


How it works

SQLite was built to be embedded: the whole database is one file, and the engine is a library rather than a server. That suits serverless well. There's no connection limit to exhaust when hundreds of short-lived functions start at once, no server to size, and creating a new database is as cheap as creating a file, so one database per app, per customer or per test run is practical.

Functions don't have a disk that lasts, though, so the platform keeps the database file for them and exposes it through an API. Designs differ in where the file lives and how copies are kept. Some keep one primary copy and send every query to it. Some add read replicas near users, which makes reads fast and leaves writes going to the primary, with replicas a moment behind. Before choosing one, check where writes go and how stale a read is allowed to be.


SQLite on Tissue Cloud

Tissue Cloud's database service is c3. Each database is a full SQLite database with ordinary tables, indexes, transactions and SQL. A Cell reaches it through a c3 binding in ribo.toml, with no connection string or credentials in the code, and talks to it through a SQL API with exec, batch, prepare and bind methods: env.DB.prepare(sql).bind(...).all(). batch() runs a list of statements as one transaction. You create a database with ribo db create <name> and can query it from a terminal with ribo db exec. The database lives on Tissue's servers, not inside the Cell, so it persists across deploys and every edge running the Cell sees the same data.

c3 overview covers schemas, transactions and migrations, and c3 limitations lists what the API refuses.