Your data

High Command has no backend, store or API client of its own. Every piece takes plain props and hands back callbacks, so it sits on whatever you already run: REST, GraphQL, a websocket or a query library.

Data goes in as props

Fetch however you like and map your rows onto the piece's type. Here a shipment layer refreshes from your own endpoint every fifteen seconds.

import { useEffect, useState } from "react";
import { CommandMap, ShipmentLayer, type MapShipmentPoint } from "@/components/highcommand/map/command-map";

// your own endpoint, your own shape: map each row onto the layer's point
type Row = { id: string; lng: number; lat: number; late: boolean; ref: string };

function useShipments() {
  const [rows, setRows] = useState<MapShipmentPoint[]>([]);
  useEffect(() => {
    let on = true;
    const load = async () => {
      const res = await fetch("/api/shipments");
      const data: Row[] = await res.json();
      if (on) setRows(data.map((s) => ({
        id: s.id, lng: s.lng, lat: s.lat, reference: s.ref, mode: "ftl",
        status: s.late ? "late" : "on_track",
      })));
    };
    load();
    const timer = setInterval(load, 15000);
    return () => { on = false; clearInterval(timer); };
  }, []);
  return rows;
}

export function LiveShipments() {
  const shipments = useShipments();
  const [selected, setSelected] = useState<string | null>(null);
  return (
    <CommandMap label="Shipments" center={[-96.9, 30.9]} zoom={6}>
      <ShipmentLayer shipments={shipments} selectedId={selected} onSelect={setSelected} />
    </CommandMap>
  );
}

Actions come back as callbacks

When someone acts (assigns a job, selects a shipment, opens a figure), the piece calls you. It never writes anywhere itself.

import { JobQueue } from "@/components/highcommand/dispatch/JobQueue";
import type { DispatchDriver, Job } from "@/lib/highcommand/dispatch";

export function Unassigned({ jobs, drivers, reload }: { jobs: Job[]; drivers: DispatchDriver[]; reload: () => void }) {
  return (
    <JobQueue jobs={jobs} drivers={drivers} now={Date.now()}
      onAssign={async (jobId, driverId) => {
        await fetch("/api/assignments", { method: "POST", body: JSON.stringify({ jobId, driverId }) });
        reload();
      }} />
  );
}

Map your states onto the statuses

The kit speaks five statuses: on_track, at_risk, late, blocked and neutral. Decide once how your own states map to them (a delayed pickup is at_risk, a missed window is late) and every map, table and figure agrees.

Time is a prop too

Pieces that depend on the clock take now, as the job queue does above. Pass the real time in production, or a fixed one to replay a shift or write a test that never flakes.

Where the shapes are written down

Each library page lists its props with a line on each, and Copy for AI puts the same list in a brief your coding agent can read. The types ship with the source, so your editor completes them.