goocommerce

goocommerce is a lighter remake of WooCommerce written in Go (the API, goocommerce-api) and React (the shop and its back office, goocommerce-ui).
It's OpenSource MIT licensed and you can host it yourself, the repo is on our gitlab.
goocommerce works directly on a WordPress/WooCommerce MySQL or MariaDB database and has no other link with WordPress: no PHP, no plugin, no WordPress REST API. It reads and writes the same tables as WooCommerce (products, orders with HPOS or the legacy shop_order posts, coupons, taxes, shipping zones, settings, analytics lookup tables...) and the same users (WordPress password hashes). So it can:
- run alone, as a complete shop on a fresh database (Flyway creates the WooCommerce schema);
- run alongside an existing WooCommerce: both see each other's changes in real time;
- run API only, as an AI agent (plus API keys, MFA and accounting exports) for an existing WooCommerce that stays your shop (see API only mode).
Features summaryβ
What it shares with WooCommerce:
- Storefront: catalogue with categories, tags, attributes, search, filters and sorting, simple / variable / grouped / external products, reviews and ratings, cart, coupons, taxes, shipping zones and methods (flat rate, free shipping, local pickup), checkout with the offline payment methods (bank transfer, cheque, cash on delivery), guest checkout, the customer's account (orders, addresses, downloads)
- Back office: dashboard, products and variations (with generation of every combination), categories, tags, attributes, shipping classes, media, orders (manual orders, notes, refunds with restock, status changes), customers, coupons, reviews moderation, WooCommerce settings, taxes, payment gateways, emails, reports (sales, top products and categories, stock, customers)
- The WooCommerce customer emails (new order, processing, completed, invoice, refunded...) are replicated for the orders goocommerce changes, and sent through the CWCloud email API
What it adds over WooCommerce:
- Long-term API keys (
X-Api-Keyheader) - Google sign-in (OIDC)
- MFA with a TOTP application or a YubiKey (WebAuthn)
- An AI assistant with an agentic loop calling goocommerce's own API with the signed-in user's token, subscriptions to OpenAI, Anthropic, Mistral, Gemini, OpenRouter, DeepSeek or CWCloud shareable with other users, embedded Markdown skills, and writes only after an explicit confirmation
- The CWCloud CWAI external adapter endpoint
POST /v1/ai/cwcloud/adapter - French accounting PDF exports (chiffre d'affaires, balance des comptes, grand livre), also usable as AI tools
- Forgotten password and contact form through CWCloud
- Discord notification on every user action, OpenTelemetry logs, metrics and traces, Prometheus
/metrics - Swagger UI at the API root
/with the OpenAPI document at/openapi.json(payloads and query parameters) - SEO: server-rendered meta tags, Open Graph and JSON-LD for the product and category pages,
sitemap.xml,robots.txt - Shop appearance settings: logo, home hero banner slides, 8 colour theme presets, fonts and custom CSS
- Users administration, audit log and IP bans
- I18N, light/dark mode
Architectureβ
| Component | Image / technology | Role |
|---|---|---|
api | Go (goocommerce-api), port 8080 | The REST API (/v1/...), Swagger UI at /, /openapi.json, /metrics, sitemap.xml, robots.txt and the SEO rendering of the product and category pages |
ui | React served by nginx (goocommerce-ui), port 80 (published on 3000) | The storefront and the back office; nginx proxies the SEO pages, sitemap.xml and robots.txt to the API |
flyway | flyway/flyway:10-alpine | Runs the SQL migrations of goocommerce-db/ once, then exits |
db | MySQL 8.4 (or MariaDB 11.8) | The WordPress/WooCommerce database, shared with WordPress if it runs alongside |
The API is stateless: the only state is in the database (WooCommerce's tables plus goocommerce's own goo_* tables for API keys, MFA, AI subscriptions and conversations, audit, IP bans, appearance...) and in the uploads folder (wp-content/uploads).
Installation with Docker Composeβ
Clone the repository:
git clone https://gitlab.cwcloud.tech/oss/cwcloud/goocommerce.git
cd goocommerce
cp .env.example .env # then edit the secrets
docker compose up -d --build
This will:
- Start a MySQL 8.4 database.
- Run the Flyway migrations (WooCommerce schema, goocommerce tables, WooCommerce defaults).
- Build and start the Go API on
http://localhost:8080(Swagger UI at/). - Build the React UI and serve it through nginx on
http://localhost:3000.
Then open http://localhost:3000 and register: on a fresh install, the first account becomes the shop's administrator.
docker-compose.ymlβ
services:
db:
image: mysql:8.4
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:-wordpress}
MYSQL_USER: ${MYSQL_USER:-wordpress}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-wordpress}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
volumes:
- db-data:/var/lib/mysql
ports:
- "127.0.0.1:3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uroot", "-p${MYSQL_ROOT_PASSWORD:-root}"]
interval: 5s
timeout: 5s
retries: 20
flyway:
image: flyway/flyway:10-alpine
depends_on:
db:
condition: service_healthy
command:
- -url=jdbc:mysql://${MYSQL_HOST:-db}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-wordpress}?allowPublicKeyRetrieval=true&useSSL=false
- -user=${MYSQL_USER:-wordpress}
- -password=${MYSQL_PASSWORD:-wordpress}
- -placeholders.table_prefix=${WP_TABLE_PREFIX:-wp_}
- -locations=filesystem:/flyway/sql
- -connectRetries=20
- migrate
volumes:
- ./goocommerce-db:/flyway/sql:ro
api:
build:
context: .
target: api
image: ${REGISTRY:-registry.cwcloud.tech}/goocommerce-api:${VERSION:-latest}
depends_on:
flyway:
condition: service_completed_successfully
env_file: .env
environment:
MYSQL_HOST: ${MYSQL_HOST:-db}
ports:
- "8080:8080"
volumes:
- uploads:/uploads
tmpfs:
- /storage:size=128m,uid=10001
ui:
build:
context: .
target: ui
image: ${REGISTRY:-registry.cwcloud.tech}/goocommerce-ui:${VERSION:-latest}
depends_on:
- api
environment:
GOOCOMMERCE_API_URL: ${GOOCOMMERCE_API_URL:-http://localhost:8080}
GOOCOMMERCE_API_INTERNAL_URL: http://api:8080
ports:
- "3000:80"
volumes:
db-data:
uploads:
The /storage tmpfs holds the files the AI assistant generates (accounting PDFs) until their download link expires.
.envβ
# --- database (the WordPress/WooCommerce one when running alongside) ---
MYSQL_HOST=db
MYSQL_PORT=3306
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=wordpress
MYSQL_ROOT_PASSWORD=root
WP_TABLE_PREFIX=wp_
# --- security ---
# openssl rand -base64 48
JWT_SECRET=changeit
# bcrypt = WordPress >= 6.8 hash format; phpass for older WordPress sharing the DB
GOOCOMMERCE_PASSWORD_HASH=bcrypt
# auto (WooCommerce behaviour), email (confirmation link) or admin (approval)
GOOCOMMERCE_ACTIVATION_MODE=auto
# --- URLs ---
GOOCOMMERCE_API_URL=http://localhost:8080
GOOCOMMERCE_UI_URL=http://localhost:3000
GOOCOMMERCE_SHOP_URL=http://localhost:3000
GOOCOMMERCE_UI_INTERNAL_URL=http://ui
GOOCOMMERCE_CORS_ENABLED=true
GOOCOMMERCE_CORS_ALLOWED_ORIGINS=http://localhost:3000
# --- uploads: mount WordPress' wp-content/uploads here to share images ---
GOOCOMMERCE_UPLOADS_DIR=/uploads
# Public URL of that folder (e.g. https://myshop.com/wp-content/uploads); empty = served by the API at /v1/media
GOOCOMMERCE_UPLOADS_URL=
# --- API only: goocommerce as an AI agent next to an unchanged WooCommerce ---
GOOCOMMERCE_API_ONLY=false
# --- Google sign-in (OIDC) ---
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_ID=
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_SECRET=
# --- CWCloud: emails (customer emails, password reset) and contact form ---
CWCLOUD_API_URL=https://api.cwcloud.tech
CWCLOUD_API_KEY=
CWCLOUD_CONTACT_FORM_ID=
GOOCOMMERCE_MAIL_FROM=noreply@cwcloud.tech
# --- observability ---
# Discord webhook "{id}/{token}" (blank or changeit = disabled)
DISCORD_TOKEN=changeit
# OTLP collector, e.g. otel-collector:4317 (traces, logs and metrics)
GOOCOMMERCE_OTEL_ENDPOINT=
GOOCOMMERCE_OTEL_PROTO=otlp/grpc
In production, at least change JWT_SECRET (openssl rand -base64 48), the database passwords, and set the public URLs (GOOCOMMERCE_API_URL, GOOCOMMERCE_UI_URL, GOOCOMMERCE_SHOP_URL, GOOCOMMERCE_CORS_ALLOWED_ORIGINS) to your domains behind a TLS reverse proxy.
Databaseβ
The migrations are in the goocommerce-db/ folder and are run by a standalone Flyway (flyway/flyway:10-alpine). They are tested on MySQL 8.4 and MariaDB 11.8.
| File | Content |
|---|---|
V1__woocommerce_schema.sql | The schema only of the 52 tables of WordPress core + WooCommerce (core, Admin/Analytics, HPOS order tables, Action Scheduler), captured from a fresh WordPress + WooCommerce install with HPOS on. CREATE TABLE IF NOT EXISTS, InnoDB, utf8mb4_unicode_520_ci. |
V2__goocommerce_tables.sql | goocommerce's own goo_* tables (with the WordPress prefix, e.g. wp_goo_api_keys). |
V3__woocommerce_defaults.sql | An idempotent seed of a fresh install's defaults: core options, the roles and capabilities, WooCommerce settings, the product type / visibility terms and the "Uncategorized" product category. It only inserts the missing rows and never overwrites anything. |
init-existing-instance.sql | To run by hand, once, to adopt an existing WooCommerce database. |
The table prefixβ
Every WordPress/WooCommerce/goocommerce table name is written ${table_prefix}<name> in the migrations. The placeholder is given to Flyway with -placeholders.table_prefix=..., which the compose file fills from WP_TABLE_PREFIX. Set it to the $table_prefix of your wp-config.php (usually wp_), and give the same value to the API (WP_TABLE_PREFIX).
The prefix also names the roles option (wp_user_roles for wp_, shop_user_roles for shop_), like WordPress does. Flyway's own flyway_schema_history table is never prefixed.
Fresh installβ
On an empty database, Flyway runs V1 (the WooCommerce schema), V2 (the goocommerce tables) and V3 (the WooCommerce defaults) in this order. That's what docker compose up does.
Without compose:
docker run --rm -v "//goocommerce-db:/flyway/sql:ro" flyway/flyway:10-alpine \
'-url=jdbc:mysql://HOST:3306/DB?allowPublicKeyRetrieval=true&useSSL=false' \
-user=USER -password=PASS -placeholders.table_prefix=wp_ \
-locations=filesystem:/flyway/sql migrate
After a fresh install, adjust the placeholder values V3 seeds from the back office settings (siteurl, home, blogname, admin_email, the WooCommerce email sender, the store address). V3 deliberately differs from a stock WooCommerce install on a few values (only when they are missing): currency EUR, default country FR, kg/cm units, UTC timezone, and the HPOS compatibility sync disabled.
The first account registered becomes the administrator (as long as the database has no administrator yet).
Existing WooCommerce instanceβ
The WordPress/WooCommerce tables already exist, so V1 must not run: it has to be recorded as already applied.
1/ Back up the database first:
mysqldump --single-transaction wordpress > backup.sql
2/ Check that every table of V1 exists in your database (a reasonably recent WooCommerce, the HPOS tables included even if your orders are still stored as posts). V1 is never executed here, so goocommerce won't create a missing table for you.
3/ Give a MySQL user access to the WordPress database. goocommerce needs to read and write the WooCommerce data and Flyway needs to create its history table and the goo_* tables:
CREATE USER 'goocommerce'@'%' IDENTIFIED BY 'a-strong-password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, REFERENCES ON wordpress.* TO 'goocommerce'@'%';
FLUSH PRIVILEGES;
You can also reuse the DB_USER of your wp-config.php.
4/ Run the adoption script, connected to the WordPress database:
mysql wordpress < goocommerce-db/init-existing-instance.sql
It creates flyway_schema_history exactly as Flyway 10 creates it and inserts row 1: version 1, script V1__woocommerce_schema.sql, checksum = 1657541756, success = 1. It's idempotent: you can safely run it again.
The checksum 1657541756 is the CRC32 Flyway 10 computes for V1__woocommerce_schema.sql. Flyway checksums the file before replacing the placeholders, so the value is the same whatever your table prefix is (verified with wp_ and shop_ on MySQL 8.4 and MariaDB 11.8).
5/ Run Flyway with your prefix:
docker run --rm -v "//goocommerce-db:/flyway/sql:ro" flyway/flyway:10-alpine \
'-url=jdbc:mysql://HOST:3306/wordpress?allowPublicKeyRetrieval=true&useSSL=false' \
-user=goocommerce -password=a-strong-password -placeholders.table_prefix=wp_ \
-locations=filesystem:/flyway/sql migrate
Flyway reports Current version of schema: 1, then applies V2 and V3. V2 only adds the goo_* tables, and V3 only adds the default options that are missing: your existing settings, roles and terms are kept. Expect harmless Duplicate entry ... (1062) warnings from its INSERT IGNOREs.
6/ Check with validate instead of migrate: it must answer Successfully validated N migrations.
Notes on the JDBC URL:
- MySQL 8:
allowPublicKeyRetrieval=trueis required when the user authenticates withcaching_sha2_passwordover a non-TLS connection, anduseSSL=falsewhen the server has no TLS. - MariaDB: the same
jdbc:mysql://...?allowPublicKeyRetrieval=true&useSSL=falseURL works (jdbc:mariadb://HOST:3306/DBtoo).
Then start goocommerce without the db service, the MYSQL_* variables pointing at the WordPress database and WP_TABLE_PREFIX set to its prefix: remove the db service from docker-compose.yml (and the depends_on of flyway on it, otherwise compose would start a local MySQL), then run docker compose up -d --build. WordPress' administrators become goocommerce's administrators (superuser), WooCommerce's shop managers become manager and every other role customer.
Note: since the history now exists, the flyway service of the compose file can stay: on each start it applies the new migrations of an upgrade and does nothing otherwise.
Sharing wp-content/uploadsβ
When WordPress runs alongside, goocommerce must use the same images. Mount WordPress' wp-content/uploads folder in the API container instead of the uploads named volume (the API runs with the uid 10001, which must be able to write in it):
api:
volumes:
- /var/www/html/wp-content/uploads:/uploads
GOOCOMMERCE_UPLOADS_DIR: the folder inside the container (/uploads).GOOCOMMERCE_UPLOADS_URL: the public URL of that folder, e.g.https://myshop.com/wp-content/uploads, so the image URLs stored in the database are the same as WordPress'. When it's empty, the API serves the folder itself at/v1/media.
Password hashesβ
goocommerce signs in the WordPress users with their existing passwords: it checks the WordPress bcrypt hashes (WordPress 6.8 and later), the phpass hashes (older WordPress) and the legacy MD5 ones. The format it writes (registration, password change or reset) is chosen with GOOCOMMERCE_PASSWORD_HASH:
bcrypt(default): the WordPress 6.8+ format;phpass: for an older WordPress sharing the database, which wouldn't be able to check a bcrypt hash.
API only mode: an AI agent for your WooCommerceβ
You don't have to replace your WooCommerce to use goocommerce. You can keep WooCommerce as your shop and only run goocommerce's API next to it, to get:
- the AI assistant that manages your WooCommerce data (products, orders, customers, coupons, reports...) through goocommerce's API, from a chat or from the CWCloud CWAI external adapter;
- long-term API keys and MFA for that API;
- the French accounting exports (chiffre d'affaires, balance, grand livre).
In this mode there's no ui container: set GOOCOMMERCE_API_ONLY=true and the API disables its storefront routes (cart, checkout, order received page, the customer's orders, addresses and downloads). The back office endpoints the agent uses stay available to the administrators and shop managers, and the users are WordPress' (sign in with your WordPress email or username and password).
1/ Initialise Flyway's history on the WooCommerce database, as described in Existing WooCommerce instance (backup, MySQL user, init-existing-instance.sql).
2/ Write a docker-compose.yml without the db and ui services:
services:
flyway:
image: flyway/flyway:10-alpine
command:
- -url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-wordpress}?allowPublicKeyRetrieval=true&useSSL=false
- -user=${MYSQL_USER}
- -password=${MYSQL_PASSWORD}
- -placeholders.table_prefix=${WP_TABLE_PREFIX:-wp_}
- -locations=filesystem:/flyway/sql
- -connectRetries=20
- migrate
volumes:
- ./goocommerce-db:/flyway/sql:ro
api:
build:
context: .
target: api
image: ${REGISTRY:-registry.cwcloud.tech}/goocommerce-api:${VERSION:-latest}
depends_on:
flyway:
condition: service_completed_successfully
env_file: .env
ports:
- "8080:8080"
volumes:
- /var/www/html/wp-content/uploads:/uploads
tmpfs:
- /storage:size=128m,uid=10001
3/ In the .env, point the database at WooCommerce's and enable the API only mode:
MYSQL_HOST=my-woocommerce-db-host
MYSQL_PORT=3306
MYSQL_DATABASE=wordpress
MYSQL_USER=goocommerce
MYSQL_PASSWORD=a-strong-password
WP_TABLE_PREFIX=wp_
JWT_SECRET=a-long-random-secret
GOOCOMMERCE_API_ONLY=true
GOOCOMMERCE_API_URL=https://goocommerce-api.myshop.com
GOOCOMMERCE_UPLOADS_DIR=/uploads
GOOCOMMERCE_UPLOADS_URL=https://myshop.com/wp-content/uploads
# phpass if your WordPress is older than 6.8
GOOCOMMERCE_PASSWORD_HASH=bcrypt
4/ Start it:
docker compose up -d flyway api
Flyway adds the goo_* tables (and the missing default options), then the API starts. The Discord start notice says API only (AI agent for WooCommerce).
5/ Sign in with a WordPress administrator or shop manager through the API (POST /v1/users/login, or the Swagger UI at the API root), create an AI subscription and an API key, then use the agent from POST /v1/ai/chat or from CWCloud.
Configurationβ
Every environment variable of the API:
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | Listening port of the API |
MAX_WORKERS | 5 | Size of the background workers pool |
MYSQL_HOST | localhost (db in compose) | Database host |
MYSQL_PORT | 3306 | Database port |
MYSQL_DATABASE | wordpress | Database name |
MYSQL_USER | wordpress | Database user |
MYSQL_PASSWORD | Database password | |
MYSQL_ROOT_PASSWORD | root | Root password of the compose db service only |
MYSQL_POOL_SIZE | 10 | Database connections pool size |
WP_TABLE_PREFIX | wp_ | WordPress' $table_prefix (also given to Flyway) |
JWT_SECRET | Secret signing the session tokens (openssl rand -base64 48) | |
GOOCOMMERCE_PASSWORD_HASH | bcrypt | Hash format written: bcrypt (WordPress 6.8+) or phpass (older WordPress) |
GOOCOMMERCE_ACTIVATION_MODE | auto | New accounts: auto (active immediately, like WooCommerce), email (confirmation link) or admin (approval by an administrator) |
GOOCOMMERCE_CONFIRMATION_EMAIL_EXPIRATION | 24 | Validity of the confirmation and reset password links, in hours |
GOOCOMMERCE_API_URL | http://localhost:8080 | Public URL of the API (also given to the UI container) |
GOOCOMMERCE_UI_URL | http://localhost:3000 | Public URL of the UI (links in the emails, OIDC redirection) |
GOOCOMMERCE_SHOP_URL | GOOCOMMERCE_UI_URL | Public URL of the storefront (permalinks, canonical links, sitemap) |
GOOCOMMERCE_UI_INTERNAL_URL | http://ui | Where the API fetches the UI's index.html for the SEO rendering |
GOOCOMMERCE_API_INTERNAL_URL | http://api:8080 | UI container only: the API URL nginx proxies the SEO pages, sitemap.xml and robots.txt to |
GOOCOMMERCE_CORS_ENABLED | false | Enables the CORS headers |
GOOCOMMERCE_CORS_ALLOWED_ORIGINS | * | Comma separated allowed origins |
GOOCOMMERCE_UPLOADS_DIR | Uploads folder (wp-content/uploads) inside the container | |
GOOCOMMERCE_UPLOADS_URL | API URL + /v1/media | Public URL of the uploads folder |
GOOCOMMERCE_MAX_IMAGE_SIZE | 2097152 (2 MiB) | Maximum size of an uploaded image, in bytes |
GOOCOMMERCE_MAX_UPLOAD_SIZE | 10485760 (10 MiB) | Maximum size of an uploaded file, in bytes |
GOOCOMMERCE_API_ONLY | false | API only mode (AI agent for an unchanged WooCommerce) |
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_ID | Google sign-in client id | |
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_SECRET | Google sign-in client secret | |
GOOCOMMERCE_OIDC_GITHUB_CLIENT_ID | GitHub sign-in client id | |
GOOCOMMERCE_OIDC_GITHUB_CLIENT_SECRET | GitHub sign-in client secret | |
GOOCOMMERCE_OIDC_KEYCLOAK_BASE_URL | Keycloak realm base URL | |
GOOCOMMERCE_OIDC_KEYCLOAK_CLIENT_ID | Keycloak client id | |
GOOCOMMERCE_OIDC_KEYCLOAK_CLIENT_SECRET | Keycloak client secret | |
GOOCOMMERCE_OIDC_KEYCLOAK_GROUPS | Comma separated Keycloak groups allowed to sign in | |
CWCLOUD_API_URL | https://api.cwcloud.tech | CWCloud API (override it for another CWCloud tenant) |
CWCLOUD_API_KEY | CWCloud API key for the emails and the contact form | |
CWCLOUD_CONTACT_FORM_ID | CWCloud contact form id | |
GOOCOMMERCE_MAIL_FROM | noreply@cwcloud.tech | Sender of the emails |
DISCORD_TOKEN | Discord webhook {id}/{token} (blank or changeit disables it) | |
GOOCOMMERCE_IPINFO_TOKEN | Optional ipinfo token to geolocate the visitors' IPs (audit and IP bans) | |
GOOCOMMERCE_OTEL_ENDPOINT | OTLP collector (e.g. otel-collector:4317), empty disables OpenTelemetry | |
GOOCOMMERCE_OTEL_PROTO | otlp/grpc | OTLP protocol |
GOOCOMMERCE_AI_DOWNLOAD_DIR | storage | Folder of the files generated by the AI assistant |
GOOCOMMERCE_AI_DOWNLOAD_TTL | 30m | Lifetime of a generated file's download link |
GOOCOMMERCE_AI_DOWNLOAD_MAX_BYTES | 26214400 (25 MiB) | Maximum size of a generated file |
GOOCOMMERCE_AI_DOWNLOAD_SWEEP_INTERVAL | 5m | Interval of the expired files cleanup |
GOOCOMMERCE_MANIFEST_PATH | manifest.json | Build manifest (version, sha) |
APP_VERSION | 1.0.0 | Version reported when there's no manifest |
APIβ
The API is documented by itself: the Swagger UI is at the API root (http://localhost:8080/) and the OpenAPI 3 document, with the payloads and the query parameters, at /openapi.json.
- Base path
/v1, JSON in and out. - Authentication:
Authorization: Bearer <jwt>(fromPOST /v1/users/login) orX-Api-Key: <api key>. - A 5xx error never carries its cause: the
X-Cidresponse header is the correlation id to give to the support.
API keysβ
Every user can create long-term API keys from their account (or with POST /v1/users/me/api-keys and a payload {"description": "...", "expiresAt": "..."}, the expiration being optional). The token is shown only once. Then:
curl -H "X-Api-Key: XXXXXX" http://localhost:8080/v1/admin/orders
MFAβ
From their account, the users can enable a TOTP application (scan the QR code, then confirm a code) and/or register YubiKeys or other WebAuthn security keys. The sign-in then asks for the second factor, OIDC included. An administrator can disable a user's MFA.
AI assistantβ
Any signed-in user can chat with an assistant which answers by calling goocommerce's own API with the user's own token: it can only see and do what the user is allowed to. It's guided by embedded Markdown skills describing the API, and it makes writes (creating a product, changing an order's status, a refund...) only after the user explicitly confirmed them. The accounting exports are available to it as tools: the generated PDFs are given back as temporary download links.
1/ Add a subscription in the AI settings of your account: a name, a provider (OpenAI, Anthropic, Mistral, Gemini, OpenRouter, DeepSeek or CWCloud), the API token, and optionally the model, the base URL and the max tokens.
2/ Optionally share it with other users (by email): they can use it in the chat without seeing its token. You can order your subscriptions, the first one is the default.
3/ Open the chat and ask, for example "What are my 5 best selling products this month?" or "Export the grand livre of 2025".
Note: a CWCloud subscription goes through the CWAI prompt API, which can't call tools: the assistant then answers without reading your shop's data and says so.
Use goocommerce from CWCloud (CWAI external adapter)β
goocommerce exposes its AI subscriptions to CWCloud as a CWAI external adapter at POST /v1/ai/cwcloud/adapter. Like that, you can use the goocommerce agent from the CWCloud chat, the CWAI API or the serverless engine.
1/ Create an API key in goocommerce (with a user having the rights you want to give to the agent).
2/ In CWCloud, add an external adapter with:
- the URL
https://<your goocommerce API>/v1/ai/cwcloud/adapter; - a custom header
X-Api-Keywith the goocommerce API key as value.
3/ Prompt it from CWCloud. The adapter accepts {"message": "..."} or {"messages": [{"role": "user", "message": "..."}]}; the adapter field picks the goocommerce subscription by name (the default one otherwise). It answers:
{
"status": "ok",
"message": "The answer in Markdown",
"usage": {
"prompt_tokens": 8,
"completion_tokens": 10,
"total_tokens": 18
}
}
You can test it directly:
curl -X POST "http://localhost:8080/v1/ai/cwcloud/adapter" \
-H "X-Api-Key: XXXXXX" -H "Content-Type: application/json" \
-d '{"message": "How many orders are waiting to be processed?"}'
Google sign-in (OIDC)β
1/ In the GCP console, create an OAuth client of type Web application (see the CWClock's screenshots, it's the same procedure).
2/ Add this authorized redirect URI: <API URL>/v1/oidc/google/callback, e.g. https://goocommerce-api.myshop.com/v1/oidc/google/callback.
3/ Set the variables on the API:
GOOCOMMERCE_UI_URL=https://myshop.com
GOOCOMMERCE_API_URL=https://goocommerce-api.myshop.com
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_ID=
GOOCOMMERCE_OIDC_GOOGLE_CLIENT_SECRET=
The "Sign in with Google" button then appears on the sign-in page. A Google account whose email matches an existing user signs in as that user, otherwise a customer account is created (following GOOCOMMERCE_ACTIVATION_MODE). The MFA still applies.
Emails and contact formβ
goocommerce sends its emails (the WooCommerce customer emails for the orders it changes, the confirmation and the reset password links) through the CWCloud email API, and forwards its contact form to a CWCloud contact form:
CWCLOUD_API_URL:https://api.cwcloud.techby default, override it for another CWCloud tenant;CWCLOUD_API_KEY: a CWCloud API key;CWCLOUD_CONTACT_FORM_ID: the CWCloud contact form id (the contact page is hidden when the contact form isn't configured);GOOCOMMERCE_MAIL_FROM: the sender of the emails.
Without them, goocommerce works anyway but sends no email.
Note: when WooCommerce runs alongside, it keeps sending its own emails for the orders it handles itself; goocommerce only sends the emails of the orders it changes, so a customer doesn't get them twice.
Observabilityβ
- Discord: set
DISCORD_TOKENto the{id}/{token}part of a Discord webhook URL (https://discord.com/api/webhooks/{id}/{token}). goocommerce posts a notice on the start of the API and on every user action (sign-up, sign-in, orders, back office changes, AI prompts with the tokens consumed...), and the 5xx errors with their correlation id. - OpenTelemetry: set
GOOCOMMERCE_OTEL_ENDPOINTto an OTLP collector (e.g.otel-collector:4317) to export the traces, logs and metrics. - Prometheus: the metrics are exposed in the OpenMetrics format at
/metrics(and/v1/metrics). GET /v1/health(liveness) andGET /v1/manifest(version and commit of the build).
Upgradingβ
git pull
docker compose up -d --build
The flyway service applies the new migrations before the API starts. Applied migrations are immutable: never edit a released V<n>__*.sql file (Flyway would refuse to migrate because of the checksum), the changes always come in a new, higher numbered file.
Back up the database before upgrading, especially when it's shared with WordPress.
Troubleshootingβ
- Flyway:
Validate failed: Migration checksum mismatch for migration version 1: theflyway_schema_historyrow 1 doesn't have the checksum1657541756, orV1__woocommerce_schema.sqlwas modified. Restore the original file and reruninit-existing-instance.sqlon a history that doesn't contain a wrong row 1. - Flyway runs V1 on an existing WooCommerce: Flyway's history was not initialised first. V1 uses
CREATE TABLE IF NOT EXISTS, so it doesn't break the existing tables, but initialise the history next time withinit-existing-instance.sql. - Flyway:
Public Key Retrieval is not allowed: addallowPublicKeyRetrieval=trueto the JDBC URL (anduseSSL=falseif the server has no TLS). Table 'wordpress.wp_...' doesn't exist:WP_TABLE_PREFIX(API) or-placeholders.table_prefix(Flyway) doesn't match your WordPress$table_prefix.- The WordPress users can't sign in to WordPress anymore after changing their password in goocommerce: your WordPress is older than 6.8 and can't check bcrypt hashes, set
GOOCOMMERCE_PASSWORD_HASH=phpass. - The images are broken: check that the uploads folder is mounted on
GOOCOMMERCE_UPLOADS_DIR, writable by the uid10001, and thatGOOCOMMERCE_UPLOADS_URLis the public URL of that folder. - No email is sent: check
CWCLOUD_API_KEYand that the email API is enabled on your CWCloud account. - The UI can't reach the API (CORS errors): set
GOOCOMMERCE_CORS_ENABLED=trueand add the UI's origin toGOOCOMMERCE_CORS_ALLOWED_ORIGINS. - A 5xx error: the response only says it's an internal error; look for its
X-Cidcorrelation id in the API logs (or the Discord alert) to get the cause.