¥88.80

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 1 downloads · 1 deployments General

Deployment Guide

AICopy is a single-container application: one process serves both the front-end build (SPA / HashRouter) and the /api endpoints, and the port is fixed at 8080.

  • The upload package already contains the build artifacts (apps/web/dist and apps/api/out/index.js), so the image does not install or build anything.
  • The front-end API mode is injected at runtime through /config.js (the back end writes it from PUBLIC_API_MODE); it is not a build-time constant.
  • The default database is SQLite (/app/data/sqlite.db); to switch to MySQL / PostgreSQL, see section 5.

1. Five-Minute Deployment (Inside the Platform)

  1. In the store back office, create a deployment and select this template → deploy.
  2. The platform brings up one container from intematrix.deploy.json (exposed on 8080, health check /api/health).
  3. When the deployment finishes, open the domain the platform assigned; seeing the sign-in page means it worked.
  4. Sign in with the platform super admin (default admin@example.com / Admin@123456 — change it immediately on first launch, see SUPER_ADMIN_* in section 3).
  5. Sign in with a business seed account (admin / Aicopy@2026; planner / reviewer / operator / viewer use the same password): the sign-in page has no "demo identity" entry point — that panel only exists in the shop's online preview; just type the account and password. All seed accounts are flagged "password change pending", so the first sign-in forces you to set a new password before the workbench opens. For real use, create your own accounts under Settings → Members and disable or delete the seed accounts (see section 5 of the product guide).
# The self-hosted equivalent (Docker on your own machine)
docker compose up -d
# open http://localhost:8080

The port has exactly one value, 8080: the Dockerfile (PORT/EXPOSE), meta.deploy.port in package.json, the container port in intematrix.deploy.json, the three places in docker-compose.yml, and the address in this document — five layers, all consistent. The local ports for bun run dev are 3000 (api) + 5173 (web) and are for development only; they are not deployment ports.


2. Container and Directories

Item Value Notes
Containers 1 (app, public, 8080) There is no separate worker or queue container; scheduled jobs run inside the api process
Base image oven/bun:1.4 Runs the built artifacts only; installs no dependencies
Directories in the image /app/server (api build), /app/public (front-end build), /app/drizzle (migrations), /app/data (database and uploads)
Data volume app-data → /app/data Rebuilding the container does not lose the database; SQLite is single-replica only, so do not scale out horizontally
Health check GET /api/health Returns status/features/startedAt; the platform uses it as the liveness signal
Restart policy unless-stopped

3. All Environment Variables

These can be overridden in the deployment platform (the manifest intematrix.deploy.json already supplies the defaults):

