¥129.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewCampusTreatLite - Deployment Guide
CampusTreatLite runs as one container on port 8080. The image contains the built front end,
the built API and the database migrations; the container never installs packages or runs a front-end
build. Everything that must survive a restart lives in /app/data.
Five-minute deploy
# from the unpacked upload package (Dockerfile at the root)
docker build -t campustreatlite .
docker run -d --name campustreatlite \
-p 8080:8080 \
-v campustreatlite-data:/app/data \
campustreatlite
Then open http://localhost:8080, sign in with the owner account from the product guide, and change
the password when asked. The same steps with Compose:
docker compose up -d # compose maps ${PORT:-8080}:8080 and mounts app-data:/app/data
First start does four things automatically: runs the migrations for the configured dialect, seeds permissions / roles / menus / the owner account / default settings, seeds the demo shop once (skipped when the shop already has categories), and starts serving on 8080.
What is inside the container
| Path | Content |
|---|---|
/app/server/index.js |
Bundled API (ElysiaJS on Bun) |
/app/public |
Built single-page app served at / (hash routing, no server rewrite needed) |
/app/drizzle |
Migrations: five files per dialect (0000-0004) |
/app/data |
SQLite database plus uploaded files - mount a volume here |
| Property | Value |
|---|---|
| Public port | 8080 (Dockerfile, docker-compose.yml, intematrix.deploy.json and meta.deploy.port all agree) |
| Replicas | Exactly 1. SQLite is a single file and uploads are on local disk, so a second replica will lock the database or lose files |
| Health endpoint | /api/health, also used by the Compose health check |
Runtime configuration: /config.js
The front end loads /config.js before the app starts. The API answers that path from an early
request hook (before static files, no-store), so environment variables always win over the copy in
the build:
| Variable | Default | Effect |
|---|---|---|
PUBLIC_API_MODE |
http |
http = always talk to the real API. mock = in-memory demo data |
PUBLIC_API_BASE |
/api |
API prefix. Change it when the API lives on another origin or sub-path |
GET / is also served no-store, so a redeploy cannot leave browsers on an old index.html that
references deleted asset chunks. ?mode=preview on any URL (http://host/?mode=preview#/admin)
forces demo data for a look-around without signing in - a URL flag, not a deployment mode.
Environment variables
| Variable | Default | Notes |
|---|---|---|
PORT |
8080 in the image (3000 in local dev) |
Keep 8080 for deployment |
BIND_HOST |
0.0.0.0 |
Listen address |
NODE_ENV |
production |
Static files are served when production |
PUBLIC_DIR |
/app/public |
Built front end |
PUBLIC_API_MODE |
http |
See above |
PUBLIC_API_BASE |
/api |
See above |
DB_DRIVER |
sqlite |
sqlite, mysql or postgres |
DATABASE_URL |
/app/data/sqlite.db |
SQLite file path, or a server DSN for MySQL / PostgreSQL |
UPLOAD_DIR |
/app/data/uploads |
Uploaded product images and delivery photos |
MIGRATIONS_DIR |
/app/drizzle |
Migrations run on start |
JWT_SECRET |
dev-secret-change-me |
Set a random value in production; changing it invalidates existing sessions |
CORS_ORIGIN |
* |
Narrow it to your domain when the API is on a separate origin |
LOG_LEVEL |
info |
debug, info, warn, error |
STORAGE_DRIVER |
local |
s3 / oss are placeholder adapters |
MAIL_PROVIDER |
console |
smtp / ses are placeholder adapters |
MAIL_FROM |
no-reply@example.com |
Sender address for mail |
SMS_PROVIDER |
console |
Console driver prints the code and keeps the demo code 123456; connect a real provider before launch |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
Sign-in attempts per IP per minute; <= 0 disables |
WS_TICKET_TTL_SEC |
60 |
Lifetime of a WebSocket ticket |
SUPER_ADMIN_EMAIL / SUPER_ADMIN_NAME / SUPER_ADMIN_PASSWORD |
admin@campus.local / seeded name / Admin@123456 |
Used when the owner account is first created |
Local development
The development servers are for development only. 3000 and 5173 are never deployment addresses.
| Command | What it does |
|---|---|
bun install |
Install workspace dependencies |
bun run dev |
Front end on http://localhost:5173 plus API on http://127.0.0.1:3000 |
bun run dev:web / dev:api / dev:http |
Run one side, or point the dev front end at the real API |
bun run seed |
Write the demo dataset (idempotent) |
bun run check / bun run test / bun run i18n:check |
Type check, tests, translation gate |
bun run build |
Production build: front end with apiMode=http, API bundle in apps/api/out |
bun run build:mock |
Demo build for local previews only - never upload this |
bun run verify:upload |
Verify an upload package |
Swagger is available at /docs on the API origin during development.
Data and backup
Everything persistent is under /app/data: sqlite.db and uploads/. Both belong in the same
backup. Three layers, in increasing order of completeness:
| Layer | How | Scope |
|---|---|---|
| Built-in exports | Admin console, backup page: CSV for orders, products, students and members; JSON for settings | Business data, no photos |
| Whole-database backup | Stop the container, copy /app/data, start again (below) |
Database and uploads |
| Volume snapshot | Your platform's volume snapshot feature | Depends on the platform |
# Whole-database backup with a consistent file (recommended)
docker stop campustreatlite
docker cp campustreatlite:/app/data ./backup-campustreatlite-$(date +%F)
docker start campustreatlite
# Restore
docker stop campustreatlite
docker cp ./backup-campustreatlite-2026-11-01/. campustreatlite:/app/data
docker start campustreatlite # migrations run on start and are idempotent
If you need a hot copy without stopping the shop, take it with SQLite itself, not with cp:
sqlite3 /path/to/volume/sqlite.db ".backup '/backup/sqlite.db'".
Do not copy a live SQLite file. A plain cp while the app is writing can capture a torn database
(the write-ahead log and shared-memory file are separate). Always copy the database together with
uploads/, use .backup / VACUUM INTO while running, or stop the container first.
Reverse proxy and HTTPS
| Topic | What to do |
|---|---|
| TLS termination | Terminate HTTPS at the proxy and forward plain HTTP to 8080 |
| One origin | Serve the app at / and the API under /api on the same host; that is the default and needs no configuration |
| Separate API origin | Set PUBLIC_API_BASE to the API URL and CORS_ORIGIN to your site's origin |
| WebSocket | Allow the upgrade on /api/ws (tickets come from /api/ws/ticket) |
| Body size | Raise the request body limit enough for photo uploads |
| Timeouts, client IPs | Keep proxy read timeouts above the health-check interval; make the proxy set client IP headers if you rely on them in the logs |
Upgrading
- Take a backup (see above).
- Build or pull the new image.
- Recreate the container on the same volume:
docker compose up -dafter replacing the image, ordocker runwith the same-vmount. - Migrations run on start and are idempotent; the seeded owner account is not recreated if it exists.
Sessions survive as long as JWT_SECRET stays the same. Changing it forces everyone to sign in again.
Troubleshooting
| Symptom | First check | Fix |
|---|---|---|
http://host:8080/ does not answer |
docker ps, container logs |
Port mapping must be 8080:8080; the app listens on 8080 inside the container |
| Page loads, every API call is 404 | GET /api/health and its features list |
A short feature list means an old backend is running - deploy the new image |
| Blank page right after a redeploy | Browser cache, GET / headers |
GET / is no-store; hard refresh and confirm the asset filenames changed |
| Demo identity buttons or a "demo data" badge in production | PUBLIC_API_MODE |
It is mock; set http and restart |
| Every request is 401 after a config change | JWT_SECRET |
Existing tokens are void; sign in again |
| 403 in the admin console | The signed-in role | Only the owner reaches /api/admin/*; see the permissions guide |
| 429 while signing in | RATE_LIMIT_LOGIN_PER_MINUTE |
Wait a minute, or raise the limit for the shop's shared IP |
| "database is locked" or missing uploads | Number of running replicas | Run exactly one; all replicas would share one SQLite file and one upload directory |
| Delivery rejected with "no photo, no delivery" | The request body | At least one photo URL is required; check that UPLOAD_DIR is writable |
| Upload rejected by the upload form | The zip was built with build:mock |
Rebuild with bun run build, then bun run check:dist must report http |
| Data disappears after a restart | The volume mount | /app/data must be a named volume or bind mount |
Packaging for upload
bun run build # production build -> apps/web/dist with apiMode=http, apps/api/out/index.js
bun run check:dist # must report the dist mode as http; a mock build fails here
bun run pack # scripts/pack-upload.mjs -> ../campustreatlite-upload.zip
bun run verify:upload # package self-check; must pass before uploading
bun run pack:upload chains check, i18n check, tests, build, dist check, pack and verify.
- Never upload a
build:mockartifact.check:distis invoked with--expect http, andverify:uploadreadsdist/.build-meta.jsonand fails unlessapiModeishttp. The marketplace preview does not need a mock build: the preview service injects the mock runtime config itself. - The package must contain
Dockerfileat the root,apps/web/dist,apps/api/out/index.js,apps/api/drizzle,package.jsonwithintematrix.meta, and the docs tree. - It must not contain
node_modules,data/, logs or a local SQLite file. verify:uploadalso checks that port 8080 is consistent across the Dockerfile, Compose file, deploy manifest and deployment docs.- The built-in checkout sends an idempotency key, so a double submit creates one order; custom clients must send one too.
Redeploying after customisation
- Rebuild:
bun run build(andbun run check,bun run test). - Confirm the build mode:
bun run check:distprints the dist mode - it must behttp. - Pack and verify:
bun run pack,bun run verify:upload. - Upload the new package and deploy it over the existing container, keeping
/app/data. - After the restart, open
/api/healthand confirm the version and feature list are the new ones.
Domains and networking expectations
- The platform assigns the domain or subdomain. Do not hard-code hostnames, subdomains or IP addresses in the app, the docs or the deploy manifest.
- The app is built with relative links and hash routing, so it works under any host and any path prefix.
- If the platform serves the API on a separate host, set
PUBLIC_API_BASEandCORS_ORIGINinstead of rebuilding the front end. - Do not pin a container subnet or static container IPs in the deploy manifest: the platform assigns network ranges and shifts them when a range is already taken.
- Internal service-to-service calls belong to container names or platform-injected host/port variables, not to fixed addresses.
Health self-check
GET /api/health returns the facts you need to tell "old environment" from "broken code":
| Field | Meaning |
|---|---|
status |
ok when the API is up |
service |
api |
version |
API version string |
features |
35 capability names such as shop.order.create, staff.picking, admin.settings, ws.ticket |
startedAt |
Process start time - compare it with the container uptime to confirm a restart |
timestamp |
Server time of the response |
Use it in this order: endpoint missing or 404 -> check features; a feature missing from the list ->
the running image is older than the code you deployed; everything present but a page fails -> look at
the browser network tab and the container log.
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.
