¥99.90

One-time template price with installation and customization

One-click private deployment after purchase, details

Choose a payment method

Live preview
Version 1.0.0 Updated 11/26/2026 0 downloads · 0 deployments Retail

Deployment Guide

DigitalAssetMall deploys as one container named app, exposed on port 8080, with all state in a single volume at /app/data holding the SQLite database and the uploaded files. The upload package already contains the build artifacts, so the image only runs; it does not install and does not compile. There is no worker and no second service.

1. Five-minute deployment

Item Requirement
Docker 20.10 or newer, with the docker compose subcommand available
Resources 0.5 CPU, 1 GB memory, 20 GB disk, matching the deployment manifest
Port Host port 8080 free
Replicas Exactly 1; a single SQLite file plus a local upload directory rules out more
docker compose up -d

Open http://localhost:8080. On a real deployment the login page has only account, password and sign-in, with no demo identity buttons; sign in with the seeded owner admin@example.com and Admin@123456 to land in the seller back office at /admin/dashboard.

The first start runs migrations, creates tables, writes default parameters and seeds demo data (16 assets, 23 orders, 3 complaints and so on). Demo data is only written into an empty database, so deleting the volume and starting again resets everything.

Acceptance after start-up: sign in as the owner, open Members and create an account, choosing the ordinary member post, note the one-time password that appears only once, sign out, then sign in with that account. It should be intercepted by the change-password page, and the workbench should open only after the password is changed.

Before going live: change JWT_SECRET to a random string of 32 characters or more (see section 4), change the default password of admin@example.com and deal with the 14 demo member accounts that share Demo@123456, then set your own store name, blurb, support contact and refund policy in Store Settings.

2. Container responsibilities

Container Image source Listens on Public Role
app Dockerfile 8080 Yes, with the domain or port reverse-proxied to it Business API, static hosting of the front-end build, and the runtime /config.js
  • The port agrees in three places: Dockerfile (ENV PORT=8080 and EXPOSE 8080), docker-compose.yml (host mapping and environment.PORT both 8080), and intematrix.deploy.json (mode: single, container app, port 8080).
  • The image holds three things: /app/server for the backend build, /app/public for the front-end build, and /app/drizzle for the migration SQL. /app/data is the mounted volume.
  • The start command is fixed at bun server/index.js; the image never runs bun install or vite build.
  • The platform starts one container from intematrix.deploy.json and probes /api/health with a 60-second timeout, while docker compose probes http://localhost:8080/api/health inside the container every 30 seconds.
  • Dockerfile.source is a multi-stage source build and is only for self-hosted debugging; the upload package uses the root Dockerfile.

3. How front end and back end meet

The front end uses HashRouter, so pages live under #/... and no server-side deep-link fallback is needed. Apart from /api/*, /upload/* and /config.js, every path is answered with a static file by app.

Runtime configuration arrives through GET /config.js, not through a build-time constant:

Key Production deployment Hosted preview
apiMode http mock
apiBase /api /api
  • index.html loads ./config.js in its very first block, so the API address is settled before the application starts.
  • The generated file assigns the global window.__IMX_CONFIG__, an object with exactly two keys, apiMode and apiBase.
  • In the container that file is generated by the backend from environment variables: PUBLIC_API_MODE, default http, emitting mock only when set to mock, and PUBLIC_API_BASE, default /api. The response carries cache-control: no-store, so a restart is enough to apply a change.
  • The front-end build ships its own static config.js with http as the default, and the container overwrites it. One production build serves both deployment and the hosted preview, so no separate mock build is needed; the API mode depends only on the apiMode value served by /config.js.
  • For a temporary demo, set PUBLIC_API_MODE=mock, restart, and set it back to http with another restart afterwards.
  • Both index.html and /config.js are treated as no-store, so a redeployment never serves stale chunks from cache.

4. Environment variables

