¥79.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewDeployment Guide
CertBox deploys as one public container api (8080) plus one intranet container worker (3001), with all data in a single volume (SQLite + uploads). The upload package already contains the build output; the image only runs — it installs nothing and compiles nothing.
1. Five-minute deployment
1. Environment requirements
| Item | Requirement |
|---|---|
| Docker | 20.10+ (the docker compose subcommand must work) |
| Resources | 0.5 core / 1 GB RAM / 20 GB disk |
| Port | host 8080 available |
| Replicas | exactly 1 (SQLite is a single file; no multi-replica) |
2. Start
docker compose up -d
Open http://localhost:8080. The deployment sign-in page has only the email and password form (no demo identities); sign in as the seeded administrator chenmo@example.com / certbox2026. Set JWT_SECRET per section 4 first, then use "Change password" in the top right and walk through "Site management → New site" and "Certificate register → Upload certificate".
The first start runs migrations, creates tables, writes default settings and seeds demo data (9 groups, 20 sites, 26 certificates, 12 alerts, 12 deployment records). Demo data goes into an empty database only; to start over, delete the data volume and start again.
2. Container responsibilities
| Container | Image source | Listens | Public | Role |
|---|---|---|---|---|
api |
Dockerfile |
8080 |
Yes (domain / port proxies here) | Business API + static hosting of the front end dist |
worker |
Dockerfile.worker |
3001 |
No (container intranet only) | Intranet sample service with /api/health and /api/worker/info only; carries no certificate business today |
The image holds three things: /app/server (apps/api/out), /app/public (apps/web/dist) and /app/drizzle (migration SQL); /app/data is the mounted volume. Platform deployments start two containers per intematrix.deploy.json; local docker-compose.yml starts api only.
3. How front end and back end connect
The front end uses HashRouter (pages live under #/...), so no server-side deep-link fallback is needed; everything outside /api/* is served as static files by the api container.
Runtime configuration comes from GET /config.js, not from a build-time constant:
// production deployment
window.__IMX_CONFIG__ = { "apiMode": "http", "apiBase": "/api" };
// online preview (injected by the preview service)
window.__IMX_CONFIG__ = { "apiMode": "mock", "apiBase": "/api" };
- The default is
http, calling the real API;mockis for online preview or a temporary demo only. - To switch to mock temporarily, set
PUBLIC_API_MODE=mockand restart the container; remove it afterwards. index.htmland/config.jsareno-store, so a redeploy never loads stale chunks from cache.
4. Environment variables
| Variable | Default | Description |
|---|---|---|
NODE_ENV |
production |
Runtime environment |
PORT |
8080 |
api listen port (worker is fixed at 3001) |
BIND_HOST |
0.0.0.0 |
Bind address; injected by the platform manifest |
PUBLIC_DIR |
/app/public |
Front-end output directory |
DB_DRIVER |
sqlite |
sqlite / mysql / postgres |
DATABASE_URL |
/app/data/sqlite.db |
SQLite file or database connection string |
UPLOAD_DIR |
/app/data/uploads |
Upload directory (persisted on the volume) |
MIGRATIONS_DIR |
/app/drizzle |
Migration SQL directory |
JWT_SECRET |
dev-secret-change-me |
Must be changed before going live to a random string of 32+ characters |
LOG_LEVEL |
info |
debug / info / warn / error |
PUBLIC_API_MODE |
http |
http (deployment) / mock (demo) |
PUBLIC_API_BASE |
/api |
Front-end request prefix |
STORAGE_DRIVER |
local |
Local disk; s3/oss are placeholders, not wired up |
MAIL_PROVIDER |
console |
Mail is logged by default |
SMS_PROVIDER |
console |
SMS is logged by default |
CORS_ORIGIN |
* |
Same-domain deployments need no change |
HOST |
injected by the platform | Current public domain, used only to build links |
JWT_SECRETalso feeds private-key encryption (SHA-256 derivation). Do not change it after going live or saved private keys can no longer be decrypted; if you must, export the register and re-upload the private keys.compose only passes variables listed under
environment; to setJWT_SECRETorPUBLIC_API_MODE, add them explicitly indocker-compose.ymlunderenvironment(or let the platform inject them) — writing.envalone is not enough.
5. Local development (not deployment)
bun install
bun run dev:api # http://127.0.0.1:3000
bun run dev:web # http://localhost:5173
Vite already proxies /api to 127.0.0.1:3000; if 3000 is taken, set VITE_API_PROXY or API_PORT. This is development mode with hot reload.
Development ports are 3000 (api) and 5173 (web); the deployment port is 8080 only. Docs, screenshots and acceptance all use 8080 — never put 5173 in a deployment link.
6. Data and backup
- All mutable data is under
/app/data:sqlite.db(business data) plusuploads/(certificate files). docker-compose.ymldeclares the named volumeapp-data; a baredocker runneeds an explicit-v.- Rebuilding the container loses no data, as long as the volume survives.
- "System tools → Data backup" backs up on demand; automatic backups run with the daily inspection and are kept for 30 days, as is the recycle bin.
- The register exports to CSV (no private keys); download records export for audit.
Command-line backup (safest with the service stopped):
docker compose stop app
docker cp "$(docker compose ps -aq app)":/app/data/sqlite.db ./certbox-backup.db
docker compose start app
7. Reverse proxy and HTTPS
api exposes a single port and front and back end share one domain, so the proxy is simple:
server {
listen 443 ssl;
server_name cert.example.com;
client_max_body_size 20m;
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-Proto $scheme;
}
}
- HTTPS terminates at the proxy; certificate files themselves still go through the system's upload.
- Do not cache
index.htmlor/config.js; hashed static assets can be cached long. - For same-domain deployment keep
CORS_ORIGINat*; tighten it when deploying on separate domains.
8. Upgrades
# ① back up (important)
docker compose stop app
docker cp "$(docker compose ps -aq app)":/app/data/sqlite.db ./pre-upgrade.db
docker compose start app
# ② rebuild the image from the new package and restart
docker compose up -d --build
# ③ prove it
curl -s http://127.0.0.1:8080/api/health
- Migrations run automatically at container start and are idempotent; back up before crossing major versions.
- The
app-datavolume survives image or package changes, so data is not wiped. - On a platform, replace the image or upload the package again; volumes and migration behavior are the same.
9. Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
8080 does not respond |
Container not up / port taken / not built | docker compose ps, docker compose logs app; map another port |
| health not healthy | Migration failed / data directory not writable / wrong PUBLIC_DIR |
Read the logs; confirm /app/data is writable; curl /api/health |
| Switching to English does nothing | ?lang=en dropped after # / language overridden by a cookie |
Use http://host:8080/?lang=en#/console; clear the site cookie and retry |
| Preview shows no data | PUBLIC_API_MODE=http but the back end is down / API returns 401 |
curl /config.js and /api/health; confirm the container is healthy |
Sign-in returns 401 |
Wrong password / account disabled / JWT_SECRET changed |
Reset the password as administrator; check member status; pin JWT_SECRET |
| Migration fails | MIGRATIONS_DIR missing / dialect does not match the database |
Confirm /app/drizzle exists in the image; make DB_DRIVER match the connection string |
| Uploaded files vanish after restart | UPLOAD_DIR is not on the volume |
Mount /app/data and keep the default UPLOAD_DIR |
Private-key download fails after changing JWT_SECRET |
Old keys were encrypted with the old secret | Restore the original JWT_SECRET, or re-upload the private keys |
10. Packaging for upload
bun run build # produce apps/web/dist and apps/api/out
bun run check:dist # must be http; mock output may not be uploaded
bun run pack # build the upload package
bun run verify:upload # self-check inside the package
Single-command version: bun run pack:upload (check → i18n → 183 tests → build → check:dist → pack → verify).
The current delivery passes: bun run check is green (design / i18n / permission gates plus type checks for all three layers), bun test passes 183 tests, the package self-check is green, and dist is a production build (apiMode=http).
The package must contain: apps/web/dist (production build, .build-meta.json with apiMode set to http), apps/api/out/index.js, apps/api/out/worker.js, apps/api/drizzle, Dockerfile, Dockerfile.worker, docker-compose.yml, intematrix.deploy.json, docs/. It must not contain node_modules, data/, a real .env, logs or .db files.
11. Redeploying after customization
bun install # only needed when dependencies change
bun run check && bun run test
bun run build
docker compose up -d --build
After a schema change: generate a new drizzle migration, make sure the file lands in apps/api/drizzle (it runs automatically at container start), and do not delete the data volume.
12. Domain conventions
- The same build is deployed many times — never hard-code a domain, callback address or absolute link.
- Platform deployments inject
HOST(public domain) andBIND_HOST(bind address); build links dynamically fromprocess.env.HOST. - The proxy binds the domain with
server_name; the container only listens on0.0.0.0:8080. - Containers reach each other by container name (e.g.
http://worker:3001), never over the public network.
13. Health self-check
curl -s http://127.0.0.1:8080/api/health
# {"status":"ok","service":"api","version":"1.0.0","startedAt":"...",
# "features":["certbox.dashboard","certbox.certificates","certbox.alerts", ...],
# "timestamp":"..."}
apireturnsstatus=ok, the service name, the version,startedAtand afeatureslist of capabilities;featuresis maintained by hand and must be extended when endpoints are added.startedAttells you whether the container just restarted; when "my change did not apply", check it first, then look for the new capability infeatures.worker/api/healthreturns{"status":"ok","service":"worker"}.- The platform probes liveness at
healthcheck.pathinintematrix.deploy.json(/api/health) with a 60-second timeout.
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.
