One Express process composes a tree of feature modules with identical models/routes/setup.js shape, each receiving a shared "s" toolkit during a synced/init/started lifecycle.
The backend is a single Node 20 process started by npm start. It is responsible for
serving the Essence SPA, hosting the
Configure admin app, exposing the JSON API under /api,
proxying to optional adjacent Python services, and
upgrading certain connections to a WebSocket for real-time collaboration. The code
lives in two top-level directories: scripts/ (process entry points) and API/
(Express composition plus the feature-module tree).
The shape worth holding in your head: there is one setup lifecycle that scans
API/Backend/<Name>/setup.js and gives every feature module the same toolkit (the s
object — Express app, auth guards, permissions, root path, common middleware). Every
feature module follows the same models/ + routes/ + setup.js layout. That
uniformity is what makes the backend extensible without a framework, and it is also
what makes the plugin-backend convention work (drop a *Plugin-Backend* directory,
have it match the same shape, restart). Read server bootstrap
first; the other two pages assume you understand how feature modules are mounted and
where session/auth state comes from.
In this component
-
Server bootstrap and middleware — the boot order from
npm startto a serving Express app:init-db.jswaits on Postgres and runs migrations,scripts/server.jscomposes Express (sessions first, then helmet, body parsing, swagger/OAS, static SPA),setups.jsdiscovers and mounts every backend feature module viaonceInit/onceSynced/onceStartedhooks, andAPI/websocket.jsattaches anoServer: trueWS upgrade. Also covers the four reusable guard middlewares and thestoolkit object passed to feature modules. -
Feature modules under API/Backend — the canonical module shape (
setupTemplate.js), and a guided tour of the modules that matter: Datasets and Geodatasets (vector data + spatial queries), Draw (real-time drawing with WS push), Config (mission/layer config CRUD that powers ), Stac (proxy to the adjacent STAC service), Webhooks, Shortener, GeneralOptions, Utils. Auth modules (Accounts, Users, LongTermToken) follow the same shape but are covered on the next page. -
Auth, accounts, and sessions — sign-up, sign-in, the first-user-becomes-admin flow, the
connect-pg-simple-backed session store, and the parallel long-term-token path used for programmatic access. Also: how routes declare auth requirements via theensureUser/ensureAdmin/ensureGroup/stopGuestsguards from thestoolkit.
The natural reading order is bootstrap → feature-modules → auth, but if you are here
to add a backend feature, jump straight to feature-modules and follow the
setupTemplate.js shape.
The separate React 17 admin SPA under configure/, served at /configure. Its own
react-scripts build, its own React major version. Writes the JSON config blob that
Essence reads at boot. See Configure.
The Postgres spatial extension MMGIS depends on. Installed by init-db.js via
CREATE EXTENSION IF NOT EXISTS postgis. Backs every Geodataset, Draw user-feature,
and spatial query.
In this component
- Server bootstrap and middlewareHow the MMGIS process starts, composes Express, mounts feature modules via the setup lifecycle, and attaches the WebSocket server.
- Feature modules under API/BackendThe repeating shape every backend feature follows, and a tour of the modules that matter (Datasets, Geodatasets, Draw, Config, Stac, Webhooks, Shortener, etc.).
- Auth, accounts, and sessionsHow users sign in, the first-user-becomes-admin flow, long-term tokens for programmatic access, and Postgres-backed Express sessions.
How the MMGIS process starts, composes Express, mounts feature modules via the setup lifecycle, and attaches the WebSocket server.