Skip to content

Development

For people working on Nexus itself. To install and run it, see Installation.

Layout

crates/
  core-api/       Axum server: SSO, sessions, state engine, vault, admin and leader APIs,
                  account overview, Discord, tunnel supervisor, embedded web app
  esi-engine/     ESI client (ETag cache, rate limits, error budget), job queue, SDE importer,
                  name resolution
  shared-models/  Shared SQLx / serde types
migrations/       SQLx migrations, applied automatically at startup
web/              React 19 + Vite + Tailwind 4 (built into core-api)
docs/             Wiki, roadmap, design notes, decisions, threat model

Build

cd web; npm install; npm run build; cd ..   # first: core-api embeds web/dist
cargo build --release -p core-api

Passkeys use webauthn-rs, which links OpenSSL. On Debian or Ubuntu install pkg-config and libssl-dev. On Windows install OpenSSL for Windows (the full Win64 package, not "Light"), then point the build at it and put its DLLs on PATH for tests:

$env:OPENSSL_DIR = "C:\Program Files\OpenSSL-Win64"
$env:PATH = "C:\Program Files\OpenSSL-Win64;C:\Program Files\OpenSSL-Win64\bin;$env:PATH"

The release binary serves the web app itself. It reads its settings from the environment, or from a .env file in the folder it starts in (or any parent folder).

Tests

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

Tests that need PostgreSQL are skipped unless DATABASE_URL is set. Point it at a disposable database: the tests apply migrations themselves and the queue test clears background_jobs. SDE_LIVE=1 also runs a live import of CCP's current SDE.

docker run -d --name nexus-pg -e POSTGRES_USER=nexus -e POSTGRES_PASSWORD=devpass -e POSTGRES_DB=nexus -p 127.0.0.1:55432:5432 postgres:17-alpine
$env:DATABASE_URL = "postgres://nexus:devpass@127.0.0.1:55432/nexus"
cargo test --workspace

Running locally

  • Server: cargo run -p core-api with a .env holding at least DATABASE_URL, VAULT_MASTER_KEYS and EVE_CLIENT_ID. It listens on :8080.
  • Web app with hot reload: run npm run dev in web/ (port 5173). It proxies /api, /sso and /oauth2 to :8080.
  • Set PUBLIC_URL=http://localhost:5173 while you do this.
  • Otherwise the SSO callback lands on 8080, and the same-origin check rejects changes made from 5173.
  • Browse to localhost, not 127.0.0.1: browsers treat them as different sites.

EVE names

IDs are turned into names on the server.

  • From CCP's SDE: types, groups, categories, systems, constellations, regions and factions. It is imported at startup and re-checked every 6 hours. A fresh install shows raw IDs until the first import finishes, which takes about 10 seconds.
  • From ESI /universe/names: characters, corporations, alliances. These are cached in eve_entity_names for 7 days.
  • Stations: GET /universe/stations/{id}/ (public). Cached the same way.
  • Player structures: GET /universe/structures/{id}/ with that character's token. The sign-in asks for esi-universe.read_structures.v1 together with Skills & clones. A name is cached for 7 days. A 403 (the character cannot dock) is cached for that character for a day and shown as the solar system name plus "structure" when the system is known. If the token does not have the scope, the page asks the pilot to grant it and does not call ESI.
  • For the web app: signed-in clients can call GET /api/v1/universe/names?ids=… and GET /api/v1/universe/types?ids=…, up to 1000 IDs at a time.

Conventions

  • Pages: new modules use the design tokens in web/src/index.css (bg-surface, border-line, text-accent…), never hex colours. Lists are paged at 50, and a page may never show sample data.
  • Server: every change an admin or leader makes is written to audit_logs, and every write checks the request's origin.
  • Commits: the wiki changes in the same commit as any setup or behaviour change.