What libSQL Does
- SQLite compatible — full SQLite API and file format
- Server mode — HTTP and WebSocket access (sqld)
- Embedded replicas — local SQLite file synced from remote
- Vector search — F32_BLOB type + vector distance functions
- ALTER TABLE — DROP COLUMN and other extensions
- Encryption — at-rest encryption
- Multi-tenancy — schema-based namespace isolation
- Edge deployment — replicas at edge locations
- TypeScript/Rust/Go/Python clients — official SDKs
- Turso managed — global edge DB service
Architecture
Fork of SQLite C codebase with extensions. sqld (server daemon) wraps libSQL and serves HTTP/WebSocket/gRPC. Embedded replicas sync WAL frames from primary to local SQLite file on the client. Turso infrastructure distributes replicas globally via Fly.io.
Self-Hosting
# Run sqld server
docker run -d --name libsql -p 8080:8080 \
-v libsql-data:/var/lib/sqld \
ghcr.io/tursodatabase/libsql-server:latest
# Connect
curl http://localhost:8080/v2/pipeline -d "{\"requests\": [{\"type\": \"execute\", \"stmt\": {\"sql\": \"SELECT 1\"}}]}"Key Features
- Full SQLite compatibility
- Server mode (HTTP + WebSocket)
- Embedded replicas
- Vector search
- ALTER TABLE extensions
- Encryption at rest
- Multi-tenancy
- Edge deployment (Turso)
- Official SDKs (TS, Rust, Go, Python)
- Open to contributions (unlike SQLite)
Comparison
| Database | Type | Server Mode | Vector |
|---|---|---|---|
| libSQL | SQLite fork | Yes (sqld) | Yes |
| SQLite | Embedded | No | No |
| LiteFS | SQLite replication | Proxy | No |
| Cloudflare D1 | SQLite managed | Yes | No |
| PlanetScale | MySQL managed | Yes | No |
| Neon | Postgres managed | Yes | Via pgvector |
常见问题 FAQ
Q: 和 SQLite 区别? A: libSQL 是 SQLite 的超集。增加了 server 模式、embedded replicas、向量搜索、ALTER TABLE 扩展。SQLite 原项目不接受外部贡献,libSQL 完全开放。
Q: Turso 是什么? A: Turso 是基于 libSQL 的托管 edge 数据库服务。数据库副本部署在全球边缘节点(Fly.io),读延迟<50ms。免费层每月 9GB 存储 + 500 DB。
Q: 适合什么场景? A: 需要 SQLite 简单性但又需要远程访问、多副本、或向量搜索的场景。如 SaaS multi-tenant、移动 app 本地缓存 + 云同步、edge worker 数据层。
来源与致谢 Sources
- Docs: https://docs.turso.tech
- GitHub: https://github.com/tursodatabase/libsql
- License: MIT