Express API setup
Use @monque/management-express to inspect and manage jobs over HTTP from your Express
application. It includes the Management routes and an OpenAPI document.
For the browser dashboard, follow Dashboard setup.
Install
Section titled “Install”Requires Node.js 22.12 or newer and Express 5.2.1 or newer within version 5.
Mount the API
Section titled “Mount the API”Reuse your application’s initialized Monque instance:
The API is available under /ops/api/v1, with OpenAPI JSON at /ops/openapi.json.
The router does not initialize or start the scheduler. See the
Quick Start if you have not configured Monque yet.
Authentication and request context
Section titled “Authentication and request context”Mount your application’s authentication middleware before the router. It should reject
unauthenticated requests and make the authenticated principal available to later middleware.
For example, if it sets res.locals.operator:
requireOperator and the principal stored in res.locals belong to your application.
Do not treat a user ID supplied in an HTTP header as authenticated identity.
The middleware also protects the OpenAPI document.
The context callback can return a value or a promise. The value is available to
authorize, serializePayload, and serializePayloadByJobName. See
Management authorization for permission details.
Browser mutations use the Management handler’s
origin protection. Same-origin
Dashboard requests work by default; pass trustedOrigins: ["https://dashboard.example.com"]
to allow a separate Dashboard origin. Express constructs the request URL from req.protocol
and the Host header. Behind a reverse proxy, preserve the public host and configure
Express proxy trust for the public protocol, or explicitly trust the public Dashboard origin.
OpenAPI
Section titled “OpenAPI”Customize the document path and the public server URL:
This serves the document at /internal/management/docs/openapi.json. Set serverUrl to the
public Management mount URL when a reverse proxy changes the externally visible address.
By default it uses the Express mount path.
Set openApi: false to disable this route. The JSON document can be used with OpenAPI client
generators or an API documentation viewer of your choice.
Router options
Section titled “Router options”The router accepts Management options, including readOnly,
authorize, payload serializers, and parallelCapabilityChecks, plus context and openApi.
See ManagementExpressRouterOptions
for the full type reference.