Case study
satisfactory-dash
- React
- TypeScript
- Express
- Vite
- Zod
- PostgreSQL
- Unreal Engine 5
- C++
- SML
- AWS ECS
- AWS RDS
- CloudWatch
- Terraform
- Cloudflare Workers
- Cloudflare Tunnel
- Docker
- GitHub Actions
The problem
Satisfactory players who run a dedicated server can’t see how their factory is doing without joining the game. satisfactory-dash is a dashboard for that: production, overflow and power, live. It runs in production at satis-manager.com, and a public demo shows it without a game server.
For its first months the backend and its database ran on my gaming PC, beside the game itself. That PC was already short of memory and was never meant to be a server. This is the story of moving the service off it, without losing data and without a way in to my home network.
Text description of this video
The recording starts on the demo’s entry screen, which explains that the factory is made up and needs no sign-in, and clicks Enter demo. The Overview page shows all systems operational: a server with 3 of 4 players connected, two power circuits drawing 4,232.5 MW of 6,150 MW capacity, and 9 factory machines with 1 backed up. The Power tab shows each circuit’s production, consumption, capacity, peak demand and battery state, with a chart of the last five minutes. The Factory tab lists every machine with its recipe and output rate, and marks a Rotor assembler as backed up. The Settings tab ticks the auto-pause option, and the page shows the change as pending until the server applies it. The tour ends back on the Overview page. A banner across the top of every screen says the data is not live.
In Satisfactory, each machine runs one recipe. Ingredients arrive on a belt and wait in its input slots, the machine crafts them, and the result sits in its output slot until the outgoing belt takes it away. For every machine, the dashboard reads how stocked those input slots are, whether the output slot is full, and how fast the machine is producing compared with the rate it’s set to run at.
From those readings it sorts every machine into one of six states, and the order of its checks decides which one. A machine that’s starved of ingredients is underfed; one whose output has nowhere to go is backed up. Try it:
Goals
- Lower the ingredients and the output rate until the machine reads underfed.
- Fill the output slot to back the machine up.
- Fill every input, empty the slot and drop the output under 95%: backed up, not underfed.
- Cut the power, then pause it, and see which rule wins.
- Paused is it paused? no
- Unpowered no circuit, or the fuse tripped? no
- Idle no recipe? no
- Backed up an output slot full, or every input full with the output under 95%? no
- Underfed the output under 95% of the set rate? no
- Producing otherwise yes
Inputs are in and the output runs at the set rate: producing.
Limit: a fluid input has no slot, so it never counts as full. An output-throttled refinery still reads underfed.
Finding the bottleneck
Knowing a machine is underfed doesn’t say why. The cause can be several machines away: a mining node that’s too slow, a belt of the wrong tier, a splitter sending half the flow elsewhere, or a missing input. The Factory page’s Bottlenecks section walks from each underfed or backed-up machine to the root cause and lists the top ten, each with the belt that caps it (ADR-0048).
It works in two levels. First it follows items through the factory: which machines make what a starved machine needs, and how much they actually produce. Then it treats every belt, lift and pipe as a pipe of fixed capacity and runs a max-flow (Dinic’s algorithm) over the whole network. The smallest cut in that network is the conveyor that limits the flow, and the page names it with its tier, rate and position (#570, #575, #578, #581).
The finder is a pure function of the factory and its connections, so it is easy to test: it has 48 tests, and on a generated factory ten times the size of mine it ran in about 50 ms. Before building the visible part I checked two things on a separate test server, never my own game: that a rebuilt belt shows up on the next read, and what unit a pipe’s speed is reported in. Both held, and the second changed the design: a belt or pipe reports its tier’s maximum, not the flow actually moving, so the finder can name a capacity cap but cannot see how full a belt is.
The production planner
The bottleneck finder explains one starved machine. The Planner answers a wider question: what does the whole factory look like, and what feeds what? It draws the factory as a graph, and the hard part is deciding what not to draw. The largest site on my save has 385 machines, joined by a great many belt segments (ADR-0050).
The first step collapses the belt segments into a graph of machine groups and the links between them. On that site that is 385 machines in 160 groups with 204 links. Loops, where a belt feeds back into its own line, are found as strongly connected components (Tarjan’s algorithm).
Then comes the question of what counts as one factory. The first rule was distance: machines within 150 m of each other were one site. I measured the result read-only on my own save, and it was wrong in a useful way. That one “site” was 10 separate weakly connected components that the proximity rule had glued together, 91 of its 204 links were bridges (cut one and the graph falls in two), and the graph was 8 layers deep. A better rule had to follow the items, not the map.
That is the logical factory (ADR-0055, #669). Each group is assigned by its share of output to each final product, worked out from the machines’ maximum rates, so there is no live belt polling. A remote raw-material farm joins the factory it feeds, not the one it stands near. Try it, on a made-up example:
Goals
- Group by what the machines feed, and see the ore farm join the product it supplies.
- Send 95% or more of the shared smelters' output to one product, and see them join it.
Grouped by distance, every machine group is within reach of another: one site, though it makes two products.
A group that sends less than 95% of its output to one product is marked shared, rather than forced into a factory it only half belongs to. Small dependent offshoots fold into their factory: fewer than 4 machines, every input from one factory, and nothing leaving by transport, depot or the sink. Collapsing a whole upstream subtree on the canvas uses post-dominators (the Cooper–Harvey–Kennedy algorithm). The reduction is cheap: about 1.5 ms on a real-size graph, and about 98 ms in the capped worst case.
More detail: transport and excess
The canvas opens on a factory overview. Click a factory to drill into it, and its recipe bubbles open in place. You can collapse a whole upstream subtree, transport links carry an icon, and a motion toggle respects reduced motion (#672, #677, #690). The bottleneck finder is described above and isn’t repeated here.
Drawing the lines was a decision of its own (ADR-0059). ELK, run in a web worker, drew the best picture of everything I measured, but its licence is EPL-2.0 or GPL-3.0, neither fits how this project is licensed, and I declined it (#711). MSAGL, under MIT, was measured too, and it put labels on top of lines. So the Planner keeps dagre’s placement and routes the edges with a router of its own: vertical legs in the gaps between columns, rounded corners, and loops broken depth-first from the sources (#712, #714). On the dense test site, edges through cards went from 33 to 0, labels on other lines from 55 to 0, and crossings from 125 to 114.
The canvas has grown since. An owner can designate which groups make a factory, from the text view or with a freehand lasso, and the automatic suggestions stay on the canvas with a Keep button (#695, #696, #701). Cards now lead with the building’s icon and keep the details in a side panel (#698), and seven more buildings have icons (#716).

How data gets in
The game only answers on the machine that runs it, so the agent has to sit there too. Today that agent is SatisDashAgent, a server mod in C++ for Unreal Engine 5 and the game’s mod loader, SML. It reads the game from inside and pushes what it sees out to the backend, one ●snapshot at a time, oldest first. The cloud never connects in to the game server, and the mod only ever calls out, over HTTPS (ADR-0031). It is the only way a server connects: the Node agent it replaced, the Electron app that ran it and the backend’s own direct polling are retired (ADR-0066). How the agent moved into the game is further down.
Anything the mod can’t deliver yet waits in its queue. If something along the way is down, an ●error comes back; the mod keeps that snapshot and tries again later, waiting a little longer each time, with some randomness so that many servers don’t all retry at once. That logic is a C++ port of the Node agent’s pusher, queue and backoff, so it behaves the same (Pusher.h).
Goals
- Take the backend down and watch snapshots wait in the queue.
- Keep it down until a snapshot is dropped.
- Bring it back and watch the backlog drain.
- Take only the database down: the error comes back from further away.
The agent sends each snapshot as it's taken; the backend stores it in PostgreSQL.
When the link breaks, something has to give. The system picks availability: the dashboard keeps answering with the last snapshot it has, marked stale, rather than going blank, and the mod keeps collecting. The cost is consistency: history arrives late, and if the outage outlasts the queue (120 snapshots or 2 MB, whichever fills first, held in memory to stay light on the host), the oldest readings are ○dropped for good. For a live dashboard, the newest data matters most.
The figure’s database toggle shows one more split: with the database down, the backend stays up and says so, and nothing restarts it. AWS only checks that the backend’s process is alive; an outside monitor watches the database (#425).
The move to AWS
AWS’s Free plan came with credits, so the backend moved to ECS Fargate (one small ARM task, with Cloudflare’s tunnel beside it) and the database to RDS PostgreSQL (ADR-0034). The estimate was about $33 a month; a budget alarm fires at $40 (variables.tf). Two rules shaped it: nothing in the app may depend on AWS, so leaving is as boring as arriving, and backups leave AWS entirely, to Backblaze B2 with a key that can write but not delete (ADR-0035).
Moving a live service is mostly about never being stuck. The runbook breaks the move into five steps, and no step starts until the one before it checks out. Each has a rollback, and until the last one, the PC still has every byte. The ■final backup is the bridge: taken after writes stop, restored into RDS, and checked table by table before anything points at AWS. Only then does the ━route for api.satis-manager.com move.
Goals
- Step all the way to the switch.
- Roll a step back and read what it undoes.
Before: the PC serves everything. AWS is built and waiting, scaled to 0, with an empty database.
More detail: the AWS setup
Keeping it running
A service you can’t watch needs to say when it is failing. Background workers now count consecutive failures and, past a threshold of about five minutes of failing, log one error that a CloudWatch alarm picks up. An alert evaluator heartbeat shows it is still ticking, and an unhandled error logs a sanitised line and exits instead of limping on (#565). The alarms are defined in Terraform and live on AWS, with a second one for bursts of failed sign-ins.
I also ran an OWASP Top 10:2025 check with three read-only security reviews, npm audit and a personal-data scan. It found no High findings. It did find a Medium, the backend’s base image pinned by tag instead of by digest, and the fixes include pinning it and a one-year HSTS header (#563, #566).
The rest of the list was about the supply chain: what gets installed and built, and whether it is what I think it is (#561).
- Pinned by digest. The backend’s base image and the Postgres image in
compose.yamlare pinned by digest, and a test fails if the compose pin drifts from the one staging runs (static.test.mjs, #640). - Kept current. Dependabot bumps the npm packages, the GitHub Actions, the Dockerfile and
compose.yaml(dependabot.yml), and every Action is pinned to a commit SHA, not a tag (workflows). I also upgraded cloudflared, the tunnel, in compose and on ECS (#704). - Checked and signed. CodeQL scans the code (#566), and each pushed image gets signed build provenance from
actions/attest-build-provenance(image.yml, #607). - Migrations never change. Production records each migration by name once it has run, so CI fails any edit to an existing one; a fix is a new migration (migration-immutable.mjs, #607).
- Install scripts on a list. Of the five locked packages with install scripts, esbuild and fsevents may run theirs and the other three are skipped. On npm 11.16 and later, a new dependency with an unreviewed script fails the install (.npmrc, #640).
Users can now delete their account, or leave a server, from Settings. The server asks for a recent sign-in first, and takes its locks in a fixed order so a deletion racing a transfer of ownership waits instead of removing a server from its new owner. Privacy and terms pages describe it (#556, #564, #569).
The Map page draws the island itself. A dependency-free script traces the game’s world map once into vector shapes (land, shallows, upland and peaks), so no game texture ships: the shapes load as their own 89 kB gzipped chunk, carry a notice crediting the map to Coffee Stain Studios, and one switch takes them down if asked (ADR-0023, #718). On top sit the game’s own resource icons, filtered by resource type, in use or free, and building state, remembered per browser (#576, #582). Live trains and stations come from a reading every 10 seconds. Each train glides from where it was to where it is now, and simply moves under reduced motion; tables of the trains and stations in view are the text alternative (#666, #670).
There is also an operator-only metrics page. It started as tables reached from the command bar (ADR-0036, #665, #667), and is now a Metrics tab that only the operator sees, read top to bottom (ADR-0056, #717, #719, #720). First a row of headline numbers, each against the window before: requests per hour, the 5xx rate, request, poll-lag and agent-upload p95s, alerts fired, and refused and dropped. Then seven hourly trend charts drawn with uPlot from rollups already in Postgres, with timings on a log scale. Last, the old tables, folded away as the text path, including alert quality by month. The layout follows Google SRE’s golden signals, Grafana’s stat row, then trends, then detail, and DORA’s Four Keys. A worse number says “worse” with an arrow, not colour alone, and the chart colours were checked for colour-blind safety (index.css). The demo site shows it with labelled sample data.
Shipping it
Deploys used to be a manual step, and I got tired of doing them by hand. Now a merge that changes the backend images builds them, then deploys the same digests to staging and, if staging passes, to production. A merge that touches no backend code skips green (ADR-0049, #585, #598, #599, #601, #602, #604, #605). Several runs on 2026-10-25 went resolve, staging, production, all green.
- No stored cloud keys. GitHub Actions assumes least-privilege AWS IAM roles through OIDC. The trust policy pins one workflow file on
main, one GitHub environment, and GitHub’s immutable subject (the owner and repository ids). - Throwaway staging. A one-shot ECS Fargate task with its own PostgreSQL, cluster, egress-only network, secrets and tunnel behind Cloudflare Access. It migrates the schema production has now, then this release’s migrations, then signs in and checks the API, and is always torn down. It costs nothing when idle and well under a cent per run.
- Safe production rollout. Migrations run first and are expand-only, which a CI contract check enforces. Then the ECS rollout, then a 10-minute watch on the error alarms with automatic rollback, plus an ECS alarm and circuit-breaker rollback, a health check and a release record in SSM. Rollback and redeploy are each one click.
- Configuration vs. image. Terraform owns the configuration and CI owns which image runs. The deploy scripts have 63 unit tests against a fake AWS, the Terraform has 58 mock-provider tests, and each PR had a security review.
Since then, a few more pieces (ADR-0054, #643, #647, #652, #653). Backend build inputs that haven’t changed skip the deploy, found by an inputs-hash label on the image. A Postgres advisory lock elects a leader (5 seconds; failover takes about 4.5), so only one task runs the background work. And the dashboard shows a calm “updating” notice during a deploy gap.
The last piece closed the deploy gap (ADR-0054). The ECS service now starts the new task and lets it turn healthy before it stops the old one (100% / 200%), so the tunnel always has a connector (#705). That needed a fix first: each task loaded the server list once at startup, so a write served by the old task during the overlap would have been missing on the new one. Now a task reloads the list when it becomes leader (#706). In production, the new task started 50 seconds before the old one stopped, and the outside health check recorded no incident (#600).
Moving the agent into the game
The backend left the PC, but the agent couldn’t: it has to sit beside the game. It started as a small Node program on my PC, and most players rent their server from a host and have no machine to run such a thing on. So the idea was to make the agent a server mod, written against Satisfactory’s mod loader, SML (ADR-0039).
Modding is thinly documented, and an AI assistant will happily invent an engine call that doesn’t exist. So nothing got built on trust. The work passed evidence gates, and no product code was written until a later decision record approved it. Every engine or SML call in the mod repository needs a row citing the header file and line that declares it, and CI fails any call without one.
↙ true storyThe harness refused its very first run: my own game server was still up.The questions were answered by small throwaway mods, each run by a harness against a separate test server, which produces a pass or a fail plus the logs behind it. First, a mod loads on the dedicated server (#6) and can send an HTTP request (#7). HTTPS works too, and a server with the wrong certificate is refused (#8). And a mod posting every 30 seconds leaves the server’s tick rate where it was: 22.0 against 22.3 without it (#9). The first run of that test failed: the server runs faster for a while after it boots, and the harness had been measuring across the drop.
The second round answered the rest:
- A mod reads a credential from its config without ever logging it (#14).
- It enrols with a one-time code and pushes a snapshot to a throwaway copy of the backend (#15).
- On a copy of my own save, it reads the power grid within 1% of what an existing monitoring mod reports (#16).
That last one failed first too. The game joins circuits behind a switch into one group, and the pass rule had only judged lone circuits (#18).
All seven claims held on a real server, so the gates did their job. The decision record had parked the build until a player’s rented server couldn’t run the agent. I un-parked it with my own goal instead, moving the agent off my PC and into the mod (ADR-0042). Its plan came first (#28), then the HTTP transport and the game module, with a probe that runs on the test server (#29).
The first build read most of the game the way the Node agent did, through the HTTP API of a third-party monitoring mod, FicsitRemoteMonitoring. That mod states no licence, so I didn’t want to depend on it. The mod got its own readers instead, written clean-room from the game’s headers, one sprint at a time. Each reader switched on only after a parity run against the old reading on the test server and a tick-cost run (ADR-0058). Release 0.2.0 removed the monitoring mod for good: its one dependency is SML 3.12. It was published on GitHub on 2026-11-06, for Windows servers (0.2.0). On its tick-cost run the game’s median tick was 29.97 without the mod and 30.01 with it, and the mod’s longest step took 1.01 ms against a 2 ms ceiling.
Mod 0.3.0 adds two things: a Linux server build, made with UE 5.6’s Linux cross-toolchain (#87, #93), and device-code pairing, so a host never edits a file (#94). On the Linux server the game ticked at 29.925 with and without it, its longest step was 1.14 ms, and it used 6.2 MB of extra memory (release notes). Its end-to-end test was a pairing run on Linux only, against production, on 2026-11-09: the code showed in the server’s log and in chat, the server paired, and power and factory data were live within a minute. Windows and the rest of the checklist weren’t run for it (e2e checklist, #95). The run also found that players need SML on their own game, because a server with SML refuses a game without it. 0.3.0 is built and tested, and its public release waits on my go.
The mod’s workflow
The mod lives in its own public repository, and two Claude Code sessions work in parallel: one on the dashboard, one on the mod. They coordinate through each other’s decision records and messages, and some changes need both. When the mod’s pairing needed to send its mod/0.3.0 version string, the dashboard first had to widen what the pairing request accepts, as its own contract change (pairing.ts).
The work is planned the same way in both: a decision record or a written plan first, then small PRs, one task each. In the dashboard the session runs the fitting independent reviewer subagents (tests, security, UI) before opening the PR, and the PR merges itself once verify, e2e and security pass. In the mod I merge each PR myself, and its CI checks other things: every engine call cites its header, and each of the mod’s own readers carries a provenance file showing where it came from (CLAUDE.md).
The mod also has a gate the dashboard can’t have. A harness in GitHub Actions runs it on real Windows and Linux dedicated servers, never my own game or production. The runs check that the mod loads and answers, that it enrols with a code and pairs, how much it costs the game’s tick, and that it holds up over a soak of several hours. Each run records which host it ran on, so a Linux pass is never read as a Windows one, and its results are written by the harness, never by hand.
One way in
With the mod doing everything the Node agent did, I retired the other paths: the Node agent, the Electron app that ran it, and the backend polling a server’s API itself (ADR-0066). Fewer ways in means less to secure and less to test, and the backend no longer calls out to a game server at all.
It is a ten-PR plan, each PR from main and each one leaving production working. Six have merged: the decision itself (#873), the frontend (#876), moving shared types out of the old adapter (#875), deleting the agent and the Electron app (#877), the backend that no longer polls (#881) and the old routes (#882). Servers that used to be polled weren’t deleted: a data-only migration turned them into servers waiting for the mod, with their history and members kept. Four PRs remain. The last one drops the table that held the old connection details, which can’t be undone, so it waits on my go and on a backup proven to restore. I ran that restore check on 2026-11-09, and it passed (#883).
How to set it up
On the dedicated server:
- Install SML 3.12 or later and the SatisDashAgent mod, with the Satisfactory Mod Manager or by hand.
- Start the server. The mod prints a pairing code in the server console and in
FactoryGame.log. - Sign in at satis-manager.com/pair, enter the code and approve. The mod saves its own credential.
Players install SML only, not the mod. If pairing doesn’t suit a host, an enrolment code from the dashboard pasted into the mod’s config file does the same job. Two things are still pending: pairing needs mod 0.3.0, which isn’t released yet, and public sign-up isn’t open yet, while the Google sign-in app waits on publishing.
What I’d do differently
The credits run out in a few months, and the exit is already written: the same image and compose.yaml on a cheap VM, with the data moving by pg_dump and pg_restore, the path the restore rehearsals use. If I did it again I’d build that exit first and treat AWS as the second home, not the first.
More detail: security and data
How it was built
↙ psstDevelopment started with three Claude agents: a developer, an architect and a frontend agent. Midway through I tried more thorough task management with my own tool, lanes, and it ran most of the build before I retired it.I built satisfactory-dash with Claude Code, most of it through lanes: one fresh session per GitHub issue, gated by required checks and reviewer agents. Its gates cost more than they returned here, though: even a dependency bump needed its own issue, and I kept stepping in by hand. So I replaced it with plain CI/CD (ADR-0043, #482). A session opens the pull request, runs the reviewer agents itself (tests, UI and security), and the change merges once the required checks pass.
An AI assistant will invent a game API call as readily as a real one, so nothing about the game rests on its memory. Any claim about the dedicated server’s API or the monitoring mod’s API has to cite a saved copy of the source under docs-vault/raw-sources/, or carry a [NEEDS VERIFICATION] mark instead of a guess (CLAUDE.md, ground rule 2). Decisions get the same treatment. Each one is an architecture decision record with its context and a “revisit when” line, and every pull request adds its own entry to the project log, which CI checks (ADR-0033).
More detail: the rules every session follows
CI now runs only what a change touches (#483). A one-line backend change checks in 1m47s instead of the full 4m29s, and a docs-only change in 26 seconds. The repository is public.