A lightweight, self-hosted Customer Relationship Management (CRM) platform for Shopify Lite and Shopify merchants. CRM Light combines a serverless REST API (@crm/api) with an RTL-first React dashboard (@crm/dashboard) to give you full visibility into your customers, orders, products, and sales pipeline — plus a public storefront API for cart and checkout.
The dashboard UI is localized in Farsi (Persian) and designed RTL-first.
- Dashboard — Overview KPIs, customer records, companies, orders, products, sales pipeline (opportunities), tasks, messages/tickets, notifications, reports, and workspace settings.
- Customers — Full customer profiles, activity log, commerce history, one-click Shopify customer sync, and CSV import/export.
- Orders & Products — Browse Shopify Lite orders and the store catalog with product performance data.
- Sales pipeline — Track opportunities across stages with weighted deal values.
- Storefront API — Public product catalog, shopping cart, and authenticated checkout with order lookup.
- Auth — Admin access via Clerk and customer checkout auth via Clerk Storefront.
- Scheduled sync — Runs customer sync automatically (default every 5 minutes) via a Cloudflare Workers cron trigger.
CRM Light is a pnpm monorepo with two apps:
| Package | Stack | Description |
|---|---|---|
@crm/api (apps/api) |
Cloudflare Workers, bare fetch handler, Cloudflare D1, Clerk | Single REST API covering admin CRUD, storefront commerce, reports, search, contact messages, and Shopify syncing. |
@crm/dashboard (apps/dashboard) |
React 19, Vite, Tailwind CSS 4, Clerk, Headless UI, lucide-react | RTL-first Persian admin dashboard served as a static site. |
├── apps/
│ ├── api/ # Cloudflare Worker REST API
│ │ ├── migrations/ # Versioned SQL migrations
│ │ ├── scripts/ # Database migration runner
│ │ └── src/ # API routes & handlers
│ └── dashboard/ # React admin dashboard
├── scripts/ # Workspace-level tooling (env sync)
├── pnpm-workspace.yaml
└── vitest.config.mts # Root Vitest configuration
- Node.js >= 20
- pnpm >= 10
- A Cloudflare account (for local/dev it requires
wrangler; only needed for deploy) - A Cloudflare D1 database
- A Clerk application (admin) and, optionally, a Clerk storefront application (customer checkout)
Install dependencies:
pnpm installEach app reads its own local env file (both are git-ignored; examples are committed).
API — apps/api/.dev.vars (used by wrangler dev):
CLERK_SECRET_KEY="sk_test_your_secret_key"
STOREFRONT_CLERK_SECRET_KEY="sk_test_your_storefront_secret_key"See apps/api/.dev.vars.example for the reference.
The D1 binding is configured in apps/api/wrangler.jsonc; local development uses Wrangler's local D1 database automatically.
Dashboard — apps/dashboard/.env (copy from .env.example):
VITE_API_URL="http://localhost:8787"
VITE_CLERK_PUBLISHABLE_KEY="pk_test_your_publishable_key"Create the database schema:
pnpm --filter @crm/api db:migrateMigrations live in apps/api/migrations/*.sql and are tracked idempotently by D1.
Start both the API and dashboard:
pnpm devOr run them individually:
pnpm dev:api # API on http://localhost:8787
pnpm dev:dashboard # Dashboard on http://localhost:5173The Vite dev server proxies /api requests to the API, and the API allows the dashboard origin via CORS_ORIGIN.
All commands run from the repository root.
| Command | Description |
|---|---|
pnpm dev |
Run API and dashboard in parallel |
pnpm dev:api |
Start the Workers API locally |
pnpm dev:dashboard |
Start the dashboard dev server |
pnpm build |
Build all packages |
pnpm check |
Type-check all packages |
pnpm test |
Run the Vitest test suite |
pnpm test:watch |
Run tests in watch mode |
pnpm env:sync |
Sync DATABASE_URL into apps/api/.dev.vars |
pnpm env:sync (SHOPIFY_LITE_ENV_PATH=...) |
Sync from a custom source file |
The API exposes an index at / (or /api) listing every available route. Highlights:
- Admin (requires a Clerk admin session):
GET/POST /api/v1/customers,.../:id, activities, commerce,sync-shopify,csvGET/POST/PATCH/DELETE /api/v1/{companies|products|opportunities|tasks};GET/PATCH /api/v1/messagesGET /api/v1/{orders|overview|reports|notifications},GET /api/v1/search?q=...GET/PATCH /api/v1/settings,POST /api/v1/notifications/read
- Storefront (public or customer-auth):
GET /api/v1/storefront/products,.../products/:slug- Cart:
.../cart/:cartId,/items,/items/:productId POST /api/v1/storefront/checkout(customer-auth),GET /api/v1/storefront/orders/:idPOST /api/v1/storefront/messages
- Health:
GET /api/health
API (Cloudflare Workers):
pnpm --filter @crm/api deploySet the required secrets first (see apps/api/wrangler.jsonc → secrets.required):
wrangler secret put CLERK_SECRET_KEY
wrangler secret put STOREFRONT_CLERK_SECRET_KEYA cron trigger (*/5 * * * *) keeps Shopify customers in sync automatically.
Dashboard: build the static site and deploy it to any static host or Cloudflare Pages:
pnpm --filter @crm/dashboard buildpnpm testTests live alongside the source (e.g. apps/api/tests, apps/dashboard/tests) and run with Vitest.
MIT © 2026 Ali Josheqani.