¥79.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewDeployment Guide
For buyers who have the CanteenVisLite upload package and want it running on their own server. The default is a single Docker container and takes about five minutes. The package is a production build (frontend
apiMode: http, calling/apion the same container): no Node install, nonpm install, no rebuild on the server.
1. Five-minute deployment
Prerequisite: a machine that runs Docker (Linux, Windows or macOS), 2 cores / 2 GB to start (4 cores / 8 GB recommended for 20 canteens and three years of data).
# 1. Unpack (the folder should contain Dockerfile, docker-compose.yml, apps/api/out, apps/web/dist)
unzip canteenvislite.zip -d canteenvislite && cd canteenvislite
# 2. Start (the first run builds the image, later runs take seconds)
docker compose up -d
# 3. Open http://localhost:8080
Seeing the sign-in page means the deployment worked. Sign in with the default administrator (see SUPER_ADMIN_* in section 4), change that password first, then create the real accounts.
Day-two commands: docker compose ps (state; healthcheck probes /api/health), docker compose logs -f app, docker compose restart (required after changing environment variables), docker compose down (stop, data volume survives), docker compose down -v (also deletes the volume — data loss).
2. What runs inside the container
| Component | Location in the container | Responsibility |
|---|---|---|
| API | /app/server (Elysia output) |
Business endpoints under /api/*, JWT sessions, permission checks, import and aggregation |
| Web build | /app/public (apps/web/dist) |
Served by the same process; / returns index.html with no-store; the client uses a hash router |
| Migrations | /app/drizzle |
Run on start from MIGRATIONS_DIR; create tables and seeds idempotently |
One process, one port: the image does not install dependencies or build the frontend, it only runs bun server/index.js. There is no worker, no separate web container and no database container (SQLite by default). Both intematrix.deploy.json and package.json's intematrix.meta.deploy declare mode: single, port: 8080 and a public container named api. Start-up sequence (all idempotent): migrations → default organisation and super admin → default system config → config cache warm-up. The canteen demo dataset is not seeded at start-up; it is written on demand when a dashboard is first opened on an empty database, so the first open takes a few extra seconds.
3. How the frontend finds the backend
The client reads /config.js at start-up; window.__IMX_CONFIG__ decides where requests go:
window.__IMX_CONFIG__ = { apiMode: "http", apiBase: "/api" };
PUBLIC_API_MODE— runtime mode, defaulthttp. Onlymockuses frontend fixtures; any other value behaves ashttp.PUBLIC_API_BASE— API prefix, default/api. Keep it when frontend and backend share a domain; use a full URL when they are split.
Key points:
/config.jsis produced by the API process at request time (cache-control: no-store) and takes precedence over the same file indist. Change the variables anddocker compose restart— no frontend rebuild.- The static
config.jsin the package is a fallback so static hosting still starts in production mode; the mall's online preview injects a mock config instead, so it stops at the sign-in page and enters a dashboard only after a demo identity is picked, never touching your backend or writing real data. - Do not set
PUBLIC_API_MODE=mockin production: buyers would see fixtures instead of their own data.
4. Environment variables
Everything is read at runtime, so a restart is enough — no rebuild. The default column is the code-level fallback.
| Variable | Default | Purpose |
|---|---|---|
PORT |
3000 (container sets 8080) |
API listen port; 8080 inside the container |
NODE_ENV |
development |
production is required to serve the web build |
JWT_SECRET |
dev-secret-change-me |
Session signing key — replace with a strong random value in production |
DB_DRIVER |
sqlite |
sqlite, mysql or postgres |
DATABASE_URL |
<cwd>/data/sqlite.db |
/app/data/sqlite.db in the container; a connection string for MySQL / Postgres |
PUBLIC_DIR / UPLOAD_DIR / MIGRATIONS_DIR |
<cwd>/public / <cwd>/data/uploads / derived |
Web build, uploads and migration SQL; the Dockerfile sets /app/public, /app/data/uploads, /app/drizzle |
LOG_LEVEL |
info |
debug, info, warn, error |
STORAGE_DRIVER |
local |
Object storage; local means disk (s3 / oss are reserved adapters) |
MAIL_PROVIDER / MAIL_FROM |
console / no-reply@example.com |
Mail driver and sender; console logs only (smtp / ses reserved) |
SMS_PROVIDER |
console |
SMS driver; console logs only (aliyun / twilio reserved) |
AI_CONFIG_SECRET |
unset | Passphrase (AES-256-GCM) for model keys stored in the UI. Optional; changing it makes stored keys unreadable |
CORS_ORIGIN / RATE_LIMIT_LOGIN_PER_MINUTE / WS_TICKET_TTL_SEC |
* / 30 / 60 |
Allowed origins, per-IP sign-in rate limit (<=0 disables), WebSocket ticket lifetime in seconds |
SUPER_ADMIN_EMAIL / SUPER_ADMIN_NAME |
admin@example.com / Super Admin |
First super admin email and display name (only used when the database is empty) |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
First super admin password — change before going live |
PUBLIC_API_MODE |
http |
See section 3 |
PUBLIC_API_BASE |
/api |
See section 3 |
docker-compose.yml pins the essentials (NODE_ENV, PORT, PUBLIC_DIR, DB_DRIVER, DATABASE_URL, UPLOAD_DIR); everything else can stay at its default. Add entries under environment: or create a .env file that compose reads automatically (${PORT:-8080} comes from there). Three must-dos before going live: change JWT_SECRET, change SUPER_ADMIN_PASSWORD, confirm the data volume is mounted.
5. Local development
Development uses two processes on development ports, unrelated to the deployment port:
bun install # install workspace dependencies
bun run dev # start both api and web
bun run dev:api # or the API alone on http://localhost:3000 (development port)
bun run dev:web # or the Web alone on http://localhost:5173 (development port, Vite)
If a port is taken, stop whatever holds it and rerun. For production behaviour, use bun run build plus NODE_ENV=production, or build the Docker image. For the checks, run bun run check and bun test.
6. Data and backup
Where data lives: /app/data inside the container; compose mounts the named volume app-data there.
| Path | Content |
|---|---|
/app/data/sqlite.db |
Business database (accounts, canteen data, import batches, logs, system config) |
/app/data/uploads/ |
Uploaded files, served at /upload/... |
Backup, most reliable first: ① cold copy — docker compose stop, then archive /app/data (simple and safe, fine once a month); ② hot SQLite copy — docker compose exec app sh -c 'cp /app/data/sqlite.db /app/data/backup-$(date +%F).db' and docker cp it out (acceptable at low write volume; stop the container during busy periods); ③ volume snapshot at the host or cloud-disk layer — fastest to restore.
Business data export: every dashboard has an export button (comparison, ranking, dish master data, ingredient detail, purchase, waste, traffic, forecast plan), producing CSV with a definition line on top. It is not a database backup: accounts, permissions and logs are not included.
Restore: stop the container → overwrite /app/data/sqlite.db with the backup → start (across versions, upgrade first). Switching databases: set DB_DRIVER and DATABASE_URL to MySQL or Postgres and restart; tables are created automatically — export existing data first, there is no one-click cross-database migration.
7. Reverse proxy and HTTPS
Keep 8080 private behind Nginx or Caddy and expose only 443.
server {
listen 443 ssl http2;
server_name canteen.example.com;
client_max_body_size 50m; # raise it for large imports
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s; # large imports and the first demo seed
}
}
Notes: /api/health and /config.js must stay reachable — one for liveness, one for runtime config; do not put authentication in front of them. WebSocket upgrades need to pass through. Once HTTPS is on, narrow CORS_ORIGIN to your own domain. Keep PUBLIC_API_BASE at /api when frontend and backend share a domain.
8. Upgrade and rollback
Upgrade
docker compose stop # 1. back up first (previous section)
cp -a data data.bak-$(date +%F) # or a volume snapshot / docker cp
# 2. replace the package: Dockerfile, docker-compose.yml, apps, packages
docker compose up -d --build # 3. rebuild and start (migrations run automatically)
curl -s http://127.0.0.1:8080/api/health # 4. check startedAt and features
Rollback: restore the previous package → docker compose up -d --build → restore the pre-upgrade data over /app/data. The new version may have written new tables, so roll back code and data together.
Upgrade notes: if startedAt did not change you are still talking to the old process; a capability name missing from features means the backend is old (the UI probes fine, then shows "request failed (HTTP 404)"); read the release notes before crossing major versions, because definition or schema changes never backfill historical data.
9. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Blank page or 404 on 8080 | Wrong PUBLIC_DIR, or apps/web/dist missing |
Confirm /app/public/index.html exists; unpack the full package |
| Page loads but requests spin or fail | PUBLIC_API_MODE=mock, or a wrong PUBLIC_API_BASE |
curl http://127.0.0.1:8080/config.js and check apiMode / apiBase |
| "Not signed in" or sessions drop | JWT_SECRET changed, invalidating old sessions |
Sign in again; all replicas must share one JWT_SECRET |
| First dashboard open is slow | Demo dataset is generated on demand | Expected; later opens are fast |
| Signed in but no menu at all | The account's role is Member | Ask the owner to change the role on the Members page |
| A failed import row with no clear reason | Missing field, bad date, unusual amount, unmatched dish, unknown meal | Download the failed-row CSV and read the reason column; map unmatched dishes under "pending" |
.xlsx import does nothing |
This version reads CSV only | Save as CSV in Excel, then import |
| Healthcheck stays unhealthy | Port is not 8080, or the process died | docker compose logs app, then probe http://127.0.0.1:8080/api/health |
| Data vanished after a restart, or the port is taken | No volume mounted / down -v removed it, or another service holds 8080 |
Check docker volume ls and restore the backup; change the left-hand port in the compose mapping |
10. Packaging for upload (after customisation)
After you change code, the upload is the whole package including build artefacts, not just sources:
bun run pack:upload
It is bun run check && bun run check:i18n && bun run test && bun run build && bun run check:dist && bun scripts/pack-upload.mjs && bun run verify:upload. check:dist verifies the web build is in http mode (mock builds are not allowed for upload). verify:upload runs 32 gated checks, including package shape, meta.slug consistency, port 8080 agreement in five places, every document declared by docs/docs.json being present and inside a folder matching its type, the bilingual fields of docs/rag.json staying inside the mall limits, the four documents hitting the mall's four tabs, and UTF-8 flags on Chinese file names. Any failure aborts the run.
11. Health self-check
curl -s http://127.0.0.1:8080/api/health
The response carries status, service, version, features, startedAt and timestamp:
features— the business capabilities this build provides; the full list is fifteen entries:canteen.overview,canteen.compare,canteen.traffic,canteen.ranking,canteen.dishes,canteen.ingredients,canteen.purchase,canteen.waste,canteen.forecast,canteen.import.validate,canteen.import.commit,canteen.meta,canteen.settings,app.identity,auth.login;startedAt— process start time (changes on restart, not on build), which tells you whether you reached the process you just deployed;timestamp— response time.
Workflow: when a page fails, check whether the matching capability is in features. Missing → the backend is old, replace the image. Present → the backend is fine; look at permissions (403) or data (incomplete days are excluded from calculations).
Go-live essentials: the sign-in page opens on 8080, JWT_SECRET and SUPER_ADMIN_PASSWORD are replaced, the app-data volume is mounted so down and up keep the data, /api/health returns all fifteen features, the HTTPS proxy lets /api/health and /config.js through, PUBLIC_API_MODE is http, one backup exists and you know how to restore it, and accounts are created per role (manager, clerk) with the expected sidebar differences.
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.
