Run Wocart locally
Locally, everything runs on Cloudflare's local runtime: the database, the media bucket and the key-value stores are files on your machine. You need no Cloudflare resources until you deploy.
What you need
Node 22.12 or newer, npm, and git.
1. Clone and install
Code
One install at the root covers the API server, the dashboard and the shared code. The storefront has its own install (step 3).
2. Copy the configuration
Each application ships an example of every file it reads. Copy them:
Code
Then set three values:
| File | Value |
|---|---|
cod-client-astro/wrangler.toml | database_id: the same value as in cod-server/wrangler.toml, so both read the same database |
cod-client-astro/.dev.vars | BETTER_AUTH_SECRET: any long random value (openssl rand -hex 32) |
cod-client-astro/.dev.vars | PUBLIC_API_URL=http://localhost:8787 |
Everything else works as shipped. Configuration lists every value.
3. Set up the storefront
Code
The example already holds the local store key the database setup creates in the next step, and the local API's address.
4. Create the database and the admin
Code
db:setup:local applies every migration and creates the store: its API key,
menus, default collections, legal pages and a shipping profile.
seed:admin creates your dashboard account and prints its password and a
merchant API key. Save them: they are shown once.
Running db:setup:local again changes nothing the store already has.
Running seed:admin again for the same email gives that account a new
password and a new API key: use it when you lose them.
5. Start the three applications
Run each in its own terminal:
Code
The dashboard and the storefront both default to port 4321, so one of them takes another port.
Sign in to the dashboard with the account from step 4. The API reference
is served by the server at http://localhost:8787/api/docs.
The local data
The API server and the dashboard share one local database, kept in
.wrangler-shared/ at the repository root. Delete that folder to start over,
then run step 4 again.
Sign-in fails on a fresh checkout
The database was not set up. Run npm run db:setup:local in cod-server,
then npm run seed:admin in cod-client-astro.
Optional services
Each of these is off until you configure it, and the store works without it:
| Service | Locally |
|---|---|
| Media on ImageKit | Images are kept in the local bucket and served by the API at /media/<key>. To use ImageKit, see Media |
| AI agents (MCP) | Set the same MCP_LOGIN_TICKET_SECRET in both .dev.vars files |
| Review photos and voice notes | Set REVIEW_UPLOAD_SECRET in cod-server/.dev.vars; without it reviews are text only |
| Telegram | Telegram cannot call localhost: put a tunnel's https origin in TELEGRAM_UPDATES_ORIGIN |
Run the tests
Code
The tests need no network and no credentials.