¥129.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewBouquetBuildLite — Deployment Guide
This guide is for the person who has to get the system running. Section 1 gets the storefront up in about five minutes; the rest covers configuration, backups, upgrades, troubleshooting, and how to rebuild the upload package after customization.
The system is one container. The same port 8080 serves the API and the built front end; the database is a SQLite file inside the container, and uploaded photos live in the same data directory.
1. Five-minute deployment
You need a machine with Docker and Docker Compose (Linux or macOS; on Windows, use WSL or Docker Desktop) and outbound network access to pull the base image.
# 1) unzip the upload package
unzip bouquetbuildlite-platform-upload.zip -d bouquet
cd bouquet
# 2) start it
docker compose up -d
# 3) watch the log until it is listening on 8080
docker compose logs -f app
Open http://localhost:8080:
- The root path is the customer storefront in a real deployment.
http://localhost:8080/#/loginis the staff login page. In a real deployment it offers email + password only: sign in as the owner withadmin@example.com/Admin@123456. (Phone + code sign-in is available in the mall mock preview and local development only; the production API returns a fixed 404 for it, so the shared demo code cannot become a back door.)- After signing in you land on the admin console at
#/admin, with the dashboard and 16 demo orders.
The first start does three things automatically, so there is no SQL to run by hand: create or upgrade the tables, seed the demo data, and create the super admin account. Every later start is idempotent and does not duplicate anything.
Three things to change before going live: the super admin password, the super admin email, and the demo staff accounts (see section 11 of the Permissions Guide).
2. What is in the package and what the container does
| Content | Purpose |
|---|---|
apps/web/dist |
Production front-end build (pages, styles, images, config.js) |
apps/api/out |
Compiled API (a single index.js) |
apps/api/drizzle |
Database migrations, one folder per database type |
Dockerfile |
Three jobs: base image, copy the built output, start |
docker-compose.yml |
Port, volume, health check, restart policy |
intematrix.deploy.json |
Deployment description: single container, port 8080, health path |
The container's responsibilities are narrow:
- The base image is
oven/bun:1.4and the working directory is/app. - Nothing is installed or built inside the image. The three outputs above are copied in, and Bun runs the compiled
server/index.jsdirectly. - Port
8080inside the container; the published port comes from thePORTvariable and also defaults to 8080. - The API serves the front end on the same port, so you do not need a second container or Nginx to get it running (a reverse proxy in front is still recommended in production, for HTTPS).
- Persistence: the database at
/app/data/sqlite.dband uploads at/app/data/uploadsboth live on the named volumeapp-data. Recreating the container keeps the data;docker compose down -vdeletes the volume too. - The health check requests
/api/healthevery 30 seconds and marks the container unhealthy after three failures. - The restart policy is
unless-stopped, so the service comes back after a machine reboot. - Run exactly one replica. SQLite is a single file; concurrent writers from several replicas will conflict. Move to MySQL or PostgreSQL before scaling out.
3. How front end and back end find each other
Understanding this saves most of the "blank page" and "API 404" incidents.
The built
index.htmlloads./config.jsas its first action (a relative path, so it follows the page).When the browser requests
/config.js, the API intercepts that path and returns a script built from the environment:window.__IMX_CONFIG__ = {"apiMode":"http","apiBase":"/api"};The front end reads that configuration to decide whether to use the real API or in-memory demo data, and what prefix to call.
As a result, the same front-end build can talk to a real backend in one environment and act as a pure demo site in another. You do not package a separate demo build.
Details that matter:
PUBLIC_API_MODEdefaults tohttp. Only an explicitmockswitches the whole site to in-memory demo data; the front end then shows a "demo data, no backend" badge. A self-hosted environment that wants a pure demo can set it tomock.PUBLIC_API_BASEdefaults to/api. Same-origin deployments do not need to change it. If the API lives on another domain or under a sub-path (for examplehttps://api.example.com/api), either an absolute URL or a sub-path works./config.jsis sent withno-store, so changing the environment and restarting the container takes effect immediately.index.htmlis alsono-store, so a redeploy never leaves browsers holding an old HTML file that references deleted assets.- Front-end asset paths are relative (
assets/...), so deploying under a sub-directory works; pointPUBLIC_API_BASEat the real API path in that case. - The online preview environment injects its own
{ "apiMode": "mock" }; that is unrelated to production. The preview stops at the entry and login screens and requires clicking a demo identity, so it does not sign anyone in automatically.
4. Environment variables
Most of these already have defaults inside the container (see Dockerfile and docker-compose.yml). Override only what you need. Items marked with a warning must be changed.
| Variable | Container default | Purpose | Notes |
|---|---|---|---|
PORT |
8080 |
Listening port | Compose also uses it for the published port; change it there to expose a different port |
NODE_ENV |
production |
Runtime environment | Must be production in production or the front end is not served |
JWT_SECRET |
dev-secret-change-me |
Signing key for sessions | Required change: use a long random string. Changing it signs everyone out |
DB_DRIVER |
sqlite |
sqlite, mysql or postgres |
Switching also requires a matching DATABASE_URL and a running server |
DATABASE_URL |
/app/data/sqlite.db |
Database connection | A file path for SQLite; mysql://user:pass@host:3306/db for MySQL; postgres://user:pass@host:5432/db for PostgreSQL |
PUBLIC_DIR |
/app/public |
Front-end output directory | Usually unchanged |
UPLOAD_DIR |
/app/data/uploads |
Upload storage | Must be on the mounted volume, or photos disappear when the container is recreated |
MIGRATIONS_DIR |
/app/drizzle |
Migration scripts | Usually unchanged |
PUBLIC_API_MODE |
http |
Front-end runtime API mode: http or mock |
Default http; mock turns the site into a pure demo |
PUBLIC_API_BASE |
/api |
API prefix used by the front end | Unchanged for same-origin deployments |
SUPER_ADMIN_EMAIL |
admin@example.com |
Super admin created on first start | Change before going live; an existing account is not recreated |
SUPER_ADMIN_NAME |
店主 |
Super admin display name | Optional |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
Initial super admin password | Change before going live. Changing the variable later does not reset an existing account; reset it in the admin console |
CORS_ORIGIN |
* |
Allowed origins | Keep * for same-origin. Split deployments should list the site origin, comma separated |
LOG_LEVEL |
info |
debug, info, warn or error |
Use debug while troubleshooting |
STORAGE_DRIVER |
local |
File storage: local writes to UPLOAD_DIR |
s3 and oss are placeholder adapters and have no effect |
MAIL_PROVIDER |
console |
Mail driver: console logs only |
smtp and ses are placeholders |
MAIL_FROM |
no-reply@example.com |
Sender address | Only meaningful with a real mail driver |
SMS_PROVIDER |
console |
SMS driver: console |
The staff verification code is a fixed demo value; a real provider needs code changes |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
Login and registration attempts per IP per minute | The checkout endpoint uses the same value. Zero or below disables limiting; do not disable it on the public internet |
WS_TICKET_TTL_SEC |
60 |
WebSocket one-time ticket lifetime in seconds | Usually unchanged |
AI_PROVIDER, AI_API_KEY, AI_BASE_URL, AI_MODEL, AI_CAPABILITIES |
empty | The template's AI assistant endpoints | Can be left empty; nothing in the shop depends on them |
Two ways to apply changes:
# Option 1: edit the environment block in compose, then recreate
docker compose up -d --force-recreate
# Option 2: put a .env file next to compose; compose reads it automatically
echo "JWT_SECRET=$(openssl rand -hex 32)" >> .env
docker compose up -d --force-recreate
Note that changing SUPER_ADMIN_PASSWORD does not change an existing password. The account is created on the first start only. Afterwards, reset it in the admin console under staff accounts, or start from an empty database (which also deletes everything else).
5. Local development
Bun 1.4 or newer is required; Node will not work.
bun install # install dependencies
bun run dev:api # API on http://localhost:3000, docs at /docs
bun run dev:http # front end on http://localhost:5173 against the real API
bun run dev:mock # front end only, no backend needed
bun run dev # both, in http mode (the API must already be running)
- Locally the API listens on 3000 (the default when
PORTis not set), and Vite proxies 5173 to it. - Local data lives in
apps/api/data/sqlite.dbwith uploads inapps/api/data/uploads. - The repository deliberately has no
.env.development: it made--mode httpand--mode productionbuilds pick the wrong API mode.dev:mockandbuild:mockread.env.mock; every other mode defaults tohttp. dev:apirestarts on backend changes anddev:httphot reloads the front end. After editing translation dictionaries, restart the front end (switching language reloads the page).
6. Data and backups
| Content | Location | Notes |
|---|---|---|
| Database | /app/data/sqlite.db plus -wal and -shm |
Orders, flowers, staff, logs and shop settings all live here |
| Uploads | /app/data/uploads/YYYY/MM/DD/... |
Packing photos and card photos; public links are /upload/... |
| Volume | app-data |
Both of the above are stored on it |
Minimal backup:
# 1) stop the service so nothing is written mid-copy
docker compose stop app
# 2) archive the whole data directory
docker run --rm -v bouquet_app-data:/data -v "$PWD":/backup alpine \
tar czf /backup/backup-$(date +%F).tar.gz -C /data .
# 3) start it again
docker compose start app
Restore by stopping the service, unpacking the archive back onto the same volume, and starting again. Moving to another machine means copying the data directory and running docker compose up -d there.
Reset (deletes orders and uploads; use with care):
# container deployment: drop the volume
docker compose down -v
docker compose up -d
# local development: remove the files and restart the API
rm -rf apps/api/data/sqlite.db* apps/api/data/uploads
bun run dev:api
After a reset the demo data is written again (16 orders, 20 sellable flower varieties, and so on). If you only want to clear business data while keeping accounts, delete rows in the database instead of the file.
7. Reverse proxy and HTTPS
The container does not terminate TLS; certificates belong on the proxy in front. A minimal Nginx configuration:
server {
listen 80;
server_name your-domain.example.com; # provided by your environment; never hardcode it in code
client_max_body_size 12m; # uploads default to 10MB; leave some headroom
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
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_set_header Upgrade $http_upgrade; # required for WebSocket
proxy_set_header Connection "upgrade";
}
# never cache these two: runtime config and the hashed entry page
location = /config.js { proxy_pass http://127.0.0.1:8080; add_header Cache-Control "no-store"; }
location = / { proxy_pass http://127.0.0.1:8080; add_header Cache-Control "no-store"; }
}
Terminate HTTPS on 443 with Certbot or your cloud certificate; the hop to the container can stay HTTP.
Points to keep in mind:
- Preserve
X-Forwarded-For, or login logs and rate limiting will see the proxy address instead of the client. - Uploads are limited to 10MB; do not set the proxy limit lower.
- If a CDN sits in front, make sure
/config.js,/and/api/*are passed through, not cached. - To publish a different host port, change the compose mapping (for example
"8081:8080"); the container still listens on 8080.
8. Upgrading
Back up the data directory first (previous section).
Unzip the new package and overwrite the old
apps,Dockerfileanddocker-compose.yml. Leave theapp-datavolume alone.Rebuild and restart:
docker compose up -d --buildDatabase migrations run automatically at startup; there is no SQL to execute by hand. If a migration fails the container exits, and the log names the file and statement.
Verify:
curl http://localhost:8080/api/healthreturnsstatus: ok, the home page loads, and the admin console shows orders.
Upgrade notes:
- When coming from an older package, confirm that port, volume and health path in
docker-compose.ymlmatch the new one. - If a release renames a variable, add the new name using its own guide. Missing variables fall back to code defaults, which may not be what you want.
- Rollback: restore the previous package and run
docker compose up -d --buildagain. The schema may already have been upgraded, so confirm the old version can read the new tables, or roll the backup back together with the code.
9. Troubleshooting
| Symptom | Most likely cause | What to check and do |
|---|---|---|
| 502 Bad Gateway | Container not running, or wrong port | docker compose ps; docker compose logs --tail=200 app; confirm the proxy targets 8080 |
| Blank page | Static output missing from the image, or PUBLIC_DIR wrong |
ls /app/public/index.html inside the container; PUBLIC_DIR must be /app/public |
| Page loads but every API call 404s | PUBLIC_API_BASE does not match the real prefix, or the proxy does not forward /api |
Inspect the request URL in the browser; curl http://localhost:8080/api/health |
| Page shows "demo data (no backend)" | PUBLIC_API_MODE is set to mock |
curl http://localhost:8080/config.js; set it back to http and restart |
| Login always returns 401 | Wrong password, disabled account, or a new JWT_SECRET invalidating old sessions |
Try the super admin email and password; read the failure reason in the login log; sign in again after a secret change |
| Phone login says the number is not staff | The number is missing from the staff phone directory | Add it in the admin console, or check for a typo |
| Migration fails and the container restarts in a loop | Corrupt database file, full disk, or missing migrations | Read the SQL file named in the log; confirm /app/drizzle exists; restore a backup if needed |
| Uploaded photos 404 | UPLOAD_DIR is not on the volume, or the proxy drops /upload |
Confirm UPLOAD_DIR=/app/data/uploads; forward /upload as well |
| Uploads return 413 | Proxy body limit too small | Raise client_max_body_size above 12m |
| Port already in use | Another service on the host uses 8080 | Change the compose mapping to "8081:8080" and use 8081 |
| Checkout says the slot is full | Daily or per-slot cap reached | This is a business rule, not a fault; pick another slot or adjust shop settings |
| Dispatch does nothing | Packing not finished, card not verified, or an exception is open | Recheck the packing page; read the exception notice on the order detail |
10. Building and uploading the package
After changing code and before handing the build to a deployment environment, produce the package with one command:
bun run pack:upload
It runs six steps and stops at the first failure:
| Step | Command | What it checks |
|---|---|---|
| 1 | bun run check |
Type checks for both apps plus bilingual coverage |
| 2 | bun test |
Route areas, menus, demo data, API tests |
| 3 | bun run build |
Production front-end build and API compile; the front end is marked apiMode=http |
| 4 | bun run check:dist |
Output mode must be http, and index.html, config.js, assets and migrations must all be present |
| 5 | packaging | Creates the upload zip, by default one level above the project, named after the project with an -upload.zip suffix |
| 6 | bun run verify:upload |
Several dozen checks on the package: required files, every asset referenced by index.html present, output mode, Dockerfile copies instead of building, port 8080, UTF-8 filename flags, document manifest completeness |
Hard requirements:
- The upload package must be a production build (
apiModeishttpinapps/web/dist/.build-meta.json). A package built withbuild:mockis rejected at step 4. - To look at the demo locally, run
bun run dev:mockorbun run build:mock. Do not upload that output. check:distprints a line readingdist 模式:http; only then has it passed.- The upload package excludes
node_modules, local databases, logs and uploaded files.
11. Redeploying after customization
- Change code locally and test with
bun run dev:apiandbun run dev:http. - Run
bun run checkandbun testto confirm you did not break a rule (pricing, status machine and permissions are the usual casualties). - Run
bun run pack:uploadto produce the package. - Copy the package to the server and follow section 8: overwrite the files, run
docker compose up -d --build, verify the health endpoint. - If you changed the schema, confirm the new migration file is inside the package under the folder for your database type. Migrations apply automatically at startup.
- If you renamed or added environment variables, update the deployment configuration; otherwise the code defaults apply.
12. Domains and paths
- Neither the code nor these documents hardcode a domain. Every request path is relative (default
/api), and uploaded files use relative/upload/...links. - The domain is injected by the deployment environment (the proxy
server_name, or the address a platform assigns). Changing domains needs no code change and no rebuild. - Do not hardcode internal network addresses in
intematrix.deploy.json: nonetwork.subnet, no static containerip. The platform allocates a subnet per host and shifts it when occupied; a hardcoded address fails the deployment precheck ("static ip ... not inside the deployment network subnet"). Use container-name DNS or the injected<NAME>_HOST/_PORT/_IP. - Deploying under a sub-path (for example
https://example.com/shop/) works because asset paths are relative; pointPUBLIC_API_BASEat the real API location. - For split deployments (front end on one domain, API on another), set
CORS_ORIGINon the API to the front-end origin andPUBLIC_API_BASEon the front end to the API address.
13. How to prove it is alive
Three checks, from coarse to fine:
API health.
curl http://localhost:8080/api/healthreturns something like{ "status": "ok", "service": "api", "version": "1.1.0", "features": ["shop.home", "shop.catalog", "staff.packing", "..."], "startedAt": "2026-01-01T00:00:00.000Z", "timestamp": "2026-01-01T00:00:00.000Z" }A
statusofokwith HTTP 200 means the process is up and routes are registered. This is the address the platform health checks use (the compose health check and/api/healthinintematrix.deploy.json).featuresis this package's capability list (26 entries): if an API call 404s, first check whether the capability is listed — missing means the container runs an older build (redeploy), listed means it is a code issue.startedAtis the process start time, useful to tell whether the container restarted.Runtime configuration.
curl http://localhost:8080/config.jsshould returnwindow.__IMX_CONFIG__ = {"apiMode":"http","apiBase":"/api"};If it says
mock, the whole site is running on demo data, which is usually the real reason "the data looks wrong".Pages and business flow. The home page opens the storefront and you can pick flowers through to checkout.
/#/loginsigns the owner into the admin console and shows the order list. Once those pass, the front end, the API, the database and static hosting are all working.
Also: API documentation is at /docs (Swagger). It is enabled in production as well, which helps integration work; if you would rather not expose it, block /docs at the proxy. To see how long the process has been running, along with memory and active sessions, open system monitoring in the admin console.
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.
