CERMM/wiki>

Contribute

How the code is laid out

Four parts in one repository: the agent, the server, the types they share, and the web app.

FolderWhat's in it
agent/The Go agent (module cermm.it/agent).
server/The server: TypeScript run directly by Node 26.
shared/Types and rules the server and the web app both use.
src/The web app: Preact and TypeScript, built by Vite.
deploy/lxc.sh (install on Debian under systemd) and reset-password.sh.
site/cermm.it: plain static files.
wiki/This wiki: plain static files.

The agent

  • main.go: the commands (install, uninstall, enroll, run, inventory, health, version).
  • run.go: the report loop. inventory.go with platform_{linux,darwin,windows}.go: what it collects. metrics.go, health*.go.
  • jobs.go: remote commands. terminal.go and pty_*.go: the terminal. containers.go, proxmox.go, hyperv.go.
  • service.go: install and uninstall with the system's service manager (kardianos/service). trust.go: the pinned key. update.go: self-update.
  • build.sh: cross-builds into agent/dist/.

The server

Node 26 runs the .ts files as they are (type stripping): imports keep their .ts extension, and only erasable syntax is allowed (no enums, no namespaces, no parameter properties). Hono for routes, node:sqlite for the database.

  • main.ts: every route, and need(priv) on each one that changes something.
  • db.ts: SQLite (data/cermm.db). auth.ts, mfa.ts, who.ts: people, two-factor, who is asking (for the audit log).
  • jobs.ts: remote commands, signing and the audit log. alerts.ts: the alert rules. notify.ts: sending them.
  • tls.ts: certificates. proxy.ts: the reverse proxy setting. install.ts: the install lines and scripts. updates.ts: agent updates. version.ts: the version from git.
  • One file per feature: apps.ts and catalog.ts (software, batches, approval), patches.ts, scripts.ts, schedules.ts, playbooks.ts and capture.ts, terminal.ts, groups.ts, hypervisors.ts, assets.ts, docs.ts, tickets.ts, vault.ts, reports.ts.

Shared types

shared/types.ts is what the agent sends and the API returns. It mirrors agent/types.go: change both together. The other files in shared/ hold each feature's types and the rules both sides check (thresholds, script parameters, privileges).

The web app

  • core.ts: the store, routes (#devices, #software, #docs…), the sections that unfold under a page, the session, device polling, menus and toasts.
  • api.ts: calls to the server. shell.tsx: the title bar, the sidebar, keys. main.tsx: the app and its global keys.
  • pages/: one file per page. pages/common.tsx has the shared pieces (Head, Sec, Meter, Seg, formatters, usePages).
  • style.css and tokens.css: the look. attention.ts: what needs you (the Devices panel, the bell, the sidebar dot).

CERMM is in development. Something here wrong or out of date? Tell us or fix it.