Ecommerce for Supabase

Your backend.
Not ours.

One command drops a complete ecommerce backend into your Supabase project. Schemas, edge functions, RLS policies, Postgres RPCs, and a typed query client. Every file lands in your repo and becomes yours.

$npx @supacommerce/cli init

The same idea as shadcn/ui — but for your backend instead of your UI. No black box. No vendor lock-in. No abstraction sitting between you and your database. Delete @supacommerce/client and nothing breaks except your convenience wrappers.

What you get

14 Drizzle schemas

Products, variants, cart, orders, inventory, pricing, promotions, tax, fulfillment, payments, sales channels, and admin. Fully typed.

7 edge functions

Checkout, order confirmation, payment webhooks, admin invitations, and storage. Clear TODO markers where your payment provider goes.

RLS policies

Products are publicly readable. Carts and orders are own-data-only. Admin tables are role-gated. Fully idempotent.

Postgres RPCs

Checkout, order confirmation, and inventory reservation run as atomic Postgres transactions. Partial failures are impossible.

Typed query client

commerce.cart.addItem(), commerce.catalog.listProducts(). Ecommerce methods that speak your domain instead of raw SQL.

You own everything

Every file lands in your repo. Read it. Modify it. Delete what you don't need. No abstraction to fight.

How it works

1

Run the CLI

Copies all schemas, edge functions, SQL files, and config into your project.

npx @supacommerce/cli init
2

Generate and apply migrations

The schemas are plain Drizzle ORM TypeScript files. Generate SQL and push to your Supabase project.

pnpm drizzle:generate && supabase db push
3

Apply RLS and Postgres functions

Paste rls.sql and functions.sql into the Supabase SQL Editor. These are not applied by db push.

4

Use the query client

Install @supacommerce/client and start building your storefront.

pnpm add @supacommerce/client

Packages

@supacommerce/cli

The init command. Copies schemas, edge functions, SQL files, and config into your project. Detects your package manager automatically.

@supacommerce/client

Typed ecommerce query client. commerce.cart.addItem(), commerce.catalog.listProducts(), commerce.orders.list() — and more.

@supacommerce/utils

Shared utilities. Currency helpers, typed error classes, Result<T>, pagination, ID generation, and date helpers.