Variable Default Notes
PORT 8080 The public port, do not change it (the platform's liveness probe is fixed on 8080)
NODE_ENV production Must be production in production (otherwise the static build is not served)
PUBLIC_DIR /app/public Front-end build directory
MIGRATIONS_DIR /app/drizzle Migrations directory (run automatically at startup)
DB_DRIVER sqlite sqlite / mysql / postgres
DATABASE_URL /app/data/sqlite.db A file path for sqlite; a connection string for mysql/pg
UPLOAD_DIR /app/data/uploads Where uploaded files are written (public URL /upload/YYYY/MM/DD/x.ext)
JWT_SECRET dev-secret-change-me Must be replaced with a strong random value before going live (replacing it invalidates all old tokens, so users must sign in again)
CORS_ORIGIN * Can be tightened to the real domain when front end and back end share a domain
PUBLIC_API_MODE http Front-end API mode; mock is only for previews and offline demos, keep it on http in production
PUBLIC_API_BASE /api Front-end request prefix; generally leave it alone
STORAGE_DRIVER local local (writes to UPLOAD_DIR); s3/oss are placeholder implementations
MAIL_PROVIDER / MAIL_FROM console / no-reply@example.com Mail adapter; by default it only writes logs
SMS_PROVIDER console SMS adapter; by default it only writes logs
LOG_LEVEL info debug / info / warn / error
RATE_LIMIT_LOGIN_PER_MINUTE 30 Sign-in attempts allowed per IP per minute
WS_TICKET_TTL_SEC 60 TTL of the one-time WebSocket ticket (this template has no realtime pages, so it is kept for completeness)
SUPER_ADMIN_EMAIL admin@example.com The platform super administrator (created on first start; can reach System Tools / Monitoring / Files / AI Configuration)
SUPER_ADMIN_NAME Super Admin As above
SUPER_ADMIN_PASSWORD Admin@123456 Must be changed before going live; the change takes effect only on redeploy (it is written only when the account is first created)
AI_CONFIG_SECRET empty Passphrase used to encrypt AI keys saved in the back office; if unset, one is generated on first start and written to /app/data/ai-config-secret

The AI provider / model / key are read first from "Settings → AI Configuration" (stored encrypted in the database); the environment variables AI_PROVIDER / AI_API_KEY and friends are a fallback — they are read only when nothing is configured in the back office. If the container's egress policy blocks the network, a configured key still will not work; the platform must allow egress or provide an internal gateway.


4. How Front End and Back End Connect (config.js)

The browser loads index.html
  └── <script src="./config.js">          # served by apps/api, intercepted early in onRequest
        window.__IMX_CONFIG__ = { apiMode: 'http', apiBase: '/api' }
  └── the front-end http wrapper reads window.__IMX_CONFIG__ to decide "real request / demo data"
  • In the container it outputs http by default; to force demo mode set PUBLIC_API_MODE=mock (for previews only — the upload gate rejects mock artifacts).
  • index.html is served with no-store: after a redeploy the browser will not use old HTML that references chunks which no longer exist.
  • When deployed on the same domain, the front end uses baseURL=/api, so the reverse proxy only needs to forward /api and /upload to port 8080 of the container.

5. Switching Databases (MySQL / PostgreSQL)

  1. Set DB_DRIVER=mysql (or postgres) and DATABASE_URL=mysql://user:pass@host:3306/db.
  2. At startup migrations run automatically from apps/api/drizzle/<dialect>/.

Known limit: migrations for the business tables (ac_*) currently ship for SQLite only (drizzle/sqlite/0000–0005). MySQL / PostgreSQL have only the platform's own tables (users / roles / permissions / logs / settings). To move to MySQL or PostgreSQL you must first add the ac_* migrations — generate them with DB_DRIVER=mysql bun run --filter api db:generate, then deploy. The default delivery form is SQLite.


6. Local Development

bun install

# Front end (5173) + back end (3000) together; the front end proxies /api and /upload to 3000
bun run dev

# Front end only (mock data, no back end needed)
bun run dev:web

# Back end only
bun run dev:api

# Database migrations / seed (the dev database lives in apps/api/data/sqlite.db)
cd apps/api && bun run db:migrate
bun run seed

# Gates and tests
bun run check        # design gate + i18n gate + permission gate + type checks for all three apps
bun test             # 184 cases (route manifest, workbench tailoring, the member trio + forced password change e2e)

Development ports (not deployment ports): api 3000, web 5173. PORT=3000 only affects bun run dev.


7. Data and Backups

Location Contents
/app/data/sqlite.db All business data (members, profiles, copy, assets, logs, parameters)
/app/data/uploads/ Uploaded images and attachments
/app/data/backups/ Automatic and manual backups (retention is set by the backup.retentionDays parameter, default 30 days)
/app/data/ai-config-secret The auto-generated passphrase for AI key encryption (lose it and the keys must be re-entered)

How to back up:

  • In the application: Settings → System Tools → Backups (back up now / daily automatic backup, 30-day retention by default), downloadable.
  • Whole machine: back up the app-data volume (or docker cp the contents of /app/data out).
  • Restore: stop the container → replace sqlite.db and uploads/ with the backup → start the container (migrations are applied at startup).

SQLite is a single-writer model: do not mount one data volume into several replicas.


8. Reverse Proxy / HTTPS

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;
}
# /api and /upload live in the same container, so no separate routing is needed
  • Terminate HTTPS at the proxy; inside the container it stays http.
  • Platform deployments inject the domain and proxy automatically, so you do not write it by hand (do not hard-code a domain in code or configuration).

9. Upgrading

# 1) Pull / unpack the new version
# 2) Just restart the container: the startup hook applies new migrations + the idempotent seed (no data is cleared)
docker compose up -d --build

