Model Delivery API
Fastify API, Synology OIDC, group access, encrypted server credentials, MariaDB migrations and sync transactions. Includes the provider-token/session-expiry fix.
corepack enable
pnpm install --frozen-lockfile
# Copy .env.example to .env and set local credentials.
pnpm db:up
pnpm db:migrate
pnpm db:seed
pnpm dev
The development database Compose project keeps the existing model-delivery name and volume. Never reset it. Production uses the NAS MariaDB service at 10.0.0.200:3306 and does not run a database container.
pnpm typecheck
pnpm test
pnpm build
pnpm db:test:prepare
pnpm test:integration
Integration tests use only model_delivery_test. Browser E2E lives in delivery-app-web and starts this API.
Single-image NAS deployment
Install both web and API dependencies first. The staging command builds each checkout and copies only production API dependencies, compiled code, database scripts and web assets into a fresh ignored .image directory. Existing .image output is never overwritten; move it aside before rebuilding. It intentionally runs outside Docker so private Git credentials never enter build layers. Current production dependencies are platform-independent JS; review this staging method if native Node addons are introduced.
Staging uses real dependency directories so Windows junctions cannot break the Linux image. It also rejects deployed dependency versions absent from the workstation's locked install. Keep the default isolated pnpm linker for development; the staging script selects its own hoisted deployment layout.
pnpm image:stage ../delivery-app-web
docker build --platform linux/amd64 --target standalone -t localhost/model-delivery:split-repos -f infra/synology/Dockerfile .
docker save -o model-delivery-split-repos.tar localhost/model-delivery:split-repos
Podman also works; use --format docker when building, and podman save --format docker-archive. Import on the NAS with docker load -i model-delivery-split-repos.tar. Reuse your working production environment and encryption key. For a new setup, copy infra/synology/standalone.env.example to .env.production and fill it locally. The supplied compose.yaml uses the automatically created bridge network. Port 38080 is public HTTP behind Web Station HTTPS; 38081 is the separate recovery/admin HTTP listener and must remain LAN-restricted. Host mappings default to NAS loopback. Preserve your already working Web Station routing and bindings if different. host.docker.internal is an optional Docker host-gateway alias; it does not change MariaDB listener/firewall permissions.
docker compose up -d