Skip to Content
What is Larva?

What is Larva?

A tiny SQL database that lives inside your Vercel Blob store. No signup, no new vendor, no server, no connection string. When your app grows up, export to a bigger database with one command — that’s why it’s called Larva.

import { defineSchema, larva, t } from "@larva-db/core"; const schema = defineSchema({ customers: { id: t.text().primaryKey(), // ULIDs generated for you email: t.text().unique(), createdAt: t.timestamp().partitionBy(), // ← makes date filters fast }, }); const db = larva({ schema }); // credentials auto-discovered from the Vercel env await db.sql`INSERT INTO customers (email, createdAt) VALUES (${"ada@example.com"}, ${"2026-06-01T00:00:00Z"}) RETURNING *`;

That’s the whole setup. No migrations to run, no dashboard to visit, no second bill.

What you get

  • Real SQL — a deliberately scoped dialect that covers ~90% of what small apps write: multi-table joins, uncorrelated subqueries, GROUP BY over expressions, HAVING, upserts, JSON functions, date bucketing, additive ALTER TABLE. Everything outside it is rejected by name, with an alternative.
  • No silently lost writes, ever. Every commit goes through an atomic protocol; conflicts rebase, re-execute, or fail loudly. Verified by 318 checks including randomized concurrent-writer gauntlets.
  • Atomic transactions — several statements, one commit, all or nothing.
  • Time travel — every commit is a new immutable version; db.asOf() reads the past and db.rollbackTo() is a one-line undo button.
  • Auto IDst.uuid() fills a time-ordered UUID on insert with nothing to coordinate; t.sequence() auto-numbers rows (invoice #42), unique across concurrent writers, without a server.
  • Fast appends & contention batching (format 4) — INSERTs with auto-generated ids and no unique constraints are durable at one storage round-trip, contention-free; under heavy cross-instance contention, ordered writes batch into shared commits automatically instead of retry-storming.
  • A guaranteed exitdb.export({ format: "postgres" }) produces one pg_dump-shaped file; psql $DATABASE_URL < export.sql is the entire migration.

Who it’s for — and honest limits

Larva is for the enormous long tail of small applications: dashboards, internal tools, hobby apps, prototypes, and anything an AI agent is building for you. The limits are physics, not configuration:

  • Storage grows to gigabytes — that axis never runs out.
  • Writes serialize through one commit point: roughly one commit per second sustained. Five people editing a dashboard never notice; fifty writes per second hits a wall.
  • Reads pull data to the compute. Filters on the primary key or the partitionBy() column prune aggressively; anything else scans — fine at tens of thousands of rows, untenable at millions.

When you get there, congratulations: export and graduate.

Last updated on