# 3) Verify
curl -s http://localhost:8080/api/health
  • Migrations are additive only: once a drizzle/sqlite/000N_*.sql file is published it is never modified.
  • Back up sqlite.db before upgrading (especially for a major version).
  • The seed is idempotent: demo data is written only into an empty database and never overwrites anything the buyer has changed.

10. Troubleshooting

Symptom Check first What to do
The sign-in page loads but signing in gives 502 What GET /config.js returns The proxy is not forwarding /api to the container, or the container is not up (docker compose ps)
Pages load but the data areas are empty or erroring features in GET /api/health No business capability names → you are running an old back end; redeploy
The "demo data" badge never goes away apiMode in /config.js The container's PUBLIC_API_MODE=mock was set by mistake; set it back to http and restart
Changed the brand name but pages do not update Whether you refreshed; whether PUT /api/system-config returns 200 The application info write failed (permissions/network); clear the browser cache and retry
docker compose ps stays unhealthy curl localhost:8080/api/health Port or PUBLIC_DIR misconfigured, or the database is locked (another replica is using the same data volume)
Sign-in says "account locked" 5 wrong passwords lock it for 10 minutes Wait 10 minutes, or have an administrator reset the password
Super administrator password forgotten The users table in the database Re-initializing with SUPER_ADMIN_* does not help (it only creates once); change the database directly or reset the container data
Image upload fails The upload.maxSizeMb parameter (default 100), and UPLOAD_DIR permissions Use a smaller image, or grant write permission on /app/data/uploads
AI configuration saves but still reports "not configured" AI-related errors in the logs A change to AI_CONFIG_SECRET means the old key can no longer be decrypted → enter the key again
Some errors on the English site are in Chinese Known limitation The front end supplies an English fallback by error code; the original is in the console

11. Packaging and Uploading (Maintainers)

bun install
bun run build        # front-end production build + single-file back-end artifact (apiMode in dist/.build-meta.json must be http)
bun run check:dist   # prints "dist mode: http"
bun run pack         # → aicopy-platform-upload.zip (Chinese-named entries carry the UTF-8 flag)
bun run verify:upload # only upload when all 35 checks are green

The whole chain in one command:

bun run pack:upload   # check → check:i18n → test → build → check:dist → pack → verify

Do not upload artifacts from build:mock: the store's upload gate rejects mock artifacts (previews get mock injected by the store's preview service). Do not package with Windows' built-in tar.exe: Chinese document names get mangled (the encoding and self-check are already handled in scripts/zip-pack.py).


12. Redeploying After Customization

  1. Change the code → bun run check && bun test.
  2. New data tables: apps/api/src/aicopy/db/schema.sqlite.ts → bun run sync:ac-schema → bun run db:generate.
  3. New endpoints: write them in apps/api/src/aicopy/services/*.routes.ts, register them in aicopy/index.ts, and add permission codes to aicopy/permissions.ts (bun run check:perm will block you otherwise).
  4. New pages: keep views/ + aicopy/routes.tsx + aicopy/menu.ts + routes/manifest.ts in agreement (bun test validates this).
  5. bun run build → bun run pack → re-upload / redeploy.

13. Domain Conventions

  • The template never hard-codes a domain: the same package runs in different deployments, and the platform assigns the domain per deployment id.
  • Wherever an absolute URL is needed (export download links, callbacks), it is derived from the request Host / X-Forwarded-Proto.
  • The reverse proxy only needs to pass through the three headers Host, X-Forwarded-For and X-Forwarded-Proto.

14. Health Self-Report

curl -s http://localhost:8080/api/health | head -c 400

It returns something like:

{
  "status": "ok",
  "service": "api",
  "features": ["aicopy.auth", "aicopy.generate", "aicopy.review", "..."],
  "startedAt": "2026-11-25T09:12:33.000Z"
}

features is a hand-written capability list: when you add an endpoint, add it here too. Troubleshooting order (do not skip steps): ① look at apiMode in /config.js → ② look at features in /api/health → ③ only then look at the browser console. A missing target capability in features means the environment is running an old back end (redeploy); if it is present but the endpoint 404s, only then is it a code problem.

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