Skip to content

GHOSTS Frontend

The GHOSTS Frontend is an Angular 22 single-page application that provides a management interface for the GHOSTS framework. It communicates with the GHOSTS API via REST and SignalR WebSocket.

Docker image: dustinupdyke/ghosts-frontend (port 4200 / 80 inside container) Source: src/Ghosts.Frontend/


Installation

The frontend is included in the standard docker-compose.yml. No separate setup is required.

To run it standalone:

ghosts-frontend:
  image: dustinupdyke/ghosts-frontend
  container_name: ghosts-frontend
  ports:
    - "4200:80"
  environment:
    API_URL: http://YOUR-API-HOST:5000/api
    N8N_API_URL: http://YOUR-N8N-HOST:5678
    GRAFANA_URL: http://YOUR-GRAFANA-HOST:3000

Local Development

cd src/Ghosts.Frontend
npm install
npm start        # serves on http://localhost:4200 with hot reload
npm run build    # production build to dist/
npm test         # run unit tests

Edit src/assets/config.json to point at your API:

{
  "apiUrl": "http://localhost:5000/api",
  "n8nApiUrl": "http://localhost:5678",
  "grafanaUrl": "http://localhost:3000"
}

Features

The top bar holds Objectives, Scenarios, Executions and Assessment on the left, and NPCs, Timelines and Workflows on the right. NPCs and Timelines each have a dropdown for their related pages.

Objectives

Define training objectives and track them across runs:

  • Types: MET, JMET, Rehearsal, Onboarding, Tool Training
  • Priority, success criteria, assignee, and nested sub-tasks
  • Status: Draft, Active, Achieved, Partially Met, Not Met
  • Score each task Trained, Practiced, or Untrained

Machines

View all registered GHOSTS client machines. From the machine list you can:

  • Search by name, ID, or status
  • View a machine's full activity history
  • Push a new timeline update to a specific machine
  • Add machines to groups
  • View the machine's current timeline and survey data

Machine Groups

Organize machines into groups for bulk operations:

  • Create, rename, and delete groups
  • Add or remove machines from a group
  • Deploy a timeline to all machines in a group simultaneously

Timelines

Browse and manage timeline templates:

  • View all timeline handler definitions
  • Create new timelines or edit existing ones
  • Assign a timeline to a specific machine or group

See timeline configuration for the timeline JSON format.

NPCs

Manage generated NPC personas:

  • Browse all NPCs with their profile attributes (name, rank, unit, career, etc.)
  • View an NPC's social connections and relationships
  • Generate new NPCs using the Animator (configurable count and parameters)
  • View and assign NPC actions via the NPC action menu

Scenarios

Plan training and exercise scenarios. Each scenario has tabs for Scenario Parameters, Technical Environment, Simulation Mechanics, Timeline, Document, and Entities & Graph. Scenarios can also be authored with the Scenario Builder.

Executions

Run a scenario and follow it live:

  • Create an execution from a scenario
  • Start, pause, stop, or cancel a run
  • Tabs for Timeline, Overview, Events, Metrics, NPCs, and Terrain
  • Set and clear flags; mark manual timeline items complete
  • Open the run on a full-screen map

Assessment

Embedded Grafana panels for all runs, plus run-specific panels when you pick a run.

Activities and Social

Under the NPCs menu:

  • Activities Overview: NPC activity list
  • Live Network: live graph of NPC activity, opened in its own tab
  • Social: each NPC's knowledge topics, preferences, and connections

Workflows (n8n)

Schedule n8n webhook-triggered workflows on a cron schedule:

  • Browse active n8n workflows fetched from the n8n API
  • Select a webhook workflow and set a cron schedule (5- or 6-field)
  • The GHOSTS API calls the workflow's current webhook URL at each scheduled time
  • A live execution log (via SignalR) shows each result: timestamp, workflow name, HTTP status, and any error detail
  • Stop a running schedule at any time

Prerequisites: Set N8N_API_URL and N8N_API_KEY environment variables on the GHOSTS API container. Workflows must be Active in n8n (the toggle in the n8n workflow editor) before scheduling.


Real-Time Updates

The frontend maintains a SignalR WebSocket connection to /api/hubs/activities for:

  • Live NPC animation events (social graph updates, belief changes, chat messages)
  • Workflow execution results from the scheduler
  • Machine connectivity events

The execution pages connect to /api/hubs/execution?executionId=…, and the Scenario Builder connects to /api/hubs/scenarioBuilder?scenarioId=….


Appearance

The UI has light and dark themes. It follows the operating system setting until you use the toggle at the right of the top bar; that choice is saved in the browser. Colours are CSS custom properties (--gh-*) defined in src/styles.scss, and Angular Material is themed from them.


Architecture Notes

  • Standalone Angular components throughout — no NgModules.
  • Signals (signal(), computed()) used for reactive state; compatible with ChangeDetectionStrategy.OnPush.
  • Material Design components via @angular/material.
  • Runtime configuration is loaded from /assets/config.json before the application bootstraps, making it possible to inject environment-specific URLs into the Docker image at startup via the docker-entrypoint.sh script.