DEV Community

ShopNx
ShopNx

Posted on Fully Autonomous

Run a Go + SvelteKit online store on your laptop with one docker compose

GoCommerce is an MIT-licensed commerce engine written in Go: products, variants, inventory, carts, checkout, orders, payments and fulfilment over one PostgreSQL database, with an admin panel built into the binary. Svelte Commerce is the SvelteKit storefront that sells from it. This walkthrough runs both, plus Postgres, Meilisearch and Caddy, on your own machine, and ends with a working shop at https://acme.shops.localhost.

You need Docker with Compose v2 and Git. Nothing else: Go and Node run inside the images.

1. Get the code

git clone https://github.com/itswadesh/gocommerce
cd gocommerce
cp .env.example .env
Enter fullscreen mode Exit fullscreen mode

2. Fill in .env for a local trial

Open .env and set these. Everything else can stay empty.

POSTGRES_PASSWORD=<openssl rand -hex 24>
GOCOMMERCE_ADMIN_TOKEN=<openssl rand -hex 32>
GOCOMMERCE_ADMIN_EMAIL=you@example.com
GOCOMMERCE_ADMIN_PASSWORD=<a password for the panel>
MEILI_MASTER_KEY=<openssl rand -hex 24>

ADMIN_DOMAIN=admin.localhost
GOCOMMERCE_PANEL_URL=https://admin.localhost
GOCOMMERCE_BASE_DOMAIN=shops.localhost
CADDY_GLOBAL_OPTIONS=local_certs
Enter fullscreen mode Exit fullscreen mode

*.localhost names point at your own machine in current browsers, so no DNS is needed. local_certs makes Caddy issue certificates from its own local authority instead of asking Let's Encrypt, which can't reach your laptop. COMPOSE_PROFILES=proxy is already on in the example, which is what starts Caddy. If ports 80 or 443 are taken, set HTTP_PORT and HTTPS_PORT and add the port to the addresses below.

Leave out MEILI_MASTER_KEY and the engine still runs, just without search, but the Meilisearch container will keep restarting: in production mode it refuses to start without a key.

3. Start it

docker compose up -d --build
Enter fullscreen mode Exit fullscreen mode

The first build takes a few minutes: it compiles the engine and builds the storefront from the svelte-commerce repository. docker compose ps should then show postgres, meilisearch, gocommerce, storefront and caddy running. The engine logs a line like:

gocommerce listening addr=0.0.0.0:8080 version=1.2.0 modules=65 routes=728
Enter fullscreen mode Exit fullscreen mode

4. Open a store

One install hosts many stores. Make the first one:

docker compose exec gocommerce /gocommerce store create acme "Acme Store"
Enter fullscreen mode Exit fullscreen mode

Then open:

Your browser will warn about the certificate the first time, because it comes from Caddy's local authority. That is expected for a local trial.

What's in the box

The compose file installs every module, and each one sits idle until you configure it: payments (Stripe, Razorpay, Cashfree and others), shipping (Shiprocket, Shippo and others), email and WhatsApp notifications, invoices, B2B company accounts, a CMS, and an MCP server. In code, each is an ordinary Go package under ext/. They change the core only through its services, never by writing its tables, so an order's state change and its event commit in the same transaction.

If you'd rather embed the engine in your own Go program than run the binary:

go get github.com/misiki-in/gocommerce/core@latest
Enter fullscreen mode Exit fullscreen mode

A store is then a main() that passes the integrations it wants to gocommerce.New(...). The README has the full example.

Clean up

docker compose down -v
Enter fullscreen mode Exit fullscreen mode

-v also deletes the database and media volumes.


The engine and the storefront are free to self-host under the MIT licence. If you'd rather not run servers, ShopNx is the hosted version for Indian sellers, and it is free.

Code: GoCommerce ยท Svelte Commerce
__

Top comments (0)