Skip to Content
Mercatus Liber
Mercatus Liber -- free market, free software

CI Release Sample stores License: MIT

Mercatus Liber

A free, MIT-licensed, headless commerce framework: an open alternative to Shopify that you own and can run anywhere.

No per-transaction cut, no app-store tax, no required vendor. Every subsystem is its own package behind a narrow interface, so you can swap the database, CMS, payments, auth, or fulfillment provider without touching the rest. Everything a person can do in the admin, an AI agent can do through the same interfaces over MCP.

Live demo  · Docs  · What’s new  · Wiki  · Vision and roadmap · Contributing

Status: pre-1.0, not yet on npm. The packages run in production on the demo stores below and on a real store (shop.mdostal.com ). You consume them from this monorepo, or from the packed builds attached to each release  (latest: v0.58.0). npm publishing comes later. Expect breaking changes between versions; see CHANGELOG.md.

See it running

Three sample stores, all built from the same open-source app (apps/reference-storefront). They are meant to be read and copied: each one is a public example of building a storefront on the framework. Each store has its own site (standalone), and all three also run side by side on the shared demo, which adds the framework’s landing page and architecture tour.

StoreWhat it isThemeBackendLinks
The Print ShopEmbroidery and custom printseditorialPostgresstandalone  · shared 
Northline Home TechSmart-home installer with service-area pagesnorthlinePostgresstandalone  · shared 
Broadleaf & Co.Artisan and handmade goodsvibrantConvexstandalone  · shared 

The demos run in sandbox payment mode, so no real charges happen. A scheduled check (sample-health.yml) requests every store’s pages every 6 hours and opens a sample-down issue if one stops answering. Details: sample stores.

Quick start

Requires Node 22.13 or newer and pnpm 11 (corepack enable picks up the pinned version).

git clone https://github.com/mdostal/mercatus-liber.git cd mercatus-liber pnpm install pnpm turbo run build --filter=@mercatus-liber/reference-storefront^... pnpm --filter @mercatus-liber/reference-storefront dev

Then open http://localhost:3000/demo/print-shop . No accounts or environment variables are needed: with nothing configured, the app runs on in-memory SQLite and reseeds on restart. Set DATABASE_URL or SQLITE_FILE_PATH to persist the catalog. Every variable is listed in the configuration reference.

To start your own store, use the scaffolder: packages/create-store.

What’s in the box

Commerce core: catalog with multi-axis variants, a marketing catalog kept separate from the sales catalog, search, product pages, long-lived cart, checkout and orders, customer accounts, inventory.

Merchandising and content: per-page CMS (no forced whole-site theme), 10 theme bundles, promotions, bundles, recommendations, advertising, reviews, storefront views, service-area pages, community goals, and made-to-order customization with an admin-defined pricing engine. Scheduled lines (limited-time sales catalogs with their own landing pages, countdowns and promotions), sale windows on any product, and products made to the buyer’s own measurements.

Checkout: Stripe-hosted checkout with address collection, cart-wide and product discounts, abandoned-checkout recovery links with consent-aware reminders, and a per-store card statement name.

Operations: role-based admin auth, fulfillment, shipping, webhooks, accounting sync, analytics, internal BI, a store scaffolder, auto-update, and a Shopify migration tool. A Printful catalog browser (browse every product, place art, generate mockups, publish), versioned print art, and reusable admin components (packages/admin-ui).

Outside apps: a key-authenticated store API and typed client, so apps such as flayr can import the catalog and run promotions (packages/store-api, flayr plan).

AI access: agent-ready by default. Every store has a public MCP endpoint, llms.txt and an MCP server card, so any AI agent can find it, browse it, fill a cart and hand the person a checkout link (packages/agent-commerce; turn it off with AGENT_ACCESS=off). Operators get an admin MCP server and tool catalog calling the same subsystem interfaces as the admin (packages/ai-interface).

Adapters

An adapter implements a subsystem’s interface for one provider. “Live” means running on the demo stores. “Unverified” means built and unit-tested against the provider’s documented API, but never run against a real account.

AreaAdapterState
Databaseadapter-sqliteLocal and zero-config default
Databaseadapter-postgres, adapter-postgres-inventoryLive
Databaseadapter-convexLive
Databaseadapter-mongodbBuilt and tested, not live
Commerce backendadapter-shopifyUnverified; available through create-store, not used by the demos
CMSadapter-sanityLive
Admin authadapter-clerkLive
PaymentsStripe (in payments)Live in sandbox mode
Paymentsadapter-paypalUnverified
Print on demandadapter-printfulCatalog, art placement and mockups run against Printful’s API with a real token; no live order placed yet
Print on demandadapter-printifyUnverified; activates when credentials are set
3D print on demandadapter-slant3d, adapter-3dapi, adapter-x3d (multicolour), adapter-simplyprint (the store’s own printers, queued through SimplyPrint)Unverified; activates when credentials are set. See docs/integrations/3d-print-on-demand.md
Shippingadapter-shippoRates, label and void verified against Shippo’s API in test mode; not with a live token
Shippingadapter-shipstationUnverified
Imagesadapter-cloudinaryUnverified
Accountingadapter-quickbooksUnverified
AnalyticsPostHog (in analytics)Live
AnalyticsGA4 (in analytics)Unverified

Database support is not uniform yet. Postgres covers nearly every commerce subsystem, while Convex, MongoDB, and SQLite mainly cover the catalog and customization. The integrations catalog has per-adapter detail and the environment variables for each.

Leaving Shopify: migrate-shopify reads a store once and writes it into native persistence, with a dry-run default. It covers products, collections, and inventory, but not orders, customers, or images yet. adapter-shopify is the other route: it keeps Shopify as the backend.

Build on it

Write a plugin for anything that should react to commerce events. A plugin gets the event bus and nothing else:

import type { Plugin } from "@mercatus-liber/plugins"; export const orderLogger: Plugin = { name: "order-logger", init({ events }) { events.subscribe<{ orderId: string }>("checkout.order.placed", async ({ orderId }) => { console.log(`order placed: ${orderId}`); }); }, };

Write an adapter to connect a new provider: implement the subsystem’s interface in a new packages/adapter-* package. See the adapter pattern.

Looking for something to build? Wishlists, gift cards, subscriptions, returns, marketplace sync, and more are listed in VISION.md’s community frontier.

UI: how it’s organized

LayerWhereState
Sample storesapps/reference-storefrontLive, public, and meant to be copied
Theme tokens and bundlespackages/themingLive, 10 bundles
Other storefront componentsapps/reference-storefront/componentsLive, but navigation, home, category, and CMS components are still inside the app
Common componentspackages/storefront-uiPartial: cart and product page templates, plus the customizer and price breakdown, live on The Print Shop’s dad cap 
Customizer Web Componentpackages/customization-uiFramework-free, but still on hex colors and not used by a sample store
Default UINot builtPlanned: move the remaining app components into storefront-ui as a default storefront

What’s being worked on

  • Customization: a quote flow for request-only options; see its known limitations.
  • UI: moving the rest of the app’s components into storefront-ui as a default UI.
  • Docs and samples: keeping the docs site and the standalone sample stores deploying from master; a scheduled check watches the samples.
  • Release: npm publishing, after dogfooding on a real store.

How it’s built

packages/ 60 packages: core types, one package per subsystem, one per adapter apps/ reference-storefront/ the sample stores (Next.js) docs/ the docs site (Nextra) docs/ architecture and one reference doc per subsystem

One rule holds it together: no subsystem imports another subsystem’s internals. They share core types, adapter interfaces, and a typed event bus. If replacing subsystem A means changing code inside subsystem B, that’s a bug. apps/reference-storefront/lib/services.ts is where concrete adapters get chosen. Read more in docs/ARCHITECTURE.md.

Documentation

Contributing

Issues and pull requests are welcome. Start with CONTRIBUTING.md. Please report security problems as described in SECURITY.md.

License

MIT