← Overview
Key idea

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 start to a serving Express app: init-db.js waits on Postgres and runs migrations, scripts/server.js composes Express (sessions first, then helmet, body parsing, swagger/OAS, static SPA), setups.js discovers and mounts every backend feature module via onceInit / onceSynced / onceStarted hooks, and API/websocket.js attaches a noServer: true WS upgrade. Also covers the four reusable guard middlewares and the s toolkit 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 the ensureUser / ensureAdmin / ensureGroup / stopGuests guards from the s toolkit.

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.

Open in glossary →

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.

Open in glossary →

In this component

Read next
Backend (API server) — Server bootstrap and middleware

How the MMGIS process starts, composes Express, mounts feature modules via the setup lifecycle, and attaches the WebSocket server.