Skip to Content
DevelopersHow Koomerce worksOverview: what and why

3 min read

How Koomerce works

This section explains the whole product from top to bottom: what each part is, why it is built that way and how it works, with a diagram for each big idea. Read it in order the first time. The pages under Getting started, Core concepts, Building and Operations go deeper; every page here links to them.

What it is

Koomerce is an online-store platform for Indian D2C brands, shaped like Shopify. A merchant signs up, gets a store, picks or imports a theme, adds products and takes orders paid by UPI, card, net banking or cash on delivery. Couriers, GST invoices, WhatsApp messages and the rest come as apps the store installs. Waimers (gaming peripherals, www.waimers.in) is the first store and runs on it today; it is store number one, not a special case in the code.

Three kinds of people use it:

WhoWhereWhat they do
ShoppersThe storefront, on the merchant’s own domainBrowse, buy, track, return
Merchants and their staffThe admin (admin.koomerce.app)Run the store: orders, stock, products, theme, apps, money
Platform staffThe platform console in the admin (/platform)Look after every store; see Platform console

AI apps (Claude, ChatGPT and others) can also act for a merchant over MCP, with the same permissions and approvals as a person. See AI and MCP.

The parts

Shoppers, merchants and AI apps reach Cloudflare. Cloudflare sends store pages to the storefront, the admin and API to the admin and worker. The apps use Postgres, Dragonfly and R2 storage, and the worker talks to payment gateways, couriers, email, WhatsApp and the AI gateway.
The whole system on one page. To edit, open system-overview.excalidraw in excalidraw.com, then save it back over the same file.
PartCodeOne line
Storefrontapps/storefrontNext 16. Every store’s shop: theme pages, cart, checkout, shopper accounts
Adminapps/adminNext 16. The merchant’s back office, the oRPC API (packages/api) and the MCP endpoint
Workerapps/workerBun + Hono + BullMQ. Webhooks in, jobs out: emails, app hooks, tracking, imports, sweeps
Domain codepackages/coreBusiness rules: catalog, cart, orders, payments, shipping, GST, discounts, apps
Databasepackages/dbDrizzle schema and migrations on Postgres 17 with row-level security
Appspackages/plugin-*, packages/shipping-*, packages/payments-*, …One package per app, each with a definePlugin manifest
Storefront blockspackages/blocksThe sections native themes are built from (Puck)
Docs, landing, monitorapps/docs, apps/www, apps/monitorThis site, koomerce.app, and the uptime checker

Why it is built this way

These choices come up again and again in the code. Each has a page that explains it.

  1. One database, many stores, isolated by Postgres. Every store’s rows sit in the same tables with a store_id, and row-level security shows a transaction only its own store’s rows. A forgotten where cannot leak another store’s data. See Stores and tenancy.
  2. Apps, not special cases. Couriers, gateways, invoices and channels are packages behind a contract, installed per store. Core never imports a courier directly. See Apps.
  3. Side effects through an outbox. A change and the events it causes are written in one transaction; the worker sends the emails and runs app hooks afterwards. Nothing is lost when a queue is down. See Worker and jobs.
  4. Cheapest setup that still holds. One server runs the three apps, Postgres and Dragonfly; Cloudflare sits in front and caches store pages. Build machines never serve traffic. See Deploy and operations.
  5. India first. Rupees in paise, GST per GSTIN and per parcel, UPI and COD, Indian couriers, WhatsApp, Hindi in the admin. See GST and invoices.
  6. Checks in code, not in memory. Guardrail sweeps, a cross-store leak test and a component checker fail the build when a rule is broken. See Testing and guardrails.

Reading order

  1. Architecture: the apps, what runs where, one request through the system.
  2. Stores and tenancy: how a request finds its store, members and roles.
  3. Apps: how an app installs and runs, with GST invoices and Delhivery as examples.
  4. Orders end to end, then Shipping, Payments and GST and invoices.
  5. Themes and storefront and Admin: the two front ends.
  6. Worker and jobs, Data model, AI and MCP.
  7. Performance and caching, Deploy and operations, Testing and guardrails.
  8. Glossary for any word you meet.

Then set up a machine with Running locally and build something with Build your first app.

The diagrams

Every diagram in this section is an Excalidraw file in apps/docs/public/diagrams/. To change one, open the .excalidraw file in excalidraw.com  (Open, pick the file), edit it, save it back over the same file, and run bun run --cwd apps/docs diagrams to redraw its light and dark SVGs (scripts/render-diagrams.mjs, drawn with Rough.js, the library Excalidraw draws with).

Was this helpful?
Last updated on