Variable Default Meaning
NODE_ENV production Runtime environment; in production mode a changed super admin password is never overwritten from the environment
PORT 3000, and 8080 inside the image and compose Port the container listens on
BIND_HOST 0.0.0.0 Bind address, injected by the platform from the manifest
PUBLIC_DIR /app/public Front-end build directory
DB_DRIVER sqlite sqlite, mysql or postgres
DATABASE_URL /app/data/sqlite.db SQLite file path, or a connection string for MySQL and PostgreSQL
UPLOAD_DIR /app/data/uploads Upload directory, which must live on the volume
MIGRATIONS_DIR /app/drizzle inside the image Migration SQL directory
JWT_SECRET dev-secret-change-me Must be changed before going live to a random string of 32 characters or more
LOG_LEVEL info debug, info, warn or error
CORS_ORIGIN * Leave as is for same-domain deployment; tighten it when front end and API sit on different domains
STORAGE_DRIVER local Local disk; s3 and oss are placeholders that are not wired up
MAIL_PROVIDER and MAIL_FROM console and no-reply@example.com Mail prints to the log by default
SMS_PROVIDER console SMS prints to the log by default
RATE_LIMIT_LOGIN_PER_MINUTE 30 Sign-in and registration rate limit per IP per minute; 0 or lower disables it
WS_TICKET_TTL_SEC 60 Lifetime of the one-time WebSocket ticket, in seconds
SUPER_ADMIN_EMAIL, SUPER_ADMIN_NAME and SUPER_ADMIN_PASSWORD admin@example.com, the seeded owner display name, and Admin@123456 Owner account created on first start; only used when the account is missing, or aligned in development
PUBLIC_API_MODE and PUBLIC_API_BASE http and /api Front-end API mode and request prefix
MALL_DOWNLOAD_SECRET Falls back to JWT_SECRET Signing key for download tickets; setting it separately is recommended
MALL_OFFLINE_PAYEE The seeded demo store name with support WeChat pixel-studio Payee shown to buyers for offline payment
MALL_OFFLINE_QR_IMAGE Empty Payment QR image for offline collection, either an /upload/... path or an external URL
MALL_NOTIFY_BASE_URL Empty Base URL prefix for merchant async notifications, for example https://shop.example.com
WECHAT_PAY_MCH_ID, WECHAT_PAY_APP_ID and WECHAT_PAY_SERIAL_NO Empty WeChat Pay APIv3 merchant details
WECHAT_PAY_PRIVATE_KEY, WECHAT_PAY_API_V3_KEY and WECHAT_PAY_PLATFORM_CERT Empty WeChat Pay private key, APIv3 key and platform certificate; PEM text, with \n escapes supported
ALIPAY_APP_ID, ALIPAY_PRIVATE_KEY and ALIPAY_PUBLIC_KEY Empty Alipay Open Platform application details
AI_PROVIDER, AI_API_KEY, AI_BASE_URL, AI_MODEL and AI_CAPABILITIES openai and empty Optional, used by the /api/ai endpoints; the template's business logic does not depend on them

Three things you need to know:

  • Do not half-fill payment credentials. Incomplete WECHAT_PAY_* or ALIPAY_* groups switch the channel off automatically: readiness is false, the API returns 409, and the storefront never shows it as available. To turn one on, supply the merchant ID, private key, APIv3 key, platform certificate and the callback URL prefix together.
  • Rotating JWT_SECRET has consequences. It signs both login tokens and download tickets unless MALL_DOWNLOAD_SECRET is set separately. After a change, old tokens stop working and users sign in again, and every issued download link is invalidated and can simply be fetched afresh. No data is lost.
  • compose only passes through variables listed under environment. JWT_SECRET, PUBLIC_API_MODE, SUPER_ADMIN_PASSWORD and payment credentials must be written into the environment block of docker-compose.yml or injected by the platform; a line in .env alone never reaches the container. BIND_HOST is a bind address, so build absolute links from MALL_NOTIFY_BASE_URL.

5. Local development, which is not deployment

bun install
bun run dev:api     # http://127.0.0.1:3000
bun run dev:web     # http://localhost:5173
  • Vite proxies /api and /upload to 127.0.0.1:3000; when 3000 is taken, set API_PORT or VITE_API_PROXY.
  • The local front end reads apps/web/public/config.js, which is http; use bun run dev:mock to force in-memory demo data. bun run mall:db creates tables and seeds demo data without starting a server.
  • Development uses 3000 for the API and 5173 for the front end; deployment only ever uses 8080. Listing, screenshots and acceptance all assume 8080, so never put 5173 in a link you hand to a client.

6. Data and backup

  • Everything mutable lives in /app/data: sqlite.db with its WAL companions, plus uploads/ for previews, agreement attachments and asset packages.
  • docker-compose.yml already declares the named volume app-data; a bare docker run needs an explicit -v. Recreating the container or swapping the image keeps the data as long as the volume survives, and deleting the volume wipes the database, which is reseeded on the next start.
  • Schema and initial data are topped up automatically at start, idempotently, and existing rows are never overwritten.
docker compose stop app
docker cp "$(docker compose ps -q app)":/app/data/sqlite.db ./mall-backup-$(date +%F).db
docker cp "$(docker compose ps -q app)":/app/data/uploads ./mall-uploads-backup
docker compose start app

To restore: stop the container, copy sqlite.db and uploads/ back, removing the stale -wal and -shm files, start it and confirm with /api/health. There are two export routes on the business side as well: "Export CSV" on the order list, capped at 1000 rows, and searchable, filterable certificate ledger and download record pages. Orders, certificates and download records have no delete endpoint, which makes them the ledger that survives even without a backup.

7. Reverse proxy and HTTPS

Describe a server block that terminates TLS and proxies everything to the container:

Directive Value and note
listen 443 ssl
server_name shop.example.com, the domain the proxy answers on
client_max_body_size 128m; the admin upload limit defaults to 100 MB, so raise this or large files meet 413
location / with proxy_pass http://127.0.0.1:8080
proxy_set_header Host $host and X-Real-IP $remote_addr
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for and X-Forwarded-Proto $scheme
  • HTTPS terminates at the proxy; inside the container it stays plain http. X-Forwarded-For must be forwarded, because download records and login logs take the IP from that header's first value and otherwise only see the proxy's internal address.
  • Do not cache index.html or /config.js; hashed static assets may be cached for a long time.
  • Keep CORS_ORIGIN at * for same-domain deployment. When front end and API sit on different domains, tighten it to the exact origin and set PUBLIC_API_BASE to the full address.

8. Upgrading

# 1. Back up first, this matters
docker compose stop app
docker cp "$(docker compose ps -q app)":/app/data/sqlite.db ./pre-upgrade.db
docker compose start app

# 2. Rebuild the image from the new package and restart
docker compose up -d --build

# 3. Prove it
curl -s http://127.0.0.1:8080/api/health
  • Migrations run automatically when the container starts, idempotently, and only move forward; back up before crossing a major version.
  • Upgrading an existing database to 1.2.0. The migration 0003_users_must_change_password runs automatically at start-up and adds the must_change_password column to users, with all three dialects covered: sqlite, mysql and postgres. No manual migration is needed. After the upgrade, the owner resets passwords in Members to issue fresh one-time passwords, and each affected person is intercepted by the change-password page on the next sign-in.
  • The app-data volume survives image and package swaps. A platform deployment replaces the image or re-uploads the package with the same effect.
  • After an upgrade, check version and features in /api/health, then open one screen of the storefront and one of the back office.

9. Troubleshooting

Symptom Likely cause What to do
8080 does not open Container not running, port taken, image not built docker compose ps and docker compose logs app; map a different host port
Health check stays unhealthy Migration failed, /app/data not writable, PUBLIC_DIR wrong Read the logs; confirm the volume mount and permissions; run curl http://127.0.0.1:8080/api/health by hand
Blank page or chunk 404 Browser cached an old index.html, or assets are missing from the image Hard refresh; confirm /app/public/index.html and assets/ are present in the image
The site opens on mock demo data PUBLIC_API_MODE=mock was left in the container Set it back to http and restart; confirm with curl /config.js
Login returns 401 Wrong password, disabled account, or a rotated JWT_SECRET invalidating old tokens Recreate the buyer from the owner account; check account status; fix the secret and sign in again
Owner signs in but cannot reach the back office The account lacks the super_admin role Change the account's post to Super Administrator in Members
Upload fails or returns 413 Proxy limit, or the file exceeds 100 MB Raise client_max_body_size; split very large assets into volumes
Images or attachments return 404 UPLOAD_DIR is not on the volume, or the proxy blocks /upload Keep the default /app/data/uploads; let the proxy pass /upload/
An asset file link returns 403 Normal: this is the paid-file anti-leech rule, and any /upload/... request matching an asset file is refused Not a fault; fetch a single-use signed link through Download asset on the order page
Download returns 429 or 410 Count exhausted, the 10-minute link expired, or the order passed its download window, 7 days by default Reset the download counter in the back office, which writes an order note, or have the buyer fetch a new link
Download says the link does not match the order user The link was forwarded, or opened under another account Fetch it again while signed in as the ordering account
"Confirm receipt" returns 409 The order is on an online channel, WeChat Pay or Alipay Online channels must wait for the signed callback; check the channel field on offline orders
Verification cannot find a certificate, or shows it voided Wrong number, wrong entity, unpaid order, or voided by a refund, an upgrade or a complaint takedown Search the certificate ledger by number; the void reason is on the certificate detail
Migration fails DB_DRIVER does not match the connection string, or the migration directory is missing Confirm /app/drizzle exists in the image and the dialect matches DATABASE_URL
Demo data reappears after a restart An empty volume, or the volume was deleted Demo data is only written into an empty database; in production change the passwords and clean up the demo records

10. Packaging for upload

bun run build          # front-end production build plus backend artifacts
bun run check:dist     # must report the dist API mode as http
bun run pack           # build the upload package, written next to the project by default
bun run verify:upload  # self-check must be all green, 33 items for a single container
  • bun run build produces apps/web/dist and apps/api/out/index.js; bun run check:dist reads apiMode from apps/web/dist/.build-meta.json and prints the dist mode, failing immediately when it is not http.
  • Do not run bun run build:mock. That build is for local demos without a backend and must never go into an upload package.
  • bun run pack writes digital-asset-mall-platform-upload.zip, and you can pass an output path. bun run verify:upload checks item by item: Dockerfile at the package root, a complete front-end build with resolvable assets, dist/config.js inside the package, the backend artifact, the migration SQL, compose ports agreeing with 8080, the manifest mode: single and its port, the packaged docs (the four Chinese files declared in docs/docs.json plus the four English .mdx files under docs/en/, and docs/rag.json bilingual with a schemaVersion on every language block), the slug digitalassetmall in conversation.seed.json matching the manifest, and anything that should not have been uploaded.
  • The package must contain apps/web/dist built in http mode, apps/api/out/index.js, apps/api/drizzle, Dockerfile, docker-compose.yml, intematrix.deploy.json, docs/ with docs.json, rag.json, the four Chinese files and the four under en/, conversation.seed.json and package.json. The version is 1.2.0 throughout: version in package.json and templateVersion in conversation.seed.json must match, so change both together.
  • The package must not contain node_modules, data/, a real .env, logs or a local .db file.

11. Redeploying after custom development

bun install            # only needed when dependencies changed
bun run check && bun test
bun run build
bun run check:dist
docker compose up -d --build
  • Schema changes: run bun run db:generate in apps/api first, confirm the SQL landed in apps/api/drizzle/ under the right dialect, and the container applies it at start.
  • Front-end changes: run bun run build and rebuild the image; the image runs artifacts, so editing source alone never takes effect.
  • Changes to the config.js logic: confirm it still emits from environment variables, which is what makes one build serve deployment and preview, and re-check with curl /config.js inside the container.
  • Never delete the data volume; before handing the package to a client, run the packaging and self-check from section 10 once more.

12. Domain and port conventions

  • The same template gets deployed many times, so never hard-code a domain, callback address or absolute link; build links from MALL_NOTIFY_BASE_URL or the proxy domain.
  • There is exactly one port value: 8080. It is fixed inside the container, and only the host side of the mapping may be changed through PORT.
  • Bind the domain in the proxy server_name; the container listens on 0.0.0.0:8080 only. Storefront, buyer centre and back office share the domain and port at /, /console and /admin, and with HashRouter a real address looks like https://shop.example.com/#/admin/dashboard.
  • Development ports, 3000 and 5173, belong on your machine only and must not appear in delivery documents or acceptance screenshots.

13. Proving health

curl -s http://127.0.0.1:8080/api/health
Field Expected
status ok, meaning the process is alive
version 1.2.0
startedAt When the process started, the first thing to check when a change seems not to apply
features 35 entries covering login, realtime, uploads, logs, monitoring, configuration, entities, storefront, buyer centre, back office and the delivery chain, including mall.download.sign, mall.download.deliver and mall.certificate.issue
  • If a capability you expect is missing from features, the old image is still running.
  • To confirm the pages are talking to the real API, check that curl -s http://127.0.0.1:8080/config.js outputs apiMode as http.
  • Every port, path and command in this guide assumes the single-container 8080 shape: one container app, manifest mode: single, one volume at /app/data, one replica.

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.

部署 API Key

用于「一键部署」与部署 Skill/脚本;明文经服务端 RSA 加密后由本页解密,不会明文出网。

你的 API Key(前缀 )
配置环境变量 INTEMATRIX_DEPLOY_APIKEY
export INTEMATRIX_DEPLOY_APIKEY=imd_xxx

macOS/Linux 追加到 ~/.zshrc 或 ~/.bashrc 可持久化;Windows 的 setx 需重开终端生效。

重置后旧 Key 立即失效;请勿把 Key 写进前端代码或提交到仓库。