No description
Find a file
Lazzexus 653a28ed4f Only accept syslog connections once packets can be sent to Kafka
The syslog socket was bound as soon as SyslogSocketServer was created,
and the Kafka producer started collecting the messages afterwards. A
SharedFlow drops what's emitted while nothing collects it, so a client
that connected (or reconnected) while events-server-syslog started up
could lose its first messages.

Now the socket is bound in start(), after the producer is collecting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:00:24 +01:00
buildSrc Gradle 7.6 2022-12-05 23:18:00 +01:00
docs Add a forwarder for Factorio servers that don't run in Docker 2026-11-22 11:00:24 +01:00
gradle Remove dead kotlinx-nodejs dependency from web-map 2026-10-12 15:46:04 +02:00
gradle-plugins Fix Docker image builds and local platform setup 2026-10-12 17:27:11 +02:00
modules Only accept syslog connections once packets can be sent to Kafka 2026-11-22 11:00:24 +01:00
.gitignore migrate buildSrc plugins to includedBuild plugins 2022-09-18 20:49:32 +02:00
build.gradle.kts Gradle 7.6 2022-12-05 23:18:00 +01:00
gradle.properties set org.gradle.jvmargs 2022-10-15 23:53:33 +02:00
gradlew Gradle 7.6 2022-12-05 23:18:00 +01:00
gradlew.bat Gradle 7.6 2022-12-05 23:18:00 +01:00
kt52647.gradle.kts add 'skip worktree' example command 2022-12-05 23:21:29 +01:00
LICENSE update license to be gpl-3.0 2022-10-30 18:58:50 +01:00
README.md Add a forwarder for Factorio servers that don't run in Docker 2026-11-22 11:00:24 +01:00
settings.gradle.kts big ol' refactor of the Gradle Factorio Mod 2022-12-18 01:41:14 +01:00

Kafkatorio

Kafkatorio streams what happens on a Factorio server to Apache Kafka, and turns it into a live website for the server:

  • Map – a live map of every surface, with terrain, resource patches (with their size or number of wells), buildings (with their direction and recipe), belts, and players moving in real time.
  • Production – what's produced and consumed per minute, and science packs used, over the last 10 minutes up to the last 7 days, for all surfaces or one.
  • Research – what's researched, the current research and queue, and how many science packs are left. Shown as a filterable list, or as a tree like the game's technology screen.

It's built for Factorio 2.0, and works with large mod packs (it's used with Space Exploration and Krastorio 2).

This is a fork of adamko-dev/kafkatorio, updated for Factorio 2.0, with the production and research pages and many fixes.

Running it yourself

You need a Factorio server (in Docker, or not), a Docker host for Kafkatorio, and a machine to build the images on. The guide covers building, configuring, connecting the Factorio server, and putting the website behind a reverse proxy, with a ready-made setup for Unraid.

How it works

flowchart LR
  factorio["Factorio server<br/>+ kafkatorio-events mod"]
  syslog[events-server-syslog]
  kafka[(Kafka)]
  processors[events-processors]
  web[events-server-web]
  map["web-map<br/>(nginx)"]
  browser([Browser])

  factorio -- "packets in the server's output<br/>(Docker syslog log driver,<br/>or kafkatorio-forward.py)" --> syslog
  syslog -- "checks the server's token" --> kafka
  kafka <--> processors
  kafka --> web
  web -- "REST + WebSocket" --> map
  map --> browser
  1. The mod, events-mod (written in TypeScript, compiled to Lua), listens to in-game events, groups and de-bounces them, and prints them as JSON packets to the server log.
  2. Docker's syslog log driver (or, for a server outside Docker, kafkatorio-forward.py) forwards the server's output to events-server-syslog. Each server's log is tagged with a token (a JWT), so only known servers are accepted. The packets go to a Kafka topic.
  3. events-processors uses Kafka Streams to turn the packets into map tiles, buildings, resource patches, and so on.
  4. events-server-web serves the tiles and the other data over a REST API, and pushes live updates (such as players moving) over a WebSocket.
  5. web-map is the website (Kotlin/JS, with Leaflet for the map). Its nginx also forwards /kafkatorio/ to events-server-web, so the whole site is on a single port.

The packet format is defined once in events-library (Kotlin), which also generates the mod's TypeScript types.

Building

./gradlew build                 # build and test
./gradlew :modules:events-mod:distZip
                                # the mod: modules/events-mod/build/distributions/

See the guide for building the Docker images.

License

Kafkatorio is licensed under the GNU General Public License v3.0.