Production
Build and serve the dashboard for real traffic, with the secrets it needs, behind a TLS reverse proxy, and how to scale it out.
A production frontend takes two commands, run from the AntelopeJS project that the backend is built from. ajs dms build builds the frontend from the project's configuration and installed modules, without the backend. ajs dms start serves it. You deploy the backend separately. See Deployment in the DMS guide.
Deploy
Set the configuration
Put the values in the environment of the machine or container, or in the .env file of the directory you run the commands from:
DMS_API_BASE_URL=https://api.example.com
DMS_API_PUBLIC_BASE_URL=https://api.example.com
DMS_CLIENT_BASE_URL=https://dms.example.com
DMS_BOOTSTRAP_SECRET=the backend's frontend.bootstrapSecret
DMS_SESSION_SECRET=output of openssl rand -hex 32
DMS_HTML_RENDER_SECRET=the backend's htmlRender.serviceSecret
DMS_OAUTH_RELAY_SECRET=the backend's OAuth relay secret
DMS_API_PUBLIC_BASE_URL is one of the envOverrides variables of the DMS demo template. Your project's envOverrides may read other variables.
build needs none of these values. It keeps no secret, and start computes the modules' options again from the deployment's variables. start evaluates the project's configuration with these values, as the backend does, so the variables that the project's envOverrides read must have the backend's values. With DMS_BOOTSTRAP_SECRET, start tells the backend which module versions it serves. Keep DMS_SESSION_SECRET the same across starts and restarts. See Configuration and the server's secrets.
Build
ajs project build -e production
ajs dms build
ajs project build installs the configured modules, and ajs dms build reads their frontends. The build ends by printing where it wrote the build and the ajs dms start command to run next. See ajs dms build.
Start
ajs dms start -p 3001
The server binds to 0.0.0.0 and sets Secure cookies. Run it under a process manager that restarts it, and stop it with SIGINT or SIGTERM. See ajs dms start.
Put it behind HTTPS
Terminate TLS in a reverse proxy in front of the server. Then tell the server where to read the client's address and country. Set DMS_CLIENT_IP_HEADER to the header that the platform writes the client's address in, or set DMS_TRUSTED_PROXY_HOPS to the number of proxies the server can trust. See Security.
Raise the reverse proxy's own limits for the storage's signed URLs, /file-storage/upload/** and /file-storage/files/**. The DMS layer accepts an upload body of up to 500 MiB on /file-storage/upload/**, and the server lets a request take up to an hour. See Large transfers.
On AntelopeJS Cloud, Cloudflare sits in front of the frontend and caps every request body at 100 MB at the edge, below the 500 MiB upload cap. A larger upload gets Cloudflare's own 413 and never reaches the frontend server. The app cannot raise that cap.
start serves HTTP/1.1. In production, put a reverse proxy that speaks HTTP/2 or HTTP/3 to browsers in front of it, such as nginx, Caddy or a CDN. A page loads several JavaScript chunks, and multiplexing those requests avoids the browser's limit on HTTP/1.1 connections per origin.
Where the build lives
build writes into <project>/.dms-frontend, and start serves from there. --workspace <dir> moves the build for both commands.
In a container image
An image build has neither the backend nor the secrets. The container often runs as another user, on a read-only file system. The image holds the project, so it builds the frontend from the project:
Build in the image
From the project root, after installing its dependencies, run:
ajs project build -e production
ajs dms build
The build needs no backend, no credential and no variable. It only reads the project and installs the workspace's dependencies.
Start the container
ajs dms start -p "$PORT"
Set these values in the container's environment:
DMS_API_BASE_URL,DMS_SESSION_SECRET,DMS_HTML_RENDER_SECRETandDMS_OAUTH_RELAY_SECRET.DMS_PRIVATE_OPTIONS, when a module publishes other private options.- The variables that the project's
envOverridesread. DMS_BOOTSTRAP_SECRET, so thatstartreports its module versions.
start writes nothing into the workspace.
The served output is the workspace's dist/ directory, server.mjs, server/ and the workspace's node_modules, plus the project, which start reads its configuration from. Deploy the whole dist/server directory. It holds the e-mail renderer and the translation catalogs that the renderer loads at render time.
Rebuilding
Rebuild after you install, remove or upgrade a module that ships a frontend, and after you upgrade @antelopejs/dms-frontend. Redeploy the backend from the same commit. A changed variable needs only a restart.
Once ready, start posts the name and version of each frontend module that the build serves, and its own @antelopejs/dms-frontend version, to POST /dms/frontend/ready. The backend warns when its own module versions differ, and the DMS Modules page reads the report. In development, ajs dms dev reports again after each manifest read that finds the module set unchanged. A restarted backend therefore receives the report within the three-second polling interval.
Caching in front of the server
Page documents and Inertia answers are private, no-cache by default, because they carry the visitor's session. A module can let a shared cache or a CDN cache an anonymous page with a route rule. The build pre-compresses the built assets with Brotli and gzip. The server sends the compressed copy to a browser that accepts it, with Vary: Accept-Encoding.
Built files carry their MIME type. Content-hashed files under /assets/ use public, max-age=31536000, immutable. Other files, including a layer's public/ files, use no-cache, an ETag and a Last-Modified header. Browsers revalidate them and receive 304 without a body while the files stay unchanged. Import often-used files such as fonts through CSS or code, so that Vite gives them content-hashed names under /assets/.
Scaling out
The DMS sign-in layer renews a session once per process. When a token expires, one request renews it, and the other requests with the same refresh token wait for that renewal. A deployment that runs several frontend processes must use sticky routing, so that a browser always reaches the same process. The frontend server gives no guarantee of a single renewal across processes.