¥59.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 General

VisitLog — Deployment Guide

Version 1.1.0. Goal: get the system running in five minutes, and know where to look when it does not. This package is a production build (apiMode=http): apps/web/dist and apps/api/out/index.js are already included, and the image only runs artifacts — it never installs or builds inside the container.


1. Five-minute deployment

# 1) Unpack the upload package
unzip visitlog-upload.zip -d visitlog && cd visitlog

# 2) Start the container (port 8080, data in the named volume app-data)
docker compose up -d --build

# 3) Health check
curl -s http://localhost:8080/api/health
# {"status":"ok","service":"api","version":"1.1.0","startedAt":"…","features":[…]}

# 4) Open the app
# http://localhost:8080/          public site
# http://localhost:8080/#/login   sign in (admin@example.com / Admin@123456)

On first boot the container automatically: applies migrations (apps/api/drizzle) → seeds the platform (permissions / roles / menus / super admin / settings) → seeds demo data (customers, visits, follow-ups, deals — idempotent, only when the database is empty).

First thing after going live: change the super admin password (Admin → Users) and rebuild accounts and profiles for real staff (product spec §8). The seeded passwords are printed in the docs, which makes them public.


2. Container and data

Item Value
Containers 1 (API + static frontend + migrations in one image)
Port 8080 (EXPOSE 8080, PORT=8080; compose maps ${PORT:-8080}:8080)
Volume app-data → /app/data (SQLite database + uploads)
Health check GET /api/health (compose interval 30s; the platform probes the same route)
Base image oven/bun:1.4, CMD ["bun", "server/index.js"]

Responsibilities inside the container:

  • /app/server/index.js — the single-file API: serves /config.js (runtime config via onRequest, before the static plugin), hosts /app/public with no-store on / and index.html, serves /upload/* and /api/*;
  • /app/drizzle — migrations, applied on boot;
  • /app/data — persistent state (sqlite.db, uploads/).

3. How frontend and backend meet (runtime config.js)

The frontend no longer guesses the API from build-time constants. apps/web/index.html loads <script src="./config.js"> first, then reads window.__IMX_CONFIG__ = { apiMode, apiBase }:

Situation Where /config.js comes from Result
Deployment (this package) The API's onRequest handler, from env vars {"apiMode":"http","apiBase":"/api"} by default
Marketplace live preview Injected by the preview service (mock) apiMode=mock, browser-side demo data
Static hosting without API The static dist/config.js default http, but the API is unreachable (not recommended)

To force demo mode on your own deployment: PUBLIC_API_MODE=mock docker compose up -d, then refresh. Both /config.js and GET / are no-store, so no cache busting is needed.


4. Environment variables

Variable Default Meaning
NODE_ENV development (production in the image) Serves the static build when production
PORT 3000 (8080 in the image) Listen port; the public port is always 8080
BIND_HOST 0.0.0.0 Bind address; injected by the platform (never use the public HOST here)
PUBLIC_DIR ./public (/app/public) Frontend build directory
PUBLIC_API_MODE http What /config.js reports: http or mock
PUBLIC_API_BASE /api API prefix reported by /config.js
DB_DRIVER sqlite sqlite / mysql / postgres
DATABASE_URL ./data/sqlite.db SQLite file path or connection string
MIGRATIONS_DIR ./drizzle (/app/drizzle) Migration directory
UPLOAD_DIR ./data/uploads Upload directory
JWT_SECRET dev-secret-change-me Change in production; rotating it invalidates all tokens
CORS_ORIGIN * Tighten when frontend and API use different origins
SUPER_ADMIN_EMAIL / SUPER_ADMIN_NAME / SUPER_ADMIN_PASSWORD admin@example.com / Super Admin / Admin@123456 Super admin created on first boot
RATE_LIMIT_LOGIN_PER_MINUTE 30 Login/registration rate limit per IP (<=0 disables)
WS_TICKET_TTL_SEC 60 WebSocket one-time ticket TTL
LOG_LEVEL info debug / info / warn / error
STORAGE_DRIVER local Storage driver (s3 / oss are placeholders)
MAIL_PROVIDER, MAIL_FROM, SMS_PROVIDER console, no-reply@example.com, console Mail/SMS; console only logs

PORT=3000 in .env.example is for local development only; the container pins 8080 in the Dockerfile.


5. Local development

bun install
bun run dev            # web (5173) + api (3000), frontend uses mock data
bun run dev:http       # frontend against the local API
bun run dev:api        # API only
bun run check          # type checks for web and api
bun run test           # 154 tests (domain rules, route areas, mock integrity, HTTP e2e)
bun run check:overflow # 390px horizontal overflow regression (needs local Chrome/Edge)

Development ports are api 3000 / web 5173 — different from the deployed 8080. The API runs from source in development and from out/index.js in the container. The first API start creates ./data/sqlite.db, migrates and seeds.


6. Data and backup

  • Default SQLite: /app/data/sqlite.db (plus -wal / -shm); uploads: /app/data/uploads/;
  • Backup = copy /app/data (stop the container or use sqlite3 .backup):
docker compose stop
docker run --rm -v visitlog_app-data:/data -v "$PWD":/backup alpine \
  tar czf /backup/visitlog-data-$(date +%F).tgz -C /data .
docker compose start
  • There is no built-in backup or download API — there is no backup page in the admin console on purpose;
  • Restore by unpacking the archive back into the volume (stop the container first; SQLite has a single writer);
  • Switching to MySQL / PostgreSQL: set DB_DRIVER + DATABASE_URL; migrations for all three dialects ship with the package (apps/api/drizzle/{sqlite,mysql,postgres}) and are applied on boot. Verify business behaviour on SQLite first; a database switch migrates schema, not historical rows.

7. Reverse proxy and HTTPS

Nginx example (single origin; /api, /upload, /config.js and WebSocket all proxied):

server {
  listen 80;
  server_name visitlog.example.com;

  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_read_timeout 300s;
  }
}
  • Terminate TLS at the proxy; the container keeps plain http on 8080;
  • X-Forwarded-For feeds login-log IPs and rate limiting (the API trusts only the first value);
  • WebSocket lives at /api/ws and needs the upgrade headers.

8. Upgrade / redeploy

docker compose down                 # data stays in the volume
unzip -o visitlog-upload.zip -d .   # overwrite code and artifacts
docker compose up -d --build
curl -s http://localhost:8080/api/health   # version should be the new one
  • Migrations run automatically on boot (idempotent);
  • GET / is no-store, so browsers will not keep an old HTML that references deleted chunks;
  • Restart after rebuilding dist: the Elysia static plugin pre-warms its file table at startup; new hashed assets 404 until the process restarts.

9. Troubleshooting

Symptom Check first Likely cause / fix
Cannot reach 8080 docker compose ps, docker compose logs -f app Container down, port taken, health check failing; keep the three port spots in sync (${PORT:-8080}:8080, PORT: "8080", healthcheck localhost:8080)
unhealthy forever Health check URL vs actual port Health check not updated with the port, or the API crashed (read the first stack trace)
Page loads, API 502 / 404 /config.js content; proxy forwards /api Wrong PUBLIC_API_BASE; proxy missing /api; no backend behind the static host
Login 401 Account in the current tenant, status active Wrong seeded email, disabled account, or JWT_SECRET changed (sign in again)
Signed in but workbench is empty Business profile exists? Same email? The app says "no business profile"; see product spec §8
Blank page / Failed to fetch dynamically imported module GET / is no-store; dist and index.html are from the same build HTML replaced without assets (or proxy cached HTML); rebuild and restart
All phone numbers masked Position and ownership Expected: sales reps only see their own customers' full numbers
Export button missing data:export The role lacks the export point
Dates off by a day / 8 hours Host vs container time zone Business dates use the browser's local time; set TZ=Asia/Shanghai on the server
database is locked Concurrent writes SQLite single writer: lower concurrency or move to MySQL/PG; back up after docker compose stop
Upload 413 upload.maxSizeMb (10 MB default) Raise it in Admin → Settings; also raise the proxy's client_max_body_size

10. Health self-check

curl -s http://localhost:8080/api/health | jq .
# status=ok / version=1.1.0 / startedAt / features[28]

features is a capability list (visits, follow-ups, customers, team, weekly, dashboard, members, dictionaries, settings, recycle bin, import/export, RBAC, logs, monitor, i18n…). startedAt tells you whether the process just restarted.


11. Building the upload package (v6 pipeline)

bun install
bun run pack:upload
# check → test → build (production) → check:dist (must be http) → pack → verify:upload
  • Do not run build:mock for uploads: the marketplace preview injects mock runtime config. check:dist must print dist 模式:http; a mock artifact is rejected by the upload gate.
  • Output: ../visitlog-upload.zip (named after intematrix.meta.slug).
  • Gate: bun run verify:upload must be fully green — 31 checks for this single-container template: Dockerfile, artifacts, .build-meta.json, dist/config.js, .env.mock, ports 8080 in five places, four Chinese docs plus four English .mdx docs, bilingual docs/rag.json with field limits and Tab slots, conversation.seed.json, UTF-8 file names, and no node_modules / local database.
  • The package must not contain: node_modules, data/, logs, local SQLite files, real secrets or internal notes (docs-legacy/ and AGENT.MD are hidden from buyer downloads by .intematrixignore).

12. Re-deploying after customization

  1. Change code (pages in apps/web/src/pages/visitlog/**, rules in lib/visitlog/** and apps/api/src/visitlog/** — keep the two rule files byte-identical);
  2. bun run check and bun run test must pass;
  3. bun run build → bun run check:dist → bun run pack → bun run verify:upload;
  4. Redeploy as in §8.

Rebranding locations are listed in product spec §11. Rebuilding is mandatory — the container never hot-reloads.


13. Domain conventions (cloud deployment)

  • No domain is hard-coded: the same template can be deployed many times;
  • The platform injects HOST (public domain of this container), BIND_HOST (bind address), PUBLIC_HOST / PUBLIC_URL, DEPLOYMENT_ID. The API reads only BIND_HOST / PORT — never bind to HOST;
  • A single-container deployment has no inter-container traffic. If you add a worker, use container-name DNS (http://worker:3001) and never hard-code network.subnet or a container ip (the platform allocates them; a fixed IP fails the precheck once the subnet shifts);
  • Reverse proxy / HTTPS: see §7; WebSocket needs the upgrade headers.

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 写进前端代码或提交到仓库。