¥99.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewDeployment 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=8080andEXPOSE 8080),docker-compose.yml(host mapping andenvironment.PORTboth 8080), andintematrix.deploy.json(mode: single, containerapp, port8080). - The image holds three things:
/app/serverfor the backend build,/app/publicfor the front-end build, and/app/drizzlefor the migration SQL./app/datais the mounted volume. - The start command is fixed at
bun server/index.js; the image never runsbun installorvite build. - The platform starts one container from
intematrix.deploy.jsonand probes/api/healthwith a 60-second timeout, whiledocker composeprobeshttp://localhost:8080/api/healthinside the container every 30 seconds. Dockerfile.sourceis a multi-stage source build and is only for self-hosted debugging; the upload package uses the rootDockerfile.
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.htmlloads./config.jsin 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,apiModeandapiBase. - In the container that file is generated by the backend from environment variables:
PUBLIC_API_MODE, defaulthttp, emitting mock only when set tomock, andPUBLIC_API_BASE, default/api. The response carriescache-control: no-store, so a restart is enough to apply a change. - The front-end build ships its own static
config.jswithhttpas 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 theapiModevalue served by/config.js. - For a temporary demo, set
PUBLIC_API_MODE=mock, restart, and set it back tohttpwith another restart afterwards. - Both
index.htmland/config.jsare treated asno-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_*orALIPAY_*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_SECREThas consequences. It signs both login tokens and download tickets unlessMALL_DOWNLOAD_SECRETis 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. composeonly passes through variables listed underenvironment.JWT_SECRET,PUBLIC_API_MODE,SUPER_ADMIN_PASSWORDand payment credentials must be written into theenvironmentblock ofdocker-compose.ymlor injected by the platform; a line in.envalone never reaches the container.BIND_HOSTis a bind address, so build absolute links fromMALL_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
/apiand/uploadto127.0.0.1:3000; when 3000 is taken, setAPI_PORTorVITE_API_PROXY. - The local front end reads
apps/web/public/config.js, which ishttp; usebun run dev:mockto force in-memory demo data.bun run mall:dbcreates 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.dbwith its WAL companions, plusuploads/for previews, agreement attachments and asset packages. docker-compose.ymlalready declares the named volumeapp-data; a baredocker runneeds 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-Formust 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.htmlor/config.js; hashed static assets may be cached for a long time. - Keep
CORS_ORIGINat*for same-domain deployment. When front end and API sit on different domains, tighten it to the exact origin and setPUBLIC_API_BASEto 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_passwordruns automatically at start-up and adds themust_change_passwordcolumn tousers, 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-datavolume survives image and package swaps. A platform deployment replaces the image or re-uploads the package with the same effect. - After an upgrade, check
versionandfeaturesin/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 buildproducesapps/web/distandapps/api/out/index.js;bun run check:distreadsapiModefromapps/web/dist/.build-meta.jsonand prints the dist mode, failing immediately when it is nothttp.- 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 packwritesdigital-asset-mall-platform-upload.zip, and you can pass an output path.bun run verify:uploadchecks item by item:Dockerfileat the package root, a complete front-end build with resolvable assets,dist/config.jsinside the package, the backend artifact, the migration SQL, compose ports agreeing with 8080, the manifestmode: singleand its port, the packaged docs (the four Chinese files declared indocs/docs.jsonplus the four English.mdxfiles underdocs/en/, anddocs/rag.jsonbilingual with aschemaVersionon every language block), the slugdigitalassetmallinconversation.seed.jsonmatching the manifest, and anything that should not have been uploaded.- The package must contain
apps/web/distbuilt inhttpmode,apps/api/out/index.js,apps/api/drizzle,Dockerfile,docker-compose.yml,intematrix.deploy.json,docs/withdocs.json,rag.json, the four Chinese files and the four underen/,conversation.seed.jsonandpackage.json. The version is1.2.0throughout:versioninpackage.jsonandtemplateVersioninconversation.seed.jsonmust match, so change both together. - The package must not contain
node_modules,data/, a real.env, logs or a local.dbfile.
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:generateinapps/apifirst, confirm the SQL landed inapps/api/drizzle/under the right dialect, and the container applies it at start. - Front-end changes: run
bun run buildand rebuild the image; the image runs artifacts, so editing source alone never takes effect. - Changes to the
config.jslogic: confirm it still emits from environment variables, which is what makes one build serve deployment and preview, and re-check withcurl /config.jsinside 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_URLor 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 on0.0.0.0:8080only. Storefront, buyer centre and back office share the domain and port at/,/consoleand/admin, and with HashRouter a real address looks likehttps://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.jsoutputsapiModeashttp. - Every port, path and command in this guide assumes the single-container 8080 shape: one container
app, manifestmode: 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.
