¥99.90
One-time template price with installation and customization
One-click private deployment after purchase, details Live previewDeployment Guide
AssetNest runs as one container on port 8080 with a prebuilt front end and a prebuilt API bundle. This guide covers the package layout, the environment variables, what the first start writes to the database, backup and restore, upgrades, troubleshooting and the hardening steps to complete before the system holds real records.
1. What is in the package
apps/web/dist/ Production front end build (HTML, JS, CSS, fonts)
apps/api/out/index.js API, bundled to one file for Bun
apps/api/drizzle/ Migrations: sqlite/, mysql/, postgres/
Dockerfile Image that copies the build output and runs it
docker-compose.yml Local compose file, publishes port 8080
intematrix.deploy.json Platform deployment manifest (port, health check, env)
docs/ This document and the companion documents
The package does not contain node_modules, a populated data/ directory or a real .env file.
The image never installs dependencies and never builds anything; it copies artifacts and runs them.
That is why an image build is quick and why a build toolchain is not a prerequisite.
2. Prerequisites
| Requirement | Detail |
|---|---|
| Container runtime | Docker Engine 24 or newer, or any platform that runs the supplied Dockerfile |
| Bun, for the no-container path | Bun 1.4 or newer, with the same artifact layout |
| Port | 8080 reachable from the browser; only this port needs to be exposed |
| Storage | A persistent volume or bind mount for /app/data (database, uploads) |
| Memory | 1 GB is the shipped platform size and is ample for a departmental register; no throughput figure is claimed here |
| Browser | A current Chromium, Firefox or Safari; QR scanning works in any of them |
| Network | No outbound access is required at runtime; nothing phones home |
3. Quick start with Docker Compose
docker compose up -d
docker compose ps
Then open http://localhost:8080.
What the compose file does:
| Setting | Value | Note |
|---|---|---|
| Published port | ${PORT:-8080}:8080 |
The container port stays 8080; the host side can differ |
| Data volume | app-data:/app/data |
Database file and uploads survive a container rebuild |
| Restart policy | unless-stopped |
Comes back after a host reboot |
| Health check | GET http://localhost:8080/api/health |
30 second interval, 3 retries |
| Front end API mode | PUBLIC_API_MODE=http |
Real API, not the preview mode |
Stop with docker compose down. That keeps the data volume. docker compose down -v also deletes
the volume, which deletes the database - use it only when you intend to start over.
4. Running the prebuilt output with Bun
No container is required if Bun is available on the host. Run from the directory that contains the package:
NODE_ENV=production \
PORT=8080 \
BIND_HOST=0.0.0.0 \
PUBLIC_API_MODE=http \
PUBLIC_API_BASE=/api \
PUBLIC_DIR=./apps/web/dist \
MIGRATIONS_DIR=./apps/api/drizzle \
DB_DRIVER=sqlite \
DATABASE_URL=./data/sqlite.db \
UPLOAD_DIR=./data/uploads \
JWT_SECRET='replace-with-a-long-random-string' \
bun apps/api/out/index.js
NODE_ENV=production matters: static serving of the front end is enabled only in production mode.
Without it the API answers on /api but / returns nothing, which looks like a broken build.
On Windows PowerShell the same command in shell syntax:
$env:NODE_ENV='production'; $env:PORT='8080'; $env:PUBLIC_API_MODE='http'
$env:PUBLIC_DIR='./apps/web/dist'; $env:MIGRATIONS_DIR='./apps/api/drizzle'
$env:DATABASE_URL='./data/sqlite.db'; $env:UPLOAD_DIR='./data/uploads'
$env:JWT_SECRET='replace-with-a-long-random-string'
bun apps/api/out/index.js
4.1 Local development ports are different
| Context | Front end | API |
|---|---|---|
| Production container | 8080 (static front end and /api on the same origin) |
8080 |
| Local development only | 5173 (Vite dev server) |
3000 |
3000 and 5173 are development ports and have no role in a deployment. If you see either of them
in a production URL, something is running the source tree instead of the built artifacts.
4.2 How the front end learns where the API is
The front end is one build. Its runtime API mode is read from /config.js, which the API serves on
every start from two environment variables:
window.__IMX_CONFIG__ = { apiMode: "http", apiBase: "/api" };
PUBLIC_API_MODE accepts http (the deployment default) or mock. mock exists for static
preview hosting where no backend is available, and it must not be used for a real deployment. There
is no client-side probing of the backend: the mode is decided by the server that serves the
document, so a cached or half-deployed front end cannot silently attach itself to the wrong API.
5. Environment variables
5.1 Application variables
| Variable | Default | Purpose |
|---|---|---|
PORT |
8080 in the image, 3000 when unset on a host |
HTTP port the API listens on |
BIND_HOST |
0.0.0.0 |
Listen address. Keep 0.0.0.0 inside a container |
PUBLIC_API_MODE |
http |
Runtime API mode written into /config.js. mock only for static preview |
PUBLIC_API_BASE |
/api |
Base path the front end calls. Change only with a matching reverse proxy rule |
PUBLIC_DIR |
/app/public in the image |
Directory of the built front end |
DB_DRIVER |
sqlite |
sqlite, mysql or postgres |
DATABASE_URL |
data/sqlite.db under the working directory; /app/data/sqlite.db in the image |
SQLite file path, or a server DSN for MySQL and PostgreSQL |
UPLOAD_DIR |
data/uploads under the working directory; /app/data/uploads in the image |
Attachment directory; must sit on persistent storage |
MIGRATIONS_DIR |
/app/drizzle in the image |
Root of the migration folders; the dialect subfolder is chosen automatically |
JWT_SECRET |
Development fallback only | Signing key for session tokens. Set a long random value in every deployment |
STORAGE_DRIVER |
local |
Attachment storage. local is the implemented driver |
MAIL_PROVIDER |
console |
Mail adapter. console writes to the log instead of sending |
SMS_PROVIDER |
console |
SMS adapter. console writes to the log instead of sending |
CORS_ORIGIN |
* |
Allowed browser origin. Tighten to your real origin |
SUPER_ADMIN_EMAIL |
admin@example.com |
Email of the owner account created on first start |
SUPER_ADMIN_PASSWORD |
Admin@123456 |
Password of that owner account on first start |
SUPER_ADMIN_NAME |
Super Admin |
Display name of that owner account |
RATE_LIMIT_LOGIN_PER_MINUTE |
30 |
Sign-in attempts per client address per minute; 0 or less disables the limit |
5.2 Additional variables
| Variable | Default | Purpose |
|---|---|---|
NODE_ENV |
development |
Must be production for static serving and normal logging |
LOG_LEVEL |
info |
debug, info, warn or error |
MAIL_FROM |
no-reply@example.com |
Envelope sender when a real mail adapter is implemented |
WS_TICKET_TTL_SEC |
60 |
Lifetime of the one-time ticket used by the realtime socket |
Notes on the adapters: STORAGE_DRIVER=local and the console mail and SMS providers are the
implemented paths. The alternative names accepted by the configuration (s3, oss, smtp, ses,
aliyun, twilio) are placeholders whose send methods are not implemented, so setting one of them
will make that send fail loudly rather than quietly. AssetNest does not send notification mail or
SMS anywhere in its business flow, so the console default is also the correct production setting.
5.3 Setting variables
The image and intematrix.deploy.json already carry the defaults above. Override them in
docker-compose.yml, in docker compose run -e, or in the environment panel of the hosting
platform. Environment variables win over everything else; there is no configuration file to edit
inside the image.
6. What happens on first start
Starting the container against an empty data directory performs the following, in order:
| Step | Effect |
|---|---|
| Migrations | Every migration in MIGRATIONS_DIR/<dialect> is applied in order and recorded, so a restart does not replay them |
| Seed: permissions and roles | The 22 catalogue rows and the 5 roles are inserted if missing; grants are reconciled |
| Seed: menus | The console menu rows are aligned with the shipped navigation |
| Seed: owner account | One account from SUPER_ADMIN_* is created with the administrator role |
| Seed: demonstration members | Five role accounts plus fourteen demonstration colleagues |
| Seed: business data | Six categories, eight locations, twenty-four assets, requests, handovers, repairs, stocktake tasks and log history |
| Seed: configuration | Business rule defaults (30 day loan limit, 48 hour reservation, 2 day reminder, approval required) |
| Ready | The process listens on PORT and /api/health reports status: ok |
The seed is idempotent: rows are inserted only when missing, and existing rows are never overwritten. A restart therefore adds nothing and destroys nothing. Demo business data is inserted only when the corresponding tables are empty, so a database that already holds your register is left alone.
6.1 Every seeded account must change its password
All accounts created by the seed - the owner included - carry the forced-change flag. On first
sign-in the only thing a new session can reach is /change-password; every console route redirects
there until the member types the current password, chooses a different one of at least eight
characters, and saves. The page is rendered outside the console shell, so there is no sidebar to
navigate around it.
This is intentional. The seeded passwords are published in this document, in the repository readme and in the demo material, so they are effectively public. The forced change converts a published password into a private one on the first sign-in, and it is the reason a fresh deployment is not wide open even before you change the environment variables.
7. Seeded accounts
| Account | Password | Role | Notes |
|---|---|---|---|
admin@example.com |
Admin@123456 |
Administrator | Overridable with SUPER_ADMIN_EMAIL and SUPER_ADMIN_PASSWORD before the first start |
member@example.com |
Member@123456 |
Employee | Requisition and loan workflow |
asset@example.com |
Asset@123456 |
Asset administrator | Register, handover, repair, stocktake, cost visibility |
approver@example.com |
Approver@123456 |
Department approver | Approval only |
inventory@example.com |
Inventory@123456 |
Stocktake clerk | Counting only |
All five are forced to choose a new password at first sign-in. The demonstration colleagues created
by the seed share one demonstrator password, and a sixth sign-in account, demo@example.com with the
Employee role, uses that same demonstrator password. None of the demonstration accounts are intended
for real use; delete or disable them before go-live.
8. First-run configuration through the interface
Four tasks complete a deployment, and all four are done in the browser:
- Set the application identity under system settings, app identity: short name, full name, logo letters, accent colour, contact details, registration number, copyright line and favicon. The portal, the sign-in page, the sidebar, the browser tab title, the favicon and the meta description all follow immediately, with no rebuild and no restart. The values are stored in the database.
- Create members under system settings, members: account, role and one-time initial password in one step, then hand the password to the person. They are forced to change it at first sign-in.
- Remove the demonstration data: delete the demo assets, requests, handovers and stocktake tasks,
or start from a fresh empty database by deleting
data/sqlite.dbbefore the first real start. - Set the domain and a backup routine: HTTPS at the reverse proxy,
CORS_ORIGINnarrowed to the real origin, and a scheduled copy of thedatadirectory.
Also worth adjusting before go-live: the seeded categories and locations (six and eight examples), the loan limit, the reservation window, the reminder window and the approval requirement under business settings.
8.1 Rebranding beyond the identity fields
The identity fields cover the visible brand. For a deeper rebrand:
| Change | Where |
|---|---|
| Brand name, logo letters, accent colour, contacts, footer text | App identity (data, no rebuild) |
| Theme tint of the interface outside the identity fields | Front end theme CSS, requires a rebuild of apps/web/dist |
| Default identity values used when the database has no identity row | API identity defaults, requires a rebuild of apps/api/out |
| Portal product-page copy | Portal content files, requires a rebuild of apps/web/dist |
9. Data, backup and restore
9.1 What must be backed up
Exactly two things:
- The SQLite database file,
data/sqlite.db, together withdata/sqlite.db-walanddata/sqlite.db-shmwhen they exist. Copying only the main file while the write-ahead log holds pending pages loses the most recent transactions. - The upload directory
data/uploads/, which holds asset photos and attachments.
If you switch to MySQL or PostgreSQL, item 1 becomes a database dump or a managed snapshot, and item 2 is still a directory to copy. The application identity (branding) lives inside the database, so it is covered by the same backup.
9.2 The in-app export
System settings, backup and export produces a JSON snapshot of assets, requests, handovers, repairs, stocktakes, master data, business rules and members. It is a readable, archivable record for review or handover. It is not a backup that can be loaded back: there is no upload-and-restore endpoint, and the export deliberately omits password hashes.
9.3 Restore
- Stop the container:
docker compose stop. - Put the database file (and its
-waland-shmcompanions) back atdata/sqlite.db, and the attachment tree back atdata/uploads/. - Start the container:
docker compose start. Migrations run, the seed finds existing rows and changes nothing. - Sign in and check the asset count and the newest request number.
Rehearse this once on a copy of the data before you need it in an incident. A restore that has never been executed is a plan, not a capability.
10. Verifying a deployment
| Check | Expected |
|---|---|
GET /api/health |
{"status":"ok", ...} with startedAt and 23 capability names in features |
startedAt |
Changes after a restart; a stale value explains an old page |
/docs |
Interactive API reference renders |
/ |
Portal page renders with your brand name |
| Sign-in with the owner account | Forced to the change password page |
| Asset list | Twenty-four demonstration assets before you delete them |
| Create a member | The one-time password is displayed once, then never again |
| Print labels | The label page prints without the sidebar |
The features array in /api/health is the cheapest way to tell "old backend" from "code bug". If
a capability name is missing, the running container is not the build you think it is; redeploy
before debugging anything else.
11. Upgrade procedure
- Back up first: copy
data/sqlite.dbwith its-waland-shmfiles, anddata/uploads/. - Replace the artifacts: pull the new image, or replace
apps/web/dist,apps/api/outandapps/api/drizzlewhen running without a container. - Restart the process:
docker compose up -d --force-recreate, or stop and restart the Bun process. Replacing files under a running process is not enough - see the troubleshooting entry on static assets. - Watch the start log for the migration line and the listen line.
- Verify:
GET /api/health, then sign in, open the register and the workspace. - Smoke test the flow: raise a request, approve it, hand it over, return it. Two minutes of clicking catches a broken artifact layout faster than a log review.
Migrations are forward-only. Do not upgrade a production database without a tested backup, and do not attempt to run an older artifact against a database that has already been migrated forward.
12. Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Page is blank or shows old assets after the front end files were replaced | The static file plugin indexes the front end directory at start-up, so a running process still serves the old index and 404s the new hashed bundle names | Restart the container (docker compose restart). Copying files into a running container is not enough |
docker compose up fails with "port is already allocated" |
Something else owns host port 8080 | Stop the other process and run docker compose up -d again. Do not publish a different host port: the platform probes the container on 8080 |
http://localhost:8080 does not answer |
Container exited, bound to loopback only, or blocked by a firewall | docker compose ps and docker compose logs --tail=100. Confirm BIND_HOST=0.0.0.0, confirm the published port mapping, then check the host firewall |
Browser shows a network error while /api/health works from inside the container |
The published port or reverse proxy path is wrong, not the application | Check the port mapping and the proxy location / rule |
| Static assets return 404 while the API works | PUBLIC_DIR points at the wrong directory, or the front end build was replaced without a restart |
Point PUBLIC_DIR at the directory containing index.html, then restart |
Switching DB_DRIVER produces an empty system |
Each dialect has its own schema and migrations; switching the driver does not copy data | Treat it as a migration project: dump the old database, load it into the new engine with the matching schema, then point DATABASE_URL at it. Nothing is transferred automatically |
| Timestamps look shifted between two people | Timestamps are stored in UTC and rendered by the browser in each viewer's local zone; request numbers use the UTC date by design | Nothing is wrong with the data, and the product has no time-zone setting. If server log lines need a specific zone, set TZ on the container and restart; stored data does not change |
| Behind a reverse proxy, clients all appear as one address and redirects point at the wrong host | The proxy is not forwarding the original host, scheme and client address | Forward Host, X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host; allow the WebSocket upgrade for /api/ws; raise the body size limit for uploads |
| Sign-in returns 429 | Rate limit reached: 30 attempts per address per minute | Wait a minute, or raise RATE_LIMIT_LOGIN_PER_MINUTE |
| Sign-in fails for the owner after a database swap | The new database has a different owner account and password | Use the credentials that belong to the database you restored, or reset them by starting from a fresh database |
| A new member cannot get past the change password page | The password rules: current password must be correct, the new one must differ and be at least eight characters | Correct the input; the flag clears only on a successful change |
| A member signs in to an empty workspace | The member has no role, or the role has no usable block | Assign a role under system settings, members. Roles are replaced, not stacked |
| CSV import rejects part of the file | Duplicate asset numbers inside the file or already in the register, or unknown category or location codes | Download the failure report, correct the rows, upload again. The preflight never writes to the database |
/api/health lacks a capability name you expect |
The container runs an older build | Redeploy the current artifacts, then restart |
13. Security hardening
Complete these before the system holds real records.
| # | Task | Why |
|---|---|---|
| 1 | Set a long random JWT_SECRET |
The development fallback is public; anyone who knows it can mint a token |
| 2 | Change the owner password at first sign-in | The seeded password is published. The forced change enforces this, but confirm it happened |
| 3 | Delete or disable every demonstration account and all demonstration assets | Seeded credentials are public and demo rows pollute reports |
| 4 | Narrow CORS_ORIGIN to your real origin |
* lets any page call the API with a user's browser context |
| 5 | Serve over HTTPS at the reverse proxy | Tokens and passwords otherwise travel in clear text |
| 6 | Restrict /docs |
The API reference is helpful during setup and unnecessary afterwards |
| 7 | Keep the login rate limit on | A shared deployment is an attractive target for password guessing |
| 8 | Restrict access to the data directory | The database file holds personal data and password hashes |
| 9 | Schedule the backup and rehearse the restore | A backup that has never been restored is an assumption |
| 10 | Review the operation log and login log after the first week | Failed sign-ins and unexpected writes show up early |
Optional, but worth knowing: the console uses a hash router, so deep links never reach the server and
there is no server-side rewrite rule to configure. Attachments are served from /upload/... on the
same origin, so no separate media host is required.
14. Deployment topologies
| Topology | Shape | Note |
|---|---|---|
| Single container (default) | Front end and API on one origin, SQLite on a mounted volume | The intended deployment; no external services |
| Container with a database server | DB_DRIVER=mysql or postgres and a DSN in DATABASE_URL |
Use when the database is managed centrally or concurrency grows |
| Container behind a reverse proxy | Proxy terminates TLS, forwards everything to 8080 | Forward the standard headers listed in section 12 |
| Static preview only | Front end hosted elsewhere with PUBLIC_API_MODE=mock |
Evaluation only; no data is stored and no API is called |
AssetNest is single-tenant in normal use and installs one organisation per deployment. The database schema carries a tenant identifier and the API filters by it, which keeps multi-tenant hosting possible, but the product is licensed for one deployment per licence and is documented, tested and supported in the single-organisation shape.
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.
