Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Turso 3 min read How-to mediumAdept

Multi-Tenant E-Commerce Architecture with Turso

A multi-tenant storefront architecture that shares one template codebase but gives each store its own Vercel project, environment variables (name, theme, Stripe key) and Turso database, avoiding shared-database tenant isolation. New stores are provisioned by creating a Vercel project and a database seeded from a template database (or kept in sync via Turso Multi-DB Schemas), with the database URL derived from the project's production URL so queries need no tenant filter. The tradeoff favors strong isolation, simpler debugging and per-store cost attribution over the overhead of many deployments and databases.

Related posts

  • Multi-tenancy at Scale: How to Give Every User Their Own Database

    Turso mediumAdept

    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. When a database is a SQLite file, an idle tenant costs only storage, so 1,000 tenant databases fit in a ~$25/month Turso plan instead of five figures on RDS. Per-tenant databases replace Row-Level Security and `tenant_id` filtering with routing to the right database. That makes isolation, BYOK encryption, regional data residency and GDPR deletion architectural properties. The costs are harder cross-tenant analytics, coordinated schema migrations across the fleet, and a poor fit for consumer apps with millions of tiny users or products needing constant cross-tenant queries.

  • The Many-Database Architecture: Should You Give Every Tenant Their Own Database?

    Turso mediumAdept

    Shared schema with row-level security, schema per tenant, and database per tenant trade off isolation strength against operational cost. Shared schema stays simplest for many small tenants and cross-tenant analytics, but its isolation is only logical. Schema-per-tenant takes on most of the overhead of separate databases for only part of the isolation. Database-per-tenant gives structural isolation, trivial per-tenant deletion and placement in a chosen region. Cheap SQLite-based databases make it affordable, though routing, monitoring and cross-tenant analytics (via ETL or CDC) become operational work. A TypeScript example shows provisioning from a template database and scoping tokens per tenant.

  • Databases as Variables: What Unlimited Databases Actually Changes

    Turso mediumAdept

    Turso Cloud's paid plans no longer meter active databases, so a database costs only its storage while idle. That changes the cost math behind choosing a shared tenant_id schema. Because a Turso database is a file stored as 128 kB segments in object storage with copy-on-write branching, per-tenant, per-agent-session, per-experiment, per-regulated-user and per-PR databases become cheap, and provisioning takes two Platform API calls seeded from a template. Real costs remain: cross-tenant analytics pipelines (CDC helps), fleet-wide migration runners, routing and monitoring, so shared schemas still suit early, unregulated or analytics-heavy products, and a hybrid is often best.

  • Multi-tenancy and Database-per-User Design in Postgres

    Neon easyNovice

    Postgres multi-tenancy comes in three main designs: shared schema, schema-per-user and database-per-user. Shared schema is cheapest but raises the risk and impact of isolation failures. Schema-per-user adds operational burden without strong isolation and is rarely worth it today. Database-per-user gives full isolation, data residency control and a fix for noisy neighbors, and it can pair with either isolated or shared application environments, each with tradeoffs in onboarding, versioning and complexity. Running it at scale requires a control plane to automate onboarding, monitoring and schema upgrades across the database fleet.

  • Turso Cloud on AWS is now available for everybody

    Turso easyNovice

    Turso Cloud is now generally available on AWS, built on an S3-native architecture where every commit is made durable on S3 Express One Zone and local disks serve as a read cache. Two factors make object storage viable for an OLTP write-ahead log: massive multitenancy, which lets commits be batched across many databases, and S3 Express latency in the single-digit milliseconds, comparable to fsync on EBS. Because each database is just a SQLite file on an always-up multitenant server, there are no cold starts, and databases can move between servers as load shifts. Paid Fly.io customers may stay or migrate; free-tier databases are auto-migrated to mapped AWS regions starting March 21.

The quest for software engineering knowledge.

Look:
Layout: