¥69.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewGatherly — Deployment Guide
Applies to version 1.2.0 (production build
apiMode=http; runtime configuration comes from/config.js). Written for buyers: follow the sections in order and the system runs.
1. Five-minute deployment
1.1 With Docker (recommended)
# Unzip, then enter the project root (the folder with Dockerfile and docker-compose.yml)
docker compose up -d
Open http://localhost:8080 → top-right "Sign in" → log in as the admin (admin@example.com / Admin@123456 by default).
docker compose ps # the app service should be healthy
docker compose logs -f app # startup log: migrations → seed → listening at http://0.0.0.0:8080
There is exactly one port: 8080.
DockerfilePORT=8080+EXPOSE 8080,package.jsonintematrix.meta.deploy.port: 8080,intematrix.deploy.jsonport: 8080, and all three places insidedocker-compose.yml(ports/environment.PORT/ healthcheck). Change all five together, otherwise the platform health probe stays unhealthy.
1.2 Without Docker (run locally)
bun install
bun run build # production build: apps/web/dist + apps/api/out/index.js
cd apps/api
PORT=8080 BIND_HOST=0.0.0.0 \
PUBLIC_DIR=../web/dist DATABASE_URL=../../data/sqlite.db \
bun out/index.js
Open http://localhost:8080. The database is created at DATABASE_URL on boot (auto-migrate + seed).
2. Container responsibilities
| Container | Port | Role |
|---|---|---|
app |
8080 (public) | API + serves the front-end build (/app/public) + SPA GET / |
- Single-container template (
mode: single): no worker, no redis, no separate static server; - The image does not run
bun installorvite build: the upload package already ships production artifacts (apps/api/out,apps/web/dist); - Process inside:
bun server/index.js; - One persistent volume:
/app/data(SQLite file + uploads).
3. How front end and back end are wired (runtime config.js)
The front end does not bake the API address at build time. It loads a synchronous script before the bundle:
<!-- apps/web/index.html -->
<script src="./config.js"></script>
config.js is emitted by the backend from environment variables (apps/api/src/app.ts, an onRequest early
intercept that wins over static files):
// GET /config.js
window.__IMX_CONFIG__ = { apiMode: "http", apiBase: "/api" };
| Variable | Meaning | Default |
|---|---|---|
PUBLIC_API_MODE |
http uses the real API; mock uses front-end demo data (preview / screenshots only) |
http |
PUBLIC_API_BASE |
API prefix; use an absolute URL when the API lives on another domain | /api |
apps/web/dist/config.jsin the package is a static fallback (alsohttp); inside the container the API output wins;- Both
/config.jsandGET /sendcache-control: no-store, so a redeploy never serves a stale HTML shell; - To see the
mockbehaviour:PUBLIC_API_MODE=mock docker compose up -d(that is exactly what the shop preview injects).
4. Environment variables
| Variable | Default | Required | Notes |
|---|---|---|---|
NODE_ENV |
development |
✅ | Use production (controls static hosting) |
PORT |
8080 (fixed in the image) |
— | Container port; keep the five layers consistent |
BIND_HOST |
0.0.0.0 |
— | Listen address; injected by the platform. Do not use the public domain here |
PUBLIC_DIR |
/app/public |
— | Front-end build directory |
PUBLIC_API_MODE |
http |
— | See §3 |
PUBLIC_API_BASE |
/api |
— | See §3 |
DB_DRIVER |
sqlite |
— | sqlite / mysql / postgres |
DATABASE_URL |
/app/data/sqlite.db |
✅ | File path for SQLite, connection string for MySQL/PG |
MIGRATIONS_DIR |
/app/drizzle |
— | Migrations applied automatically on boot |
UPLOAD_DIR |
/app/data/uploads |
— | Upload target; public URLs are /upload/... |
JWT_SECRET |
dev-secret-change-me |
✅ change in production | JWT signing secret, 32 random bytes recommended |
CORS_ORIGIN |
* |
— | Restrict to your domain in production |
LOG_LEVEL |
info |
— | debug / info / warn / error |
STORAGE_DRIVER |
local |
— | local is implemented; s3 / oss are placeholders |
MAIL_PROVIDER |
console |
— | console logs emails only; smtp / ses are placeholders |
MAIL_FROM |
no-reply@example.com |
— | Sender address |
SMS_PROVIDER |
console |
— | Same as above (aliyun / twilio are placeholders) |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
— | Per-IP per-minute limit for login and public submissions (≤0 disables) |
WS_TICKET_TTL_SEC |
60 |
— | WebSocket one-time ticket lifetime |
SUPER_ADMIN_EMAIL |
admin@example.com |
— | Super admin email created on first boot |
SUPER_ADMIN_NAME |
Super Admin |
— | Display name |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
✅ change in production | Only used when no super admin exists yet |
Seeded accounts must change their password on first sign-in (§8②): signing in with the default password lands on
/#/change-passwordbefore the workspace opens. That is by design (see Product Spec §7).Changing
SUPER_ADMIN_PASSWORDaffects first creation only. Once a super admin exists, use Admin → Users to reset the password.
5. Local development
bun install
bun run dev # web(5173) + api(3000); the front end uses demo data by default
bun run dev:http # front end against a local backend (3000); start bun run dev:api separately
bun run dev:api # backend only
| Address | Notes |
|---|---|
http://localhost:5173 |
Vite dev server (development port, not the deployment port) |
http://localhost:3000 |
Backend dev port (apps/api/src/env.ts default) |
http://localhost:3000/docs |
Swagger |
3000 / 5173 exist in development only. Deployment is 8080; the docs and compose files all use 8080.
Handy commands:
bun run check # type checks (web + api)
bun test # full suite (115 cases)
bun run build # production build (web=http + api out)
bun run build:mock # mock build for local demos (**never upload this**)
bun run check:dist # reads dist/.build-meta.json, must be http
6. Data and backup
| Item | Location |
|---|---|
| SQLite database | /app/data/sqlite.db (DATABASE_URL) |
| Uploads | /app/data/uploads (UPLOAD_DIR) |
| Migrations | /app/drizzle/{sqlite,mysql,postgres} |
Backup (safe even while running, for SQLite):
docker compose exec app sh -c 'tar czf - /app/data' > gatherly-backup-$(date +%F).tar.gz
Restore: stop the container → extract over /app/data → start it again (pending migrations run on boot).
Switching to MySQL / PostgreSQL:
environment:
DB_DRIVER: postgres
DATABASE_URL: postgres://user:pass@db:5432/gatherly
Migrations (0000–0004; 0004 adds the first-login password flag) run automatically on boot. Test on an empty database first; this template does not ship a
cross-dialect data migration tool.
7. Reverse proxy and HTTPS
Nginx example (WebSocket must be forwarded too — /#/console/realtime uses it):
server {
listen 443 ssl;
server_name events.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";
}
}
- The front end uses HashRouter (all pages live under
#/...), so notry_filesdeep-link fallback is needed; - Never cache
/or/config.jsin the proxy (the backend already sendsno-store); - Upload size: 10MB per file by default (
upload.maxSizeMb); keepclient_max_body_sizeat or above it.
8. Upgrades
# ① Back up (see §6)
# ② Unpack the new version over the code, keeping /app/data
docker compose build --no-cache
docker compose up -d
# ③ Pending migrations run on boot; confirm healthy
curl -s http://localhost:8080/api/health
The running version is version in GET /api/health (currently 1.2.0).
9. Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Blank page after redeploy | Browser cached the old HTML that referenced removed chunks | Hard reload; confirm / sends cache-control: no-store |
| Page loads, every API is 404 | The proxy forwards / but not /api |
Add location /api |
| "Account does not exist" on sign-in | Using a documented demo email against an empty or swapped database | Check DATABASE_URL; first boot seeds accounts |
401 "wrong email or password" after setting SUPER_ADMIN_PASSWORD |
That variable only applies to first creation | Reset the password under Admin → Users |
Container stays unhealthy |
Compose healthcheck or port is not 8080 | Verify ports / environment.PORT / healthcheck |
| Submission returns 429 | IP rate limit hit (30/min default) | Raise RATE_LIMIT_LOGIN_PER_MINUTE or check for scripted traffic |
| Check-in says "not started" / "already ended" | Outside checkinWindowMinutes |
Widen the window in event settings, or check session times and time zone |
| Event detail 403 / empty list | Signed-in account belongs to another tenant | Sign in with an account of the same tenant |
| Upload returns 413 | Proxy limit below upload.maxSizeMb |
Raise client_max_body_size |
| English UI still shows Chinese on a custom page | Missing dictionary entry in your own additions | cd apps/web && bun scripts/check-i18n.ts and add the missing entry to src/lib/i18n/views.ts |
10. Health self-check (do this after every deployment)
curl -s http://localhost:8080/api/health
Expected (32 feature entries):
{
"status": "ok",
"service": "api",
"version": "1.2.0",
"timestamp": "2026-11-26T…",
"startedAt": "2026-11-26T…",
"features": ["gatherly:public-events", "gatherly:public-registration", "…", "docs:rag-v2"]
}
Then confirm three more things:
curl -s http://localhost:8080/config.js # window.__IMX_CONFIG__ = {"apiMode":"http","apiBase":"/api"}
curl -s -o /dev/null -w '%{http_code}\n' -X POST \
-H 'content-type: application/json' -d '{}' \
http://localhost:8080/api/auth/register # 404 (no self-service registration)
curl -s http://localhost:8080/api/public/events | head -c 200 # public events are seeded
11. Packaging after secondary development
bun install
bun run check # type checks
bun test # 143 cases
bun run build # production build: dist/.build-meta.json = apiMode:http
bun run check:dist # must print "dist 模式:http"
bun run pack # → ../gatherly-upload.zip (Python zipfile, UTF-8 filename flag)
bun run verify:upload # 33/33 green (single-container profile)
Or in one shot:
bun run pack:upload # check → test → build → check:dist → pack → verify
Package checklist
- No
node_modules/data/ logs / local databases / real secrets inside; - Must contain
apps/web/dist/.build-meta.json(apiMode: "http"),apps/web/dist/config.js,apps/api/out/index.js,apps/api/drizzle/**; - Never upload
build:mockoutput: verify item 4 fails immediately (apiMode=mock); - Chinese file names must carry the UTF-8 flag:
packrunsscripts/zip-pack.py verifyand refuses to emit a broken package.
12. Domain and access conventions
| Item | Convention |
|---|---|
| Public port | 8080 (the platform health probe uses it too) |
| Health path | /api/health (healthcheck.path in intematrix.deploy.json) |
| Front-end routing | HashRouter (https://your-domain/#/console); no deep-link fallback needed |
| API prefix | /api (override with PUBLIC_API_BASE for an absolute URL) |
| Uploaded file URL | /upload/... (site root, not under /api) |
| Static assets | /assets/... (content-hashed, long cache is fine) |
Home page and config.js |
no-store, never cached |
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.
