SQLite REST API: 8 Ways to Serve a SQLite Database over HTTP

Eight ways to put a REST API on a SQLite database: Datasette, PocketBase, Turso, Cloudflare D1, Faucet, sqlite-rest, ws4sqlite and Directus. We ran five of them against the same Chinook.db file and checked whether each one serves an existing file, what writes get through with default settings, and how you lock it down.

Key takeaways

  • For an existing .db file, use a tool that wraps the file. Datasette, Faucet, sqlite-rest and ws4sqlite all served Chinook unchanged in our test. Directus introspects existing tables (from its docs) but adds its own directus_* tables. PocketBase did not serve Chinook's tables and added its own tables to the file.
  • Defaults differ a lot. With default settings, sqlite-rest (3/3) and ws4sqlite (7/7) accepted every write we sent and Datasette 0.65.5 accepted none (0/6). Faucet has no anonymous access, and a key with a GET-only role accepted 0 of 9.
  • OpenAPI is rare. Of the four file-serving tools we ran (Datasette, Faucet, sqlite-rest, ws4sqlite), only Faucet served an OpenAPI document (3.1, 11 paths for Chinook). Directus and Soul (not tested) also publish API specs or docs.
  • Managed SQLite has HTTP built in. Turso Cloud and Cloudflare D1 accept SQL over HTTP with a token, but you import your data first. Turso's libSQL server (sqld) can be self-hosted with the same kind of HTTP access.
  • For AI agents: Faucet and Directus have MCP built in (Directus's is off by default), Datasette has the read-only datasette-mcp plugin, Turso runs a hosted MCP server with OAuth 2.1, and Cloudflare's API MCP server covers D1. See how to connect Claude to your database.

Eight ways to put HTTP in front of a SQLite database, and what the five we could run did when we pointed them at the same file.

How do I create a REST API for a SQLite database?

Run a server that wraps the file, or move the data to managed SQLite. For an existing .db file, use Datasette to publish it read-only. Use Faucet, the open-source database-to-REST-API and MCP server, for read/write REST, OpenAPI and MCP behind role-scoped keys. sqlite-rest gives a PostgREST-style API with JWT, and ws4sqlite runs SQL over HTTP. Directus adds an admin app and end-user auth. For a new app with users and realtime, use PocketBase. To skip running a server, Turso and Cloudflare D1 host SQLite behind an HTTP SQL endpoint.

SQLite REST API tools compared at a glance

ToolBest forExisting .db fileWrites by defaultEnd-user authAPI keys / rolesOpenAPIMCPRealtimeLicense / pricingSelf-hosted
DatasetteRead-only publishingYes (tested)No, 0/6 (tested)Via pluginsPermissions; tokens in 1.0 alphasNo (tested)datasette-mcp plugin, read-onlyNoApache-2.0, freeYes
PocketBaseNew app backendNo (tested)Own collections onlyYesSuperusers, API rulesNot foundNone foundYesMIT, freeYes
TursoServerless and edgeImport (--from-file)Yes, SQL over HTTPYour IdP via JWKSRead-only and per-table/action tokensn/aHosted (OAuth 2.1) + tursodb --mcpNot documentedMIT engine; free plan + metered monthly plansEngine and sqld yes; Cloud managed
Cloudflare D1Apps on WorkersSQL dump import onlyYes, SQL via Cloudflare APIn/aD1 Read / D1 Write API tokensn/aCloudflare API MCP serverNot documentedUsage-based; free tier; paid needs Workers PaidNo
FaucetCRUD + MCP on an existing fileYes (tested)—*; 0/9 with GET-only key (tested)NoYes, by service, table and verb3.1 (tested)Built in, HTTP + stdioNoMIT, freeYes
sqlite-restPostgREST-style APIYes (tested)Yes, 3/3 (tested)NoJWT required; table allow-listNo (tested)None foundNoMIT, freeYes
ws4sqliteSQL over HTTPYes (tested)Yes, 7/7 (tested)NoOptional, off by defaultNo (tested)None foundNoISC, freeYes
DirectusAdmin app + API with usersIntrospects; adds directus_* tablesPer role permissionsYesRoles, policies, static tokensYesBuilt in, off by defaultWebSockets, off by defaultMSCL 1.0 (source-available); free under $5M revenue and 50 staffYes

“Tested” means our harness ran it on 2026-10-16. Everything else comes from the project’s own docs or repository, checked the same day.

* Re-testing on Faucet v0.1.16.

How we evaluated

We downloaded Chinook 1.4.5 (Chinook_Sqlite.sqlite) and gave every tool and every mode its own fresh copy. The machine was an 8 vCPU Linux box with 15 GB of RAM and no Docker.

For each self-hosted tool we checked four things that matter when choosing:

  1. Does it serve the existing file? No schema changes, no import step.
  2. What writes get through with default settings? We sent INSERT (Artist), UPDATE (Artist) and DELETE (InvoiceLine) through every write path. Raw-SQL paths also got a CTE-prefixed DELETE (WITH x AS (SELECT 1) DELETE ...). We judged each write by reading the file back over a separate mode=ro SQLite connection, not by trusting the server’s reply.
  3. How do you make it read-only, and does that hold? Same writes, repeated.
  4. What does an anonymous client get, and how many rows come back? One unauthenticated request, plus SELECT * on InvoiceLine (2,240 rows).

We also timed cold start (process launch to first successful query, median of 5 runs) and the offline install step.

Hands-on: Datasette 0.65.5, PocketBase 0.40.5, Faucet (built from source at v0.1.15-4-g2327d63), sqlite-rest v0.4.1 and ws4sqlite v0.16.6. From docs only: Turso and Cloudflare D1, because they are managed services that do not serve a local file, and Directus, which needs Docker or Node and adds its own tables. We did not run a concurrent-write or throughput test, so this post makes no performance claims beyond cold start.

The tests were scripted and run on 2026-10-16. Drafting was AI-assisted, and every number was checked against the harness’s JSON output.

1. Datasette — Best for publishing and exploring an existing SQLite file read-only

Use it when: people need to browse, search and query data you own, but should not change it.

Datasette, by Simon Willison, turns one or more SQLite files into an interactive website with a JSON API behind every page. It is aimed at journalists, researchers, archivists and anyone publishing data. One command serves the file:

datasette chinook.db
curl 'http://localhost:8001/chinook/Track.json?_shape=array&_size=3'

In our test, Datasette 0.65.5 served Chinook as is. It refused all 6 write attempts with no configuration: ?sql=INSERT/UPDATE/DELETE returned 400 “Statement must be a SELECT”, and the CTE DELETE returned 400 “attempt to write a readonly database”. Install (venv plus offline pip) took 5.42 s and cold start was 0.790 s.

Strengths

  • Read-only by default, with zero config files.
  • Arbitrary read-only SQL through ?sql=, plus faceting, full-text search and a browsable UI.
  • datasette publish cloudrun (or heroku) packages the database and app into a container and deploys it.
  • A large plugin ecosystem, including the official datasette-mcp plugin. It adds a /-/mcp endpoint with three read-only tools (list_databases, get_database_schema, execute_sql) that respect Datasette’s permissions.

Things to know

  • No write API in the stable release. The /-/insert and /-/delete endpoints returned 404 on 0.65.5. A JSON write API with dstok_ API tokens exists in the 1.0 line, which is still a pre-release (1.0a41 at the time of writing).
  • Open by default. An unauthenticated GET returned 200. That is the point for public data, but private data needs Datasette’s permission settings or an auth plugin.
  • Row caps. Table JSON pages are 100 rows. ?sql= returned 1,000 of 2,240 rows with truncated: true.
  • No OpenAPI document. /-/openapi.json and /openapi.json both returned 404.
  • Requires Python (the README currently lists 3.11 or later).

Who should choose it

Anyone publishing or exploring a dataset. If the API’s job is to be read, Datasette is the most complete option here.

2. PocketBase — Best for a new app backend with users, files and realtime

Use it when: you are starting a new application and want the API, user accounts, file uploads and an admin dashboard in one binary.

PocketBase is an open-source Go backend with an embedded SQLite database, realtime subscriptions, user and file management, an admin dashboard and a REST-style API. You can run it as a standalone binary or import it as a Go framework and add your own logic.

Strengths

  • One file to download and run (unzip took 0.25 s in our test).
  • Auth collections for app users, file storage and realtime subscriptions are built in. None of the other tools we ran offer these.
  • Official JavaScript and Dart SDKs.
  • Extendable in Go, or in JavaScript through the bundled JS VM plugin.

Things to know

  • It does not serve an existing SQLite file. We copied Chinook in as pb_data/data.db. PocketBase started, wrote its own tables into the file (_collections, _migrations, users and others), and GET /api/collections/Artist/records returned 404 “Missing collection context.” Collections are backed by tables PocketBase generates itself.
  • View collections can run a SQL SELECT, and are read-only. We did not test whether they can expose Chinook’s tables.
  • The README warns that full backward compatibility is not guaranteed before v1.0.0.
  • SQLite only, and we found no official MCP server or OpenAPI generator in the repository.

Who should choose it

Teams starting a new product who want a backend, not just an API. If you already have a .db file you want to expose unchanged, choose Datasette, Faucet, sqlite-rest or ws4sqlite instead. For a wider look at backend platforms, see Faucet vs Supabase.

3. Turso — Best for managed SQLite over HTTP from serverless and edge code

Use it when: your code runs on serverless or edge runtimes that cannot open a local file.

Turso Cloud hosts SQLite-compatible databases (libSQL, and the newer Turso Database engine, a Rust rewrite of SQLite under MIT). Each database accepts SQL over HTTP at /v2/pipeline with a database auth token:

curl "https://<db>-<org>.turso.io/v2/pipeline" \
  -H "Authorization: Bearer $TURSO_TOKEN" -H "Content-Type: application/json" \
  -d '{"requests":[{"type":"execute","stmt":{"sql":"SELECT Name FROM Artist LIMIT 3"}},{"type":"close"}]}'

Strengths

  • No server to run, and HTTP access from any language.
  • Existing files can be imported: turso db create <name> --from-file ./chinook.db (up to 2 GB), or --from-dump for a .dump file.
  • Fine-grained tokens. Tokens can be read-only (turso db tokens create mydb --read-only) or scoped per table and action (-p users:data_read,data_update). Turso can also verify tokens issued by your own identity provider through JWKS.
  • MCP in two forms. A hosted MCP server at https://mcp.turso.ai/mcp uses OAuth 2.1, with read, write, delete and schema SQL as separate tools and read-only and destructive operations labeled. The open-source tursodb CLI also has a stdio MCP mode for local files (tursodb ./app.db --mcp).
  • Free plan without a credit card. Paid plans are monthly with included storage, rows read, rows written and syncs, and metered usage above them.

Things to know

  • The HTTP API is a SQL endpoint, not a REST resource API. Clients still write SQL, and there is no generated OpenAPI per table.
  • Turso Cloud does not serve your local file, so you import first. The libSQL server (sqld) is the self-hosted option; its last tagged release in the libsql repo was v0.24.32 (February 2025).
  • Your data lives in Turso’s cloud. Check usage-based pricing against your read and write volume.
  • We did not test Turso hands-on for this post.

Who should choose it

Teams that want SQLite semantics without managing a server or file, especially from Vercel, Netlify, Deno or similar runtimes.

4. Cloudflare D1 — Best for apps already on Cloudflare Workers

Use it when: your app already runs on Workers and you want an HTTP endpoint for scripts and admin tasks.

D1 is Cloudflare’s managed SQLite database. Workers query it through a binding. From outside Cloudflare, the API has a query endpoint:

curl -X POST "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/d1/database/$DB_ID/query" \
  -H "Authorization: Bearer $CF_API_TOKEN" -H "Content-Type: application/json" \
  -d '{"sql":"SELECT Name FROM Artist WHERE ArtistId = ?","params":["1"]}'

Strengths

  • Usage-based pricing on rows read, rows written and storage, with no egress charges. D1 does not bill compute while you are not querying it.
  • A free tier on Workers Free (daily row limits and 5 GB storage).
  • API tokens can be limited to D1 Read or D1 Write.
  • Cloudflare’s official API MCP server (https://mcp.cloudflare.com/mcp, OAuth or API token) covers the Cloudflare API and lists D1 among supported products. The older Workers Bindings MCP server with D1 query tools is deprecated.

Things to know

  • No raw-file import. Cloudflare’s docs say you cannot import a .sqlite3 file directly. You convert it to a SQL dump with the sqlite3 CLI and remove BEGIN TRANSACTION and COMMIT first.
  • Paid usage needs Workers Paid, which has a minimum charge of $5 per month per account. Workers that query D1 are billed separately under Workers pricing.
  • The REST query endpoint counts against Cloudflare’s global API rate limit (1,200 requests per 5 minutes per user), so it suits admin tasks and scripts rather than app traffic.
  • On Workers Free, queries fail once the daily row limits are hit, until 00:00 UTC.
  • It is a SQL endpoint with no per-table REST resources or OpenAPI. We did not test D1 hands-on.

Who should choose it

Teams already deploying on Cloudflare. Elsewhere, Turso or a self-hosted tool is simpler.

5. Faucet — Best for a read/write REST API plus MCP on an existing .db file

Use it when: apps and AI agents need CRUD on a SQLite file you already have, with API keys scoped by role.

Faucet is a single Go binary (MIT) that connects to SQLite and six other engines. Every table gets REST endpoints and appears in an OpenAPI 3.1 document, and eight MCP tools work across all tables. REST and HTTP MCP share the same role checks. This is the read-only setup we tested, plus the admin step from the SQLite tutorial:

faucet admin create --email you@example.com      # prompts for a password
faucet db add --name chinook --driver sqlite --path /abs/path/chinook.db
faucet role create --name readonly --verbs GET
faucet key create --role readonly                # prints the key once
faucet serve --host 127.0.0.1

The three data setup commands took about 0.07 s in total, and cold start to the first REST query was 0.045 s (median of 5).

Strengths

  • Writes are controlled per role. With the GET-only key, 0 of 9 writes landed over REST and HTTP MCP. Marking the service read_only refused all 9 even for an admin with raw SQL enabled, and 0 of 6 landed over stdio. See RBAC.
  • No anonymous data access. The data API, /mcp and per-service _doc spec returned 401 without credentials.
  • OpenAPI 3.1 from the live schema: 11 paths for Chinook.
  • MCP built in over Streamable HTTP at /mcp (same role rules as REST, per API key) and over stdio. See the MCP server docs.
  • Safe defaults: 25 rows per page (max 1,000), UPDATE and DELETE need a filter, and raw SQL is off.

Things to know

  • A newer project. Faucet is at v0.1.x, younger than Datasette or PocketBase.
  • API keys, not end-user accounts. Access is by API key with roles scoped by service, table and verb; there is no user sign-up or row-level policy. If app users need their own accounts, PocketBase or Directus fit better.
  • No joins or realtime. Each table is its own endpoint, and there are no live subscriptions.

Who should choose it

Developers with an existing SQLite file who want a writable REST API, OpenAPI and AI-agent access under one set of permissions.

6. sqlite-rest — Best for a minimal PostgREST-style API with JWT auth

Use it when: you want a small, PostgREST-compatible API on a few allow-listed tables.

sqlite-rest (MIT) aims to implement PostgREST’s API for SQLite: ?id=eq.1 filters, column selection, ordering, pagination, exact counts, inserts, updates, upserts and deletes. It also exposes Prometheus metrics and runs golang-migrate migrations.

echo -n "topsecret" > token.txt
sqlite-rest serve --auth-token-file token.txt \
  --security-allow-table Artist,InvoiceLine --db-dsn ./chinook.db
curl -H "Authorization: Bearer $JWT" 'http://127.0.0.1:8080/Artist?ArtistId=eq.1'

Strengths

  • Secure by construction. It refused to start without --auth-token-file or --auth-rsa-public-key. Tables are deny-by-default: /Album returned 403 until it was allow-listed, and an unauthenticated GET returned 401.
  • PostgREST-style query syntax, so existing PostgREST knowledge and client code carry over.
  • Fast cold start: 0.024 s.

Things to know

  • Writes are on for allow-listed tables. POST, PATCH and DELETE landed 3 of 3. There is no read-only switch. With a file:...?mode=ro connection string, 0 of 3 landed, returning HTTP 500 “attempt to write a readonly database”.
  • No row cap. GET /InvoiceLine returned all 2,240 rows.
  • No OpenAPI document (GET / returned 404), and we found no MCP server in the repository.
  • Slow release cadence. v0.4.1 (January 2026) came more than two years after v0.4.0 (October 2023). The project publishes no release binaries; our go install (cgo) took 82.89 s from an empty cache. A Docker image is listed in the README.
  • Not every PostgREST feature is implemented. The README lists what is supported.

Who should choose it

PostgREST users who want the same API shape on SQLite, and anyone who wants auth to be impossible to forget. If you are weighing PostgREST-style tools across databases, see PostgREST alternatives.

7. ws4sqlite — Best for sending SQL and transactions over HTTP

Use it when: the client sends SQL, not resource requests, and you want a remote data layer with almost no setup.

ws4sqlite (ISC) is a single Go binary that accepts JSON over HTTP and runs the statements inside a transaction. It can serve several databases from one process, run scheduled backups and vacuums, and restrict clients to stored statements defined on the server.

ws4sqlite --db chinook.db
curl -X POST http://localhost:12321/chinook -H 'Content-Type: application/json' \
  -d '{"transaction":[{"query":"SELECT Name FROM Artist LIMIT 3"}]}'

Strengths

  • Smallest setup we measured: untar 0.17 s, cold start 0.023 s.
  • Each request runs as one transaction, with per-statement control over whether a failure rolls everything back.
  • Read-only is one line. A companion chinook.yaml with readOnly: true stopped all 7 writes (HTTP 500 “attempt to write a readonly database (8)”).
  • “Stored statements only” mode keeps raw SQL off the wire entirely.
  • WAL mode is on by default, plus configurable CORS, client libraries for Go and the JVM, and builds for 11 OS/architecture targets.

Things to know

  • Open and writable by default. With no config, 7 of 7 writes landed, including writes sent in the query field. An unauthenticated POST returned 200, and the default bind address is 0.0.0.0. Turn on authentication before exposing it.
  • No row cap. SELECT * FROM InvoiceLine returned all 2,240 rows.
  • It is not resource-style REST: there are no per-table URLs and no OpenAPI document, and we found no MCP server in the repository.
  • No built-in HTTPS by design. The docs recommend a reverse proxy.
  • Release status: the last stable release was v0.16.6 (October 2025). The README says a ws4sql fork adding DuckDB “is back on track”, to be released once its documentation is ready.

Who should choose it

Developers who are comfortable writing SQL in the client and want transactions, backups and stored statements with almost no setup.

8. Directus — Best for an admin app plus API with end-user auth on existing SQLite

Use it when: non-developers need an admin interface over the data, and app users need accounts and permissions.

Directus connects to SQL databases, including SQLite (DB_CLIENT=sqlite3), and generates REST and GraphQL APIs plus a visual admin app called the Data Studio. Its docs say it introspects existing tables and relationships when connected to an existing database.

Strengths

  • Users, roles and access policies for app users, plus static tokens for services.
  • A built-in MCP server (v11.12 and later) that uses the connecting user’s permissions, with OAuth or a static token.
  • An OpenAPI spec at GET /server/specs/oas, and realtime over WebSockets and GraphQL subscriptions.
  • The same app works on PostgreSQL, MySQL, SQL Server, Oracle and others.

Things to know

  • It adds tables to your file. Directus creates its own directus_* system collections (users, roles, permissions, revisions and settings) in the database.
  • Source-available, not open source. Directus uses the Monospace Sustainable Core License 1.0. Organizations under $5M annual revenue and 50 employees can use it free through its Open Innovation Grant; larger ones may need a commercial license.
  • MCP and WebSockets are off by default on self-hosted installs. Composite keys and SQL views are not supported.
  • It is a Node application, heavier than the single binaries above. We did not test Directus hands-on.

Who should choose it

Teams that want a content or admin app plus an API and user accounts, and can accept Directus’s system tables in the file.

Other options we did not test

  • Soul (MIT, v0.9.2): an “automatic SQLite RESTful and realtime API server”. soul -d sqlite.db wraps an existing file with REST and WebSockets, -a turns on JWT auth, and API docs are served at /api/docs.
  • rqlite (MIT, v10.6.0): a fault-tolerant distributed database built on SQLite, with an HTTP API for queries and writes. It is a separate database, not a wrapper for your file.
  • libSQL server (sqld): Turso’s open-source server mode, with the SQLite dialect over HTTP, for self-hosting what Turso Cloud runs.

Datasette vs PocketBase

  • Your data: Datasette serves the SQLite file you already have, unchanged. PocketBase owns its schema. In our test it added its own tables to Chinook and did not expose the existing ones.
  • Writes: Datasette 0.65.5 is read-only (a write API is in the 1.0 alphas). PocketBase is built for writes from app users.
  • Users: PocketBase has auth collections for app users. Datasette has a permission system and auth plugins aimed at publishers and teams.

Choose Datasette to publish or explore data. Choose PocketBase to build an app.

sqlite-rest vs ws4sqlite

Both are small Go binaries that serve an existing file and accept writes. The difference is the API shape and the defaults.

  • API shape: sqlite-rest gives resource URLs (/Artist?ArtistId=eq.1) in PostgREST style. ws4sqlite takes SQL in a JSON body and runs it in a transaction.
  • Defaults: sqlite-rest will not start without JWT config and exposes no tables until you allow-list them. ws4sqlite starts open, unauthenticated and writable on 0.0.0.0.
  • Read-only: ws4sqlite has readOnly: true. sqlite-rest relies on a mode=ro connection string.
  • Operations: ws4sqlite adds scheduled backups and stored statements. sqlite-rest adds Prometheus metrics and migrations.

If you want resources and safe defaults, use sqlite-rest. If you want SQL transactions over HTTP, use ws4sqlite. Neither generates OpenAPI or exposes MCP; the table above shows which tools do.

Turso vs Cloudflare D1

Both are managed, SQLite-based and reachable over HTTP with a token. Turso is platform-neutral: any runtime can call /v2/pipeline, it imports an existing .db file directly, and its tokens can be scoped per table and action. D1 is built around Workers bindings: its REST endpoint goes through Cloudflare’s rate-limited API, and existing files must be converted to a SQL dump first. Both charge by rows read and written plus storage, so model your traffic before choosing. If you already run on Workers, use D1. Otherwise, Turso is easier to adopt.

Bottom line

For a .db file you already have, start with what the API needs to do. Use Datasette for read-only publishing, Faucet when you need writes, role-scoped keys, OpenAPI and MCP in one binary, sqlite-rest for a strict PostgREST-style API, and ws4sqlite for SQL over HTTP. Use PocketBase for a new app, Directus for an admin app with users, and Turso or D1 when you want someone else to run the database.

Whichever you pick, check the defaults: two of the five tools we ran accepted every write we sent and returned every row. If agents only need to read, follow the guide to giving an AI agent read-only database access, and read why MCP tool annotations matter for database safety. For the same workflow on PostgreSQL, MySQL or SQL Server, see how to turn any database into a REST API and MCP server and the PostgreSQL REST API guide.

To try Faucet on your own SQLite file, follow the getting started guide and then the SQLite tutorial.

Frequently asked questions

How do I expose an existing SQLite file as a REST API without writing code?

Point a file-wrapping server at it. datasette chinook.db gives a read-only JSON API. With Faucet, run faucet admin create, then faucet db add --name chinook --driver sqlite --path /abs/path/chinook.db and faucet serve for CRUD with API keys, OpenAPI 3.1 and MCP. Use an absolute path, because a wrong path creates an empty database. sqlite-rest and ws4sqlite are smaller binaries that also accept writes.

What is the difference between Datasette and PocketBase?

Datasette wraps a SQLite file you already have and publishes it as a browsable website and read-only JSON API. It suits data publishing and exploration. PocketBase is an application backend: it creates and manages its own SQLite schema through collections and adds users, file storage, an admin dashboard and realtime subscriptions. Pick Datasette for existing data and PocketBase for a new app.

Is there a PostgREST equivalent for SQLite?

Yes. sqlite-rest implements a subset of PostgREST's API for SQLite, including ?column=eq.value filters, column selection, ordering, pagination and writes, with JWT auth and a table allow-list. Its README lists which PostgREST features are supported. For PostgREST-style tools on other databases, see our PostgREST alternatives comparison.

How does SQLite handle concurrent writes behind an API?

SQLite allows one writer at a time. In WAL mode, readers and the writer run concurrently, but a second writer waits on the lock and fails with SQLITE_BUSY if its busy timeout runs out. An API server in front of the file does not change this. We did not load-test concurrent writes for this post, so check how each tool sets WAL and busy timeouts for write-heavy use.

Can SQLite be used behind a REST API in production?

Yes, for workloads that fit one machine and a single writer at a time. Write-heavy APIs with many concurrent clients need care. Keep the API server on the same host as the file, put TLS, rate limiting and CORS rules in a reverse proxy, and back up the file. If you need many servers or edge locations, look at Turso or Cloudflare D1.

Does Turso provide a SQLite HTTP API?

Yes. Every Turso Cloud database accepts SQL over HTTP at https://<db>-<org>.turso.io/v2/pipeline with a database auth token as a Bearer header. You send JSON execute requests with SQL and arguments. It is a SQL endpoint, not a resource-style REST API. Tokens can be read-only or scoped per table and action, and existing files import with turso db create --from-file.

Can I query Cloudflare D1 over REST from outside a Worker?

Yes. Cloudflare's API has POST /accounts/{account_id}/d1/database/{database_id}/query, authenticated with an API token that has D1 Read or D1 Write permission. Requests count against Cloudflare's global API rate limit (1,200 requests per 5 minutes per user), so the endpoint suits scripts and admin tasks. Applications usually query D1 through a Workers binding.

Which SQLite REST API tools are read-only by default?

Only Datasette 0.65.5 was read-only out of the box in our test (0 of 6 writes). sqlite-rest and ws4sqlite accepted every write; ws4sqlite has a one-line readOnly: true and sqlite-rest needs a mode=ro connection string. Faucet requires credentials for every data request, and a GET-only role or a read_only service blocked every write. Turso offers --read-only tokens.

Sources

Last reviewed