¥129.89
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewStudioMemberLite · Deployment Guide
For buyers and operators: from the moment the upload package arrives until "open it and it works", plus upgrades, backups and troubleshooting — everything rests on one rule: a single container on port 8080, SQLite and local files under
/app/data, and the front-end mode injected at runtime by/config.js.
1. Five-Minute Deploy
# 1) Unzip the upload package (the directory name is up to you)
unzip studiomemberlite-upload.zip -d studiomemberlite && cd studiomemberlite
# 2) Start the container (the image already holds the build artifacts — no install / build needed)
docker compose up -d
# then open: http://localhost:8080
Once docker compose up -d has finished, open
http://localhost:8080 — that is the public homepage, and /api/health is the health self-check endpoint.
The first start creates the database, runs the migrations and writes the seed (default tenant, permissions, roles, menus, super admin, studio demo data) in about 3–5 seconds.
Signing in: staff use email + password (admin@example.com / Admin@123456, password change forced on first login); students use phone number + verification code
(before real SMS is wired up in production the code is printed to the container log — docker compose logs -f shows it).
The upload package does not contain
node_modules: the image only runsapps/api/out/index.js+apps/web/dist, which is why deployment is fast. When you need a rebuild, build in the source directory (see §9).
2. Container Responsibilities
| Container | Image | Port | Responsibility |
|---|---|---|---|
app |
Dockerfile (oven/bun:1.4) |
8080 (public, meta.deploy.port) |
One process serves all of it: the /api/** endpoints, the /config.js runtime config, /upload/** upload reads, and / plus static assets (apps/web/dist) |
| none | — | — | This template is single-container (meta.deploy.mode: single); there is no internal worker |
Directories inside the container:
| Path | Contents |
|---|---|
/app/server |
Back-end single-file bundle (out/index.js) |
/app/public |
Front-end static artifacts (dist) |
/app/drizzle |
Migration SQL (applied at startup) |
/app/data |
Persistent volume: sqlite.db + uploads/ (uploaded files) |
/app/datamust sit on a persistent volume, otherwise recreating the container loses the data.docker-compose.ymlalready declares theapp-datavolume.
3. How Front End and Back End Connect (config.js)
The front end does not have the API mode baked in at build time; index.html loads ./config.js first:
// apps/web/dist/config.js (default value inside the package; the fallback for static hosting)
window.__IMX_CONFIG__ = window.__IMX_CONFIG__ || { apiMode: "http", apiBase: "/api" };
After deployment this request is emitted live by the onRequest hook in apps/api from the environment variables (it wins over the static file):
| Environment variable | Value | Output |
|---|---|---|
PUBLIC_API_MODE |
unset / http (default) |
{"apiMode":"http","apiBase":"/api"} → real API |
PUBLIC_API_MODE |
mock |
{"apiMode":"mock",...} → demo data (for self-hosted demos) |
PUBLIC_API_BASE |
e.g. https://api.example.com |
The front end prefixes every request with it (used when front end and back end are reverse-proxied on separate domains) |
So: the same package is production (http) when deployed, and the marketplace online preview injects mock through the preview service — there is no need to produce two sets of artifacts.
Both GET / and /config.js are served with no-store, so a redeploy never hands out stale config or stale HTML.
4. Full Environment Variable Table
| Variable | Default | Notes |
|---|---|---|
PORT |
8080 |
Must match meta.deploy.port and compose; all three places agree |
BIND_HOST |
0.0.0.0 |
Listen address inside the container (injected by the platform — never hard-code a domain) |
NODE_ENV |
production (inside the image) |
In production static hosting is on and demo.reset is disabled |
PUBLIC_API_MODE |
http |
See §3 |
PUBLIC_API_BASE |
/api |
See §3 |
DB_DRIVER |
sqlite |
sqlite / mysql / postgres |
DATABASE_URL |
/app/data/sqlite.db |
Database file or connection string |
MIGRATIONS_DIR |
/app/drizzle |
Migration directory |
PUBLIC_DIR |
/app/public |
Front-end artifact directory |
UPLOAD_DIR |
/app/data/uploads |
Single upload directory (exposed as /upload/...) |
JWT_SECRET |
dev-secret-change-me |
Must be changed in production (32+ random characters); rotating it signs everybody out |
SUPER_ADMIN_EMAIL |
admin@example.com |
First platform super admin (= shop owner) |
SUPER_ADMIN_NAME |
Super Admin |
Super admin display name |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
Super admin initial password (change forced on first login) |
CORS_ORIGIN |
* |
Narrow it to the site domain when front end and back end are on separate domains |
LOG_LEVEL |
info |
debug / info / warn / error |
STORAGE_DRIVER |
local |
Object storage driver (s3 / oss are reserved adapters) |
MAIL_PROVIDER |
console |
Mail (printed to the log; smtp / ses reserved) |
MAIL_FROM |
no-reply@example.com |
Sender address |
SMS_PROVIDER |
console |
SMS (verification code printed to the log; aliyun / twilio reserved) |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
Login rate limit (per IP per minute; <=0 turns it off) |
WS_TICKET_TTL_SEC |
60 |
Lifetime of a one-time WebSocket ticket |
Cloud platforms inject
PORT/HOST/BIND_HOST/DEPLOYMENT_IDinto the container by default. Bind withBIND_HOST— never use theHOSTthe platform gives you (that is the public domain) as a bind address.
5. Local Development
bun install
bun run dev # web http://localhost:5173 + api http://localhost:3000 (front end in mock mode, data lives in the browser)
bun run dev:http # front end talks to the real API (start bun run dev:api first)
bun run dev:api # API only; Swagger at http://localhost:3000/docs
- 5173 / 3000 are development ports and have nothing to do with deployment; inside the container the
Dockerfilepins 8080. - In mock mode the data lives in
localStorageand never touches the database; Personal Center → Reset demo data (个人中心 → 重置演示数据) restores it. - Static preview without signing in:
http://localhost:5173/?mode=preview#/admin/dashboard(forces demo data).
6. Data and Backup
| Data | Location | How to back it up |
|---|---|---|
| Business database (SQLite) | /app/data/sqlite.db |
Stop the container and copy the whole of /app/data, or use the back office System Settings → Backup & Export (系统设置 → 备份与导出) to export the business JSON / members-and-cards CSV |
| Uploaded files | /app/data/uploads/ |
Same as above (the database and these files must be copied together to stay consistent) |
| Business state (members / cards / schedule / approvals / settlement) | The studio_state single document in the database |
The JSON from the back office Backup & Export is a full snapshot of the business data |
Restore: put the backed-up sqlite.db and uploads/ back into /app/data and restart the container (migrations fill in anything missing, idempotently).
Migrating to MySQL / PostgreSQL: set DB_DRIVER + DATABASE_URL; the image runs the migrations for that dialect at startup.
The back office Backup & Export deliberately provides no one-click restore button (a mis-click would overwrite live data). Restoring is an operator action; the commands and checks are described on that page.
7. Reverse Proxy and HTTPS
The container listens on 8080 only; put Nginx / Caddy in front of it to terminate TLS:
server {
listen 443 ssl;
server_name studio.example.com;
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;
}
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";
}
}
Same domain for front end and back end needs no PUBLIC_API_BASE change; on separate domains set PUBLIC_API_BASE=https://api.example.com in the container and narrow CORS_ORIGIN to the site domain.
8. Upgrade
docker compose down # stops the container only — never add -v (-v deletes the persistent volume)
# unpack the new package over the same directory (keep data/ or keep mounting the same volume)
docker compose up -d --build
# verify: http://localhost:8080/api/health
- Migrations are idempotent and are filled in automatically at startup;
- After an upgrade, first check that
featuresin/api/healthcontains the new capability names, then spot-check a page; - Front end and back end versions must be upgraded together: swapping only
distwithoutout/index.js(or the reverse) produces API 404s.
9. Packaging and Upload (Rebuilding the Package from Source)
v6 policy (production build, no mock):
bun run check # type check (web + api)
bun run check:i18n # bilingual gate (0 bare Chinese / 0 missing English)
bun test # all unit tests
bun run build # production build: dist (http) + out/index.js; writes dist/.build-meta.json
bun run check:dist # must print "dist mode: http" (per .build-meta.json)
bun run pack # → ../studio-member-lite-upload.zip (Python zipfile, UTF-8 filename flags for Chinese names)
bun run verify:upload # all 35 upload gates green
One command runs the lot: bun run pack:upload (order: check → check:i18n → test → build → check:dist → pack → verify).
Before packaging, confirm the package contains no: node_modules / data/ / logs / a local sqlite file / a real .env.
10. Redeploying After Customization
bun install
bun run build # produces dist + out/index.js
docker compose up -d --build # or deploy over the top as in §8
# verify: http://localhost:8080
When you change the business engine (apps/web/src/studio/engine/**) you must run bun run sync:engine before building,
otherwise the front end and the back end run different rules (this is the template's only manual sync point).
11. Domain Conventions
- The template itself hard-codes no domain: after deployment the platform assigns a domain per deployment id; inside the container use
HOST(public) andBIND_HOST(bind); - Every in-app link is relative (HashRouter +
base: './'), so the app also runs under a sub-path such as/studio/; - Uploaded files are served as relative
/upload/...paths, so changing the domain needs no data changes.
12. Health Self-Check (First Step in Troubleshooting)
curl -s http://localhost:8080/api/health
{ "status": "ok", "service": "api", "version": "1.0.0",
"features": ["auth.login", "staff.create", "studio.bootstrap", "booking.create", "..."],
"startedAt": "2026-11-25T08:00:00.000Z" }
features is a hand-maintained capability list (apps/api/src/routes/health.ts). Work through troubleshooting in this order:
Blank page / API 404
↓
1. curl /api/health → is the capability name you are looking for missing from features?
yes → the environment is running an old backend (redeploy); this is not a code problem
↓
2. curl /config.js → is apiMode http? (it should be http; `mock` means PUBLIC_API_MODE was set)
↓
3. Browser Console:
"mock mode is missing mockData" → this artifact is running as a mock (see 2)
"request failed (HTTP 404)" → a real request did go out; check the API path and the backend version
13. Troubleshooting Table
| Symptom | Cause | Fix |
|---|---|---|
| Opening 8080 gives a blank page / 502 | The container is not up, or the port is wrong | docker compose ps for health status; confirm PORT=8080, EXPOSE 8080 and compose all agree |
docker compose ps stays unhealthy |
The healthcheck probes a port other than 8080, or startup failed | Read docker compose logs app; confirm the healthcheck is written against localhost:8080/api/health |
| Bounced back to the login page right after signing in | JWT_SECRET changed, or the session expired |
Sign in again; make sure multiple replicas do not use different JWT_SECRET values |
| Sign-in says "wrong account or password" | The seeded password from the docs is used, but it was already changed in the database | Use the owner account to reset it under System Settings → Members (系统设置 → 成员) — a one-time password, with a forced change on first login |
| First login sits forever on the password-change page | The initial password has not been changed (by design) | Change it to your own following the on-screen prompt (≥8 characters, different from the old one) |
| Data is gone after a restart | /app/data is not on a persistent volume |
Mount app-data:/app/data exactly as docker-compose.yml does |
| Uploaded images 404 | UPLOAD_DIR points at a non-persistent directory |
Set UPLOAD_DIR=/app/data/uploads and mount the volume |
| The page shows a "demo data" badge | The address carries ?mode=preview, or PUBLIC_API_MODE=mock |
Drop the query string; set PUBLIC_API_MODE back to http |
| Students never receive a verification code | SMS_PROVIDER=console (no real SMS is wired up) |
The code is in the container log (docker compose logs -f app); real SMS needs an adapter implementation |
| Parts of the English site are still Chinese | Business data (member names / course names / card names / notes) is not translated | That is by design: only UI strings are translated; ?lang=en gives a shareable English link |
14. Post-Deploy Acceptance Checklist (8 Items)
- The homepage opens and the public content matches the brand under App Info (应用信息);
/api/healthreturnsstatus: okwith a non-emptyfeatures;/config.jsreturnsapiMode: "http";- Staff sign in with
admin@example.com→ land on the password-change page → after changing it, reach the/adminbusiness dashboard; - A student signs in with a phone number (verification code in the log) → the homepage shows the card balance and the next class;
- Book a class → the seat count drops → the booking appears under My Bookings (我的约课) → the teacher takes attendance → the card ledger gains one entry (proof it is writing to the real database);
- A teacher account signs in → only the teacher portal opens, and
/adminbounces back; - Data is still there after restarting the container (the persistent volume works).
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.
