¥149.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewDeployment Guide
For buyers and delivery teams: everything from unpacking the upload package to a running system, with every command in one place. Target: a cloud host or an in-house machine that can run Docker, one container, port 8080 exposed.
- Version: 1.2.0 (slug
garmentflow) - Shape: single container (
intematrix.deploy.json:mode: single,port: 8080) - Health check:
GET /api/health(returns afeaturescapability list andstartedAt) - Data directory:
/app/data(sqlite.dbplusuploads) — a volume is mandatory - Local development:
bun run dev(api 3000, web 5173)
1. Five-minute deploy (docker compose, recommended)
After unpacking, the package already contains build artifacts (apps/web/dist and apps/api/out). The image only runs artifacts — it never installs or builds — so the first start only pulls the base image.
1.1 Decide three things first
Read this first: the shipped docker-compose.yml passes only six variables into the container (NODE_ENV, PORT, PUBLIC_DIR, DB_DRIVER, DATABASE_URL, UPLOAD_DIR). It does not pass JWT_SECRET or SUPER_ADMIN_*, so export on the host alone will not reach the container. Add them to the compose environment: block first (that is deployment configuration, not a code change).
Open docker-compose.yml and add four lines under environment: (keep the existing six):
environment:
# …keep NODE_ENV / PORT / PUBLIC_DIR / DB_DRIVER / DATABASE_URL / UPLOAD_DIR…
JWT_SECRET: ${JWT_SECRET:?set JWT_SECRET first} # fails fast instead of shipping the default secret
SUPER_ADMIN_EMAIL: ${SUPER_ADMIN_EMAIL:-}
SUPER_ADMIN_NAME: ${SUPER_ADMIN_NAME:-}
SUPER_ADMIN_PASSWORD: ${SUPER_ADMIN_PASSWORD:-}
Then set the values, unpack and start:
# 1. Unpack (the unpacked directory is the build context)
unzip garmentflow-upload.zip -d garmentflow && cd garmentflow
# 2. Generate a random JWT secret (never ship the default dev-secret-change-me)
export JWT_SECRET="$(head -c 48 /dev/urandom | base64)"
# 3. Set the owner account (created on first start only; unset means admin@example.com / Admin@123456)
export SUPER_ADMIN_EMAIL="you@your-company.com"
export SUPER_ADMIN_PASSWORD="a strong password of your own"
export SUPER_ADMIN_NAME="Your Name"
PowerShell equivalent:
$env:JWT_SECRET = [Convert]::ToBase64String((1..48 | ForEach-Object { Get-Random -Max 256 }))
$env:SUPER_ADMIN_EMAIL = "you@your-company.com"
$env:SUPER_ADMIN_PASSWORD = "a strong password of your own"
If you would rather not edit docker-compose.yml, put the four variables in a docker.env file and add env_file: docker.env to the service. Either way, the variables must actually reach the container.
The owner account is only created on first start: adding SUPER_ADMIN_* after the database exists neither creates a new account nor changes an existing password. Change a password by signing in, or reset it through the member endpoint.
1.2 Start it
docker compose up -d
Then open http://localhost:8080 — the public site (visible without signing in).
# Container status
docker compose ps
# Follow logs (first start runs migrations, creates tables and seeds; wait for the seed lines)
docker compose logs -f app
# Health check (proves which backend is running)
curl -s http://127.0.0.1:8080/api/health
docker-compose.yml already mounts the app-data volume at /app/data, maps port 8080:8080 by default (the file says ${PORT:-8080}:8080; do not set the PORT environment variable to anything else or the host mapping drifts), and ships a 30-second health check. Do not remove the volume, or a container rebuild wipes your data.
1.3 First-60-seconds checklist
http://YOUR-HOST:8080/loads and shows the twelve-section public page;GET /api/healthreturnsstatus: ok,version: 1.2.0, andfeaturesincludesgarment.ordersandgarment.quality;/loginaccepts the owner account (the production build does not render the demo identity panel — that is expected);- After signing in you land on
/console, and the sidebar shows six business groups plus System; http://YOUR-HOST:8080/console/system/memberslists members (super admin only);docker compose exec app ls -la /app/datashowssqlite.db.
2. What the container does
One container, three jobs, all on 8080:
| Job | Detail |
|---|---|
| Static hosting | Elysia's static plugin serves /app/public (= apps/web/dist) at /. index.html is sent with no-store so a redeploy never serves stale HTML pointing at deleted hash chunks |
| Runtime config | GET /config.js is answered before route matching (onRequest), so environment variables win over the copy of config.js inside dist |
| REST API | Everything under /api: /api/health, /api/auth/*, /api/users/*, /api/app/identity, /api/garment-flow/*, /api/system-config, /api/upload and more. Swagger UI at /docs |
Start-up hook (idempotent, runs on every boot):
- Run migrations for the configured dialect (
MIGRATIONS_DIR,/app/drizzlein the image); - Create the default tenant
t-defaultplus permission, role and menu seeds; - Create the owner from
SUPER_ADMIN_EMAIL,SUPER_ADMIN_NAMEandSUPER_ADMIN_PASSWORD(if the account exists, the password is checked); - Write system-config defaults, including
app.identity; - Create business tables (three dialects,
CREATE TABLE IF NOT EXISTS), seed demo data when the business tables are empty, then load the database into the in-memory domain engine; - Start infrastructure: rate limiter, queue, scheduler, metrics.
3. How the front end talks to the API: /config.js
The very first thing index.html loads is ./config.js, and it does exactly one job: tell the front end the apiMode and apiBase.
| Runtime value | Front-end behaviour | Who injects it |
|---|---|---|
apiMode=http |
Calls the real REST endpoints under /api/garment-flow/*; data goes to SQLite |
Production (the default) |
apiMode=mock |
Runs the domain engine in the browser, stores data in localStorage, supports one-click reset | The marketplace preview service |
- Override with the
PUBLIC_API_MODEenvironment variable (httpormock) andPUBLIC_API_BASE(default/api). apps/web/public/config.jsalso holds a static default (a marketplace scaffold requirement), but the container'sonRequesthandles/config.jsfirst, so environment variables win.- This is a runtime switch: restart the container after changing it, no rebuild needed. The build-time
VITE_API_MODEis a separate layer (the upload gate verifies the artifact ishttp, see section 10).
4. Environment variables
4.1 The ones that matter
| Variable | Default | Meaning |
|---|---|---|
PORT |
8080 (fixed inside the container) |
Listening port. Both the Dockerfile and intematrix.deploy.json say 8080; changing it breaks the platform health check and the port mapping |
BIND_HOST |
0.0.0.0 |
Listen address. Inside a container it must stay 0.0.0.0 to be reachable; use 127.0.0.1 only for a host-local trial |
JWT_SECRET |
dev-secret-change-me |
Signs and verifies JWTs. Change it in production; changing it invalidates issued tokens (users simply sign in again) |
SUPER_ADMIN_EMAIL |
admin@example.com |
Owner email created on first start |
SUPER_ADMIN_NAME |
Super Admin |
Owner display name |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
Owner password. Leaving it unset means a public password |
PUBLIC_API_MODE |
http |
Handed to /config.js: http for the real API, mock for the in-browser demo engine |
PUBLIC_API_BASE |
/api |
API prefix handed to /config.js; only change it if a reverse proxy rewrites the path |
4.2 Data and storage
| Variable | Default | Meaning |
|---|---|---|
DB_DRIVER |
sqlite |
sqlite, mysql or postgres. All three schemas and migration sets ship in the package, but only SQLite has been verified at runtime |
DATABASE_URL |
/app/data/sqlite.db (in the image) |
A file path for sqlite; a connection string for mysql or postgres |
UPLOAD_DIR |
/app/data/uploads |
Upload root; public URLs are /upload/... |
MIGRATIONS_DIR |
/app/drizzle (in the image) |
Migration directory, copied by the Dockerfile |
STORAGE_DRIVER |
local |
local writes to disk; s3 and oss are placeholder adapters, not implemented |
PUBLIC_DIR |
/app/public |
Front-end artifact directory, copied by the Dockerfile |
4.3 Runtime, logging and external services
| Variable | Default | Meaning |
|---|---|---|
NODE_ENV |
production (in the image) |
Only production serves the static front end |
LOG_LEVEL |
info |
debug, info, warn or error |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
Sign-in attempts per IP per minute; 0 or less disables it. Counters live in process memory and reset on restart |
MAIL_PROVIDER |
console |
console prints mail to the log; smtp and ses are not implemented |
MAIL_FROM |
no-reply@example.com |
Sender address |
SMS_PROVIDER |
console |
console prints to the log; aliyun and twilio are not implemented |
CORS_ORIGIN |
* |
Allowed cross-origin origin. Leave the default when front end and API share an origin |
WS_TICKET_TTL_SEC |
60 |
Lifetime of the one-time WebSocket ticket |
AI_CONFIG_SECRET |
none | Encryption secret (AES-256-GCM) for model keys stored from the console. Optional, but without it the console cannot store keys |
4.4 What the “demo data switch” is actually called
| Variable | Reality | Recommendation |
|---|---|---|
GARMENT_FLOW_DEMO |
Real, defaults to true. Controls whether the x-demo-role request header may switch demo roles (demo deployments and super admins) |
Set it to false in production so only the super admin can write |
DEMO_SEED |
Not implemented in this version: no code in the package reads this variable. Demo data is seeded when the business tables are empty on first start (an empty customers table triggers it) |
Do not rely on it; see section 10 for what to do instead |
Many similar templates use DEMO_SEED to control seeding. This template has no such implementation, and this document says so rather than pretending otherwise. Handle demo data and demo accounts as described in section 10.
5. Local development
# Requirements: Bun >= 1.4
bun install
# Both apps: front end 5173, API 3000
bun run dev
# Or one at a time
bun run dev:web # http://localhost:5173
bun run dev:api # http://127.0.0.1:3000, Swagger at /docs
- Under
bun run devthe front end defaults toVITE_API_MODE=mock(seeapps/web/.env.development): nothing to run in the background, data in localStorage. - To use the real API locally, run
bun run dev:http(apps/web/.env.httpsetshttp). - The Vite dev server proxies
/apitohttp://127.0.0.1:3000. - The two build modes are mutually exclusive:
bun run buildproduceshttpartifacts (apps/web/distplusapps/api/out/index.js), whilebun run build:mockproduces a mockapps/web/distonly. Keep exactly one before uploading.
Development ports 3000 and 5173 are unrelated to the deployment port 8080: the container only ever listens on 8080.
6. Data, backup and restore
6.1 Where the data is
| Content | Location | Detail |
|---|---|---|
| Business data (customers, styles, orders, plans, work orders, reports, inspections, rework, stock, shipments, employees) | the business tables inside sqlite.db |
Maintained as an in-memory mirror of the domain engine plus a full-table write-back |
| App identity (brand name, logo mark, accent colour, contact, ICP) | the system_config table inside sqlite.db, key app.identity |
There is no separate app-identity.json file, so do not go looking for one |
| Accounts, roles, permissions, logs, system config | other tables in the same sqlite.db |
One file |
| Uploaded files | /app/data/uploads (public /upload/...) |
Same directory tree as the database |
6.2 How to back up
The whole database and the upload directory live in /app/data. Stop the container and copy that directory.
# Option 1: stop, copy, start (safest, recommended)
docker compose stop app
docker compose cp app:/app/data ./backup-$(date +%Y%m%d-%H%M)
docker compose start app
# Option 2: back up the whole volume
docker run --rm -v garmentflow_app-data:/data -v "$PWD":/backup alpine \
tar czf /backup/garmentflow-data-$(date +%Y%m%d).tgz -C /data .
- Cadence: once a day with 30 days of retention is enough for most workshops. Take one manual copy before go-live and before every upgrade.
- Never keep the backup on the same disk as the database: one disk failure takes both.
6.3 How to restore
# 1. Stop the container
docker compose stop app
# 2. Put the backup back at the same path: /app/data (whole directory, or sqlite.db plus uploads)
docker compose cp ./backup-20260101-0900/. app:/app/data/
# 3. Start (migrations run on boot and bring an older schema up to date)
docker compose start app
6.4 The Backup and export page
The page under System → Backup and export gives executable instructions (which directory to copy, how often, how to restore, where reports live). It deliberately has no download button that does nothing: the browser cannot read server files, and a fake button is worse than none.
To get data out for analysis, use one of these:
# A. Export straight from the database file (business tables are named after the collections)
docker compose cp app:/app/data/sqlite.db ./sqlite.db
sqlite3 -header -csv ./sqlite.db \
'select "orderNo", status, "totalQty", "dueDate" from orders;' > orders.csv
# B. Export through the API (get a token after signing in)
curl -s -H "Authorization: Bearer $TOKEN" \
"http://127.0.0.1:8080/api/garment-flow/orders?page=1&pageSize=500"
Business tables: customers, styles, bom_items, materials, orders, production_plans, work_orders, work_order_steps, work_logs, stock_movements, quality_inspections, rework_records, finished_stocks, shipments, employees. Column names are camelCase, so quote them in SQL.
7. Reverse proxy and HTTPS
The container speaks plain HTTP on 8080. For a domain plus HTTPS, put a reverse proxy in front (Nginx, Caddy, or a cloud load balancer) and configure WebSocket upgrades and the upload size too:
server {
listen 443 ssl;
server_name your-domain.example; # your own domain
client_max_body_size 120m; # at least upload.maxSizeMb (default 100)
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# WebSocket one-time ticket channel
location /api/ws {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
- Add exactly one proxy layer and leave the container's
PORTalone. - The package hard-codes no domain, callback URL or private subnet; the domain is your proxy's decision.
- Behind HTTPS, keep
apiBaserelative (/api); no absolute URL is needed.
8. Upgrades
# 1. Back up (section 6, mandatory)
docker compose stop app && docker compose cp app:/app/data ./backup-before-upgrade
# 2. Replace the package or image and rebuild the container (the volume stays)
docker compose up -d --build
# Do not pass -v: that deletes the data volume
# 3. Verify
curl -s http://127.0.0.1:8080/api/health
Judge an upgrade by version and startedAt in /api/health. If startedAt did not change, the container did not restart and you are not looking at the new build. If a features entry is missing, the old backend is still running — redeploy, do not change code.
9. Troubleshooting
| Symptom | Most likely cause | Fix |
|---|---|---|
| Port 8080 is blank or 502 | Container not running, or a wrong port mapping | docker compose ps, docker compose logs --tail=200 app |
| Page loads but sign-in returns 401 | JWT_SECRET changed (old tokens invalid) |
Sign in again; make sure replicas do not use different secrets |
| Immediately pushed to the password page | mustChangePassword=true (issued one-time password or a reset) |
Change the password (at least 8 characters, different from the old one) |
Business endpoint returns 403 password_change_required |
Calling the API before changing the first password | Change it first; this is server-side enforcement, not a UI bug |
| Members page returns 403, no System menu | The account is not a super admin (only a business role) | Sign in with the SUPER_ADMIN_EMAIL account, or grant super_admin |
| Business endpoint returns 403 “current role may not perform this action” | The role lacks that action on that resource | Check the matrix in section 4 of the Permissions guide, or change the role |
| Upload returns 413 | Reverse proxy body size too small | Raise client_max_body_size to at least 120m |
| Uploaded image returns 404 | /app/data not on a volume, so a rebuild lost uploads |
Mount the volume and restore uploads from backup |
| Data “rolled back” to demo data | A fresh volume was used (docker compose down -v, or a new volume name) |
Restore the backup; never pass -v on upgrades |
| Chinese file names come back garbled | Client-side encoding on upload | The system stores UTF-8; check the client and proxy encoding |
| Clock is wrong | The container runs in UTC | Add TZ=Asia/Shanghai (or your zone) to the compose environment |
| Errors after switching to MySQL | Only SQLite has been verified | Run the full regression in section 11 first |
10. Demo data and demo accounts (before going live)
Demo data (customers, styles, materials, orders, plans, work orders, output reports, inspections, stock, shipments, employees) is seeded on first start when the business tables are empty. Four demo members are created too (merch@, prod@, store@, qc@garmentflow.local, password Garment@123456), and the owner comes from the environment variables (default admin@example.com / Admin@123456).
Three things to do before go-live (in this order):
Change the owner password. Add
SUPER_ADMIN_EMAILandSUPER_ADMIN_PASSWORDto the composeenvironmentblock as described in section 1.1 (a hostexportdoes not reach the container) and set them before the first start. If the system is already running, change the password right after signing in — editingenvironmentdoes not change an existing account's password.Handle the demo data. This version has no
DEMO_SEED-style seeding switch — seeding depends on thecustomerstable being empty, so:- Recommended: edit the demo documents into your real data (customers, styles, materials, orders) and keep at least one customer row. As long as
customersis not empty, later restarts do not re-seed. - To remove the samples entirely, delete in dependency order in the console (shipments, finished stock, rework, inspections, output reports, work-order steps, work orders, plans, orders, BOM, styles, customers). But once
customersbecomes empty, the next restart re-seeds. To keep an empty database empty you need a small code change: add an environment-variable check inapps/api/src/domain/engine-bridge.tsinsideready(), beforecreateDemoState(). - Do not delete
/app/data/sqlite.dbto “clean up”: an empty database simply re-seeds on boot, and you also lose the upload index.
- Recommended: edit the demo documents into your real data (customers, styles, materials, orders) and keep at least one customer row. As long as
Disable or delete the demo members under System → Members (
merch@,prod@,store@,qc@garmentflow.local). You cannot delete the account you are signed in with (422).
For production, also set GARMENT_FLOW_DEMO=false to turn off demo role switching through x-demo-role.
11. Switching database (MySQL or PostgreSQL)
Schemas and migrations for all three dialects ship in the package, so a switch is an environment change:
environment:
DB_DRIVER: postgres
DATABASE_URL: postgres://user:pass@db:5432/garmentflow
docker compose up -d --build
But note: only the SQLite runtime path has been verified. The MySQL and PostgreSQL schemas and migrations are complete but have not been run against a real database. Before switching, run your own full regression:
- First start against an empty database — check the logs for table-creation errors;
- Sign in, then walk one full storyline: customer and style, order, review, plan, split, report, inspect, stock in, ship;
- Restart the container and confirm the data is still there (the full-table write-back works);
- Confirm that the dashboard and report numbers match the documents.
12. Packaging for upload and redeploying after customisation
12.1 Gates and commands
# 1. Gates after your changes
bun run check # design, i18n, permissions, web and api types
bun test # domain conservation and overreach cases included
# 2. Production build (order matters: api bundle first, then the front end)
bun run build # produces apps/api/out/index.js and apps/web/dist (apiMode=http)
bun run check:dist # must report apiMode=http, otherwise the upload gate rejects it
# 3. Package and verify
bun run pack # writes the upload zip
bun run verify:upload # checks the package item by item
# The whole chain in one command
bun run pack:upload
The upload package must contain Dockerfile (running artifacts only), apps/web/dist/index.html, apps/api/out/index.js, apps/api/drizzle/**/*.sql, docs/** and conversation.seed.json. verify:upload checks those plus the marketplace rules: port consistency at 8080, every .md under docs/ declared in docs.json, and the length limits in rag.json.
12.2 Redeploy after customisation
bun run pack:upload # package and verify
docker compose down # no -v
docker compose up -d --build # rebuild the image, keep the volume
curl -s http://127.0.0.1:8080/api/health
13. Domain and address conventions
- The package hard-codes no domain, callback URL or private subnet:
intematrix.deploy.jsonhas nonetwork.subnetand no container uses a staticip, so the platform assigns them. - The reachable address is decided by the platform or your proxy, in the form
http(s)://YOUR-HOST:8080/. - The only fixed values in code are the container port 8080 and the API prefix /api.
14. Health check as proof: GET /api/health
curl -s http://127.0.0.1:8080/api/health
{
"status": "ok",
"service": "api",
"version": "1.2.0",
"features": [
"auth.login", "auth.me", "auth.change-password",
"users.list", "users.create", "users.roles", "users.reset-password",
"app.identity", "garment.bootstrap", "garment.orders", "garment.work-orders",
"garment.materials", "garment.issues", "garment.quality", "garment.finished-goods",
"garment.shipments", "garment.analytics", "garment.dashboard", "garment.actions"
],
"startedAt": "2026-01-01T00:00:00.000Z",
"timestamp": "2026-01-01T00:05:00.000Z"
}
Diagnosis order:
- A
featuresentry is missing → the running backend is old; redeploy (do not change code); - The capability is listed but the endpoint still 404s → that is a real code problem;
startedAtunchanged → the container did not restart, so you are not looking at the new build;versiondisagrees with the packagepackage.json→ image and documentation are mismatched.
15. Moving and uninstalling
- Move to another machine: back up
/app/data→docker compose up -don the new host → put the backup back at/app/data→ restart. No code change, no domain change. - Uninstall completely:
docker compose down -v(this deletes the data volume; back up first). - Reset to factory state: stop the container, empty
/app/data, start again (tables are recreated and demo data is re-seeded).
Frequently asked questions
- What do I get after purchase?
- The full source code (web frontend + API backend), deployment documentation and an online preview. After purchase you can download it from "My Projects" and use it for your own product.
- Can it be deployed to my own server?
- The Web + API edition supports one-click private deployment, so data stays on your own infrastructure. Mini-program and App add-on packages are not one-click deployable.
- Can I get a refund?
- Orders whose code package has not been downloaded can request a refund through a support ticket. Once the code package has been downloaded, refunds are not supported.
- How do I reach support?
- Open "My Projects" and click "Support" to submit a ticket. Staff reply inside the ticket, and status changes are pushed as WeChat notifications.
