---
title: "Skip the API, Ship Your Database"
description: "Instead of designing an API for internal services, Fly.io ships them a read-only SQLite replica via LiteFS, letting consumers query and join data with plain SQL."
url: "https://swe.quest/articles/skip-the-api-ship-your-database-848af5fd83020408"
canonical: "https://fly.io/blog/skip-the-api/"
source: "Fly.io"
published: "2023-09-13"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 5
tags: ["sqlite","api-design","replication","multi-tenancy","system-design"]
---

# Skip the API, Ship Your Database

A post on [Fly.io](https://swe.quest/sources/flyio.md), published 2023-09-13, 5 min read, Opinion. Original: [https://fly.io/blog/skip-the-api/](https://fly.io/blog/skip-the-api/)

## Summary

Instead of designing an API for internal services, Fly.io ships them a read-only SQLite replica via LiteFS, letting consumers query and join data with plain SQL. The pattern emerged from running Corrosion, Fly's gossip-based state store, on LiteFS, where a one-way replica avoided chatty gossip and needed only a small static-lease config. It moves query compute onto each client, which removes rate limiting and multi-tenant resource contention. The tradeoffs are that writes still need an API, the schema becomes a looser contract (mitigated with backward-compatible changes and views), and access control requires per-tenant databases.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)

## Prerequisites

- SQLite basics ([easy posts on SQLite](https://swe.quest/tags/sqlite.md?difficulty=easy))
- database replication ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- API design ([easy posts on API design](https://swe.quest/tags/api-design.md?difficulty=easy))

## Keywords

LiteFS, SQLite, Corrosion, Fly.io, GraphQL, LiteFS Cloud

## Related posts

- [The Many-Database Architecture: Should You Give Every Tenant Their Own Database?](https://swe.quest/articles/the-many-database-architecture-should-you-give-every-tenant-their-own-database-8b8e22af8a8401bd.md): Turso · 2026-10-14 · Medium · 8 min read · Multi-tenancy, SQLite, System design, Databases, Privacy
  Shared schema with row-level security, schema per tenant, and database per tenant trade off isolation strength against operational cost.
- [How to Deploy Schema Changes to a Million Databases](https://swe.quest/articles/how-to-deploy-schema-changes-to-a-million-databases-356cdf3f01c11d17.md): Turso · 2025-06-02 · Medium · 4 min read · Schema migrations, Multi-tenancy, SQLite, Local-first & sync, Go
  Database-per-tenant schema migrations can scale to millions of databases by inverting control: a hosted schema registry stores a versioned catalog of SQL scripts, and each client periodically reports its schema version, pulls the missing migrations and applies them locally.
- [Bringing SQLite to Vercel Functions with Turso](https://swe.quest/articles/bringing-sqlite-to-vercel-functions-with-turso-afed2a49c7b44020.md): Turso · 2026-02-19 · Medium · 8 min read · SQLite, Serverless, Replication, Multi-tenancy, JavaScript
  Turso's partial sync replicates a subset of SQLite database pages into Vercel Functions so reads run in-process with no network round-trip, while writes go to the remote Turso database for durability and consistency.
- [Multi-tenancy at Scale: How to Give Every User Their Own Database](https://swe.quest/articles/multi-tenancy-at-scale-how-to-give-every-user-their-own-database-68099102015dea58.md): Turso · 2026-08-17 · Medium · 7 min read · Multi-tenancy, SQLite, System design, Cost optimization, TypeScript
  The standard warning against database-per-tenant assumes each database is a server process like PostgreSQL or MySQL, with its own memory, connection pool and backup schedule.
- [Litestream Revamped: SQLite Replication](https://swe.quest/articles/litestream-revamped-sqlite-replication-0708888533a47bfa.md): Fly.io · 2025-05-20 · Medium · 6 min read · SQLite, Replication, Storage engines, Storage systems
  Litestream is being reworked around ideas from LiteFS. It replaces the raw-WAL "shadow WAL" with transaction-aware LTX files, sorted page changesets that can be compacted LSM-style, so point-in-time restores no longer replay every intermediate page write.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
