← Back to blog
··13 min read

Turso vs Cloudflare D1 vs Neon 2026: Best Serverless Database for Next.js

TursoCloudflare D1NeonDatabaseServerlessEdgeNext.jsSQLite
Turso vs Cloudflare D1 vs Neon 2026: Best Serverless Database for Next.js
Network cables in a data center representing serverless database infrastructure

Network cables in a data center representing serverless database infrastructure

Picking the database is one of the first real decisions you make when you start a new Next.js SaaS, and in 2026 the default has quietly shifted. The old answer was "a managed Postgres box somewhere." The new answer is a serverless database that scales to zero, bills by usage, and lives close to your edge functions. Three names dominate that conversation: Turso, Cloudflare D1, and Neon.

They are not the same kind of tool. Two of them are SQLite. One is full Postgres. One is welded to a specific runtime. This guide breaks down how each one actually works, what it costs, and the clear situations where one beats the other two — so you can choose once and not rip it out six months later.

The 30-second answer

  • Neon — you want real PostgreSQL. Extensions, pgvector, complex joins, an existing Postgres codebase, or database branching for preview environments. This is the safe, boring, powerful choice.
  • Cloudflare D1 — your app already runs on Cloudflare Workers or Pages. D1 is zero-config SQLite that lives inside the same runtime, bills on rows read and written, and has no egress fees.
  • Turso — you want SQLite with embedded replicas (a local copy that gives microsecond reads), multi-region edge replication, or a cheap database-per-tenant model for a multi-tenant SaaS.
  • If you remember nothing else: Neon for Postgres power, D1 for Cloudflare-native simplicity, Turso for edge-local reads and per-tenant databases.

    How each one actually works

    Turso (libSQL)

    Turso is built on libSQL, an open-source fork of SQLite that adds the networking and replication SQLite never had. The headline feature is embedded replicas: your application keeps a real SQLite file locally, serves reads from it at memory speed, and syncs writes to a cloud primary that propagates back. Reads never cross the network. For read-heavy apps that is a dramatic latency win.

    The second thing Turso does well is databases as a cheap primitive. Creating a database is close to free, so the database-per-tenant pattern — one isolated SQLite database for every customer — becomes practical instead of exotic. That is a genuinely different architecture than a single shared Postgres instance with a tenant_id column on every table.

    Cloudflare D1

    D1 is Cloudflare's SQLite database, and its defining trait is where it lives: inside the Cloudflare Workers runtime, backed by Durable Objects and Cloudflare's storage layer. You bind a D1 database to a Worker and query it with no connection string, no pooling, and no cold-start dance. Billing is based on rows read and rows written, and crucially there are no data egress or bandwidth charges for data read from D1.

    In 2026 D1 also ships global read replication — read-only copies in multiple regions, with no extra per-replica fee (you still pay for the rows your queries touch). The trade-off is that D1 is only interesting if you are already committed to Cloudflare. It is not a general-purpose database you reach over the internet from anywhere.

    Neon

    Neon is serverless PostgreSQL — the real thing, not a SQLite dialect. It separates storage from compute so your database can scale to zero when idle and autoscale compute up under load. The feature everyone talks about is branching: a copy-on-write branch of your entire database in seconds, which makes per-pull-request preview databases and safe migration testing trivial.

    Because it is Postgres, you get the whole ecosystem: extensions like pgvector for embeddings, mature SQL, and compatibility with every Postgres tool and ORM. After Neon's 2025 acquisition by Databricks, compute and storage prices dropped noticeably, which only strengthened the "just use Postgres" argument.

    Side-by-side comparison

    FactorTursoCloudflare D1Neon
    EnginelibSQL (SQLite fork)SQLite on Durable ObjectsPostgreSQL
    Best latency trickEmbedded replicas (local reads)Lives inside the Worker runtimeServerless HTTP driver + pooling
    BranchingLimitedNoYes, instant copy-on-write
    Extensions / pgvectorNo (SQLite)No (SQLite)Yes, full Postgres
    Multi-tenant per-DBExcellent, databases are cheapPossibleOne DB, use schemas or row scoping
    Billing modelStorage + rows read/writtenRows read/written, no egressCompute (CU-hours) + storage
    Scale to zeroYesN/A (no idle compute)Yes
    Free tier~5 GB, 100 DBs, 500M reads/mo500 MB/DB, 5 GB/account0.5 GB/project, scale-to-zero
    Max DB sizeLarge (plan-dependent)10 GB per databaseVery large (storage-based)
    Deploy affinityEdge / anywhereCloudflare onlyAnywhere
    ORM sweet spotDrizzleDrizzlePrisma or Drizzle

    Pricing figures move; always confirm the current numbers on each vendor's pricing page before you commit. The shape of the models rarely changes, though: D1 and Turso bill by rows and storage, Neon bills by compute time and storage.

    Latency: the real differentiator

    For a serverless app, the question is not "how fast is the database" but "how far is the database from the code that queries it." That reframes everything.

  • Turso wins read latency outright when you use embedded replicas, because reads hit a local SQLite file and never leave the process. Writes still go to the primary.
  • Cloudflare D1 wins when your compute is a Worker, because the query path stays inside Cloudflare's network. With read replication, reads resolve from a nearby region.
  • Neon is fast when your compute sits in the same region as your Neon project. From edge functions, use Neon's serverless HTTP driver rather than a raw TCP connection, or you will pay a connection-setup tax on every cold invocation.
  • A mismatch here is the number-one performance mistake teams make: a globally-deployed edge app talking to a single-region database in another continent. Co-locate, or replicate.

    Code: the same query, three ways

    All three pair beautifully with Drizzle ORM, which keeps your query code almost identical across engines.

    ts
    // Turso (libSQL) with Drizzle
    import { drizzle } from "drizzle-orm/libsql";
    import { createClient } from "@libsql/client";
    
    const client = createClient({
      url: process.env.TURSO_DATABASE_URL!,
      authToken: process.env.TURSO_AUTH_TOKEN!,
    });
    export const db = drizzle(client);
    ts
    // Cloudflare D1 with Drizzle (inside a Worker)
    import { drizzle } from "drizzle-orm/d1";
    
    export default {
      async fetch(req: Request, env: Env) {
        const db = drizzle(env.DB); // DB is the bound D1 database
        const users = await db.select().from(usersTable);
        return Response.json(users);
      },
    };
    ts
    // Neon serverless Postgres with Drizzle (edge-friendly HTTP driver)
    import { drizzle } from "drizzle-orm/neon-http";
    import { neon } from "@neondatabase/serverless";
    
    const sql = neon(process.env.DATABASE_URL!);
    export const db = drizzle(sql);

    The data-access layer looks nearly the same. What differs is the SQL dialect (SQLite vs Postgres), the driver, and where you run it. That is exactly why committing to an ORM like Drizzle early keeps your options open. If you are weighing ORMs, see our deep dive on Prisma vs Drizzle vs Kysely and the Drizzle vs Prisma for Next.js comparison.

    Global network of connected points representing edge database replication

    Global network of connected points representing edge database replication

    When to choose each one

    Choose Neon if…

  • You need real Postgres: window functions, CTEs, strong typing, pgvector for AI features, or any Postgres extension.
  • You want database branching for per-PR preview environments or safe migration rehearsals.
  • You are migrating an existing Postgres app and do not want to rewrite SQL.
  • Your team already knows Postgres and you value boring, proven technology.
  • Neon is the lowest-risk pick for a serious SaaS. See how it stacks up against other Postgres hosts in Neon vs Supabase vs PlanetScale.

    Choose Cloudflare D1 if…

  • Your app already runs on Cloudflare Workers or Pages. D1 inside the same runtime is as frictionless as it gets.
  • You want predictable, egress-free billing on rows rather than compute hours.
  • Your data fits comfortably under the per-database size ceiling and you do not need Postgres-only features.
  • If you are choosing your compute layer too, read Cloudflare Workers vs AWS Lambda vs Vercel Functions.

    Choose Turso if…

  • You want embedded replicas for microsecond local reads in a read-heavy app.
  • You are building multi-tenant and want one isolated database per customer without the cost blowing up.
  • You want SQLite's simplicity with real edge replication, deployable anywhere rather than locked to one cloud.
  • The honest trade-offs

    No tool is free of sharp edges.

  • SQLite is not Postgres. Turso and D1 give you SQLite's type affinity, limited concurrent-write model, and a smaller function library. For heavy transactional write workloads or advanced SQL, Postgres (Neon) is the better engine.
  • D1 locks you to Cloudflare. That is a feature if you are all-in, a liability if you are not. Migrating off it later means rewriting your data layer.
  • Turso is evolving fast. The platform and SDKs have changed shape more than once; pin versions and read the changelog before upgrading in production.
  • Neon's cost is compute-driven. A chatty, always-warm app pays for compute time. Scale-to-zero helps spiky workloads, but a constantly-busy database is not free.
  • Bottom line

    There is no single winner, because these three target different shapes of problem:

  • Reach for Neon when you want the full power and familiarity of PostgreSQL with modern serverless ergonomics and branching. It is the default for most production SaaS.
  • Reach for Cloudflare D1 when your stack lives on Cloudflare and you want the simplest possible database with egress-free, usage-based pricing.
  • Reach for Turso when edge-local reads, deploy-anywhere SQLite, or cheap per-tenant databases are the thing you are optimizing for.
  • Decide based on where your code runs and whether you need Postgres features, and the choice usually makes itself.

    ---

    Building a Next.js SaaS and want a head start on the data layer? Browse production-ready starters on CodeCudos — including Drizzle ORM templates and starters and Stripe subscription SaaS boilerplates that wire the database, auth, and billing together so you can ship in a weekend.

    Frequently asked questions

    What is the difference between Turso, Cloudflare D1, and Neon?▾

    Turso and Cloudflare D1 are both SQLite engines (Turso uses libSQL, a SQLite fork; D1 runs SQLite on Durable Objects), while Neon is full serverless PostgreSQL. Turso's standout feature is embedded replicas that keep a local SQLite copy in sync for microsecond reads. D1 is deeply integrated with the Cloudflare Workers runtime and bills on rows read and written with no egress fees. Neon gives you the complete Postgres feature set, instant database branching, and scale-to-zero compute.

    Which serverless database is cheapest for a side project?▾

    All three have free tiers that comfortably run a side project. Cloudflare D1 free gives 500 MB per database and 5 GB per account; Turso free gives roughly 5 GB of storage, 100 databases, and 500 million row reads a month; Neon free gives 0.5 GB of storage per project with scale-to-zero compute. D1 and Turso tend to be cheapest at small scale because SQLite storage is cheap and there is no always-on compute to pay for; Neon scale-to-zero also drops compute cost to near zero when idle.

    Can I use Turso, D1, or Neon with Prisma and Drizzle?▾

    Drizzle ORM supports all three natively and is the most popular choice for edge databases because it is lightweight and has first-class SQLite and Postgres drivers. Prisma supports Neon (Postgres) well and has a Turso/libSQL adapter; Prisma support for Cloudflare D1 exists through a driver adapter but is less mature than Drizzle's. If you are deploying to the edge or to Workers, Drizzle is the safer default.

    Which is best for an edge-deployed Next.js app?▾

    For an app running on the edge, latency to the database dominates. Cloudflare D1 is the natural fit if your Next.js app is already on Cloudflare Workers or Pages. Turso is excellent for edge reads thanks to embedded replicas and multi-region replication. Neon over its serverless HTTP driver works from edge functions too, but a traditional TCP Postgres connection from the edge needs pooling. Match the database to where your compute already runs.

    Related guides

    Browse Quality-Scored Code

    Every listing on CodeCudos is analyzed for code quality, security, and documentation. Find production-ready components, templates, and apps — or sell your own code and keep 90%.

    Browse Marketplace →