Koder sim

Koder Sim

  • *rea:*Developer Platform
  • *ath:*koder-sim/
  • *ind:*Go simulation engine + REST/SSE server + Flutter visualization app
  • *ersion:*1.1.0
  • *tatus:*Active

Role in the stack

Koder Sim is a multidomain discreteevent and compartmental simulation platform. It ships as a selfcontained Go binary (`simserver) exposing a REST API on port 8108, and a Flutter desktop app (koder-simapp`) for interactive visualization. Use cases: epidemiology modeling, queue theory, traffic flow, tournament generation, and Monte Carlo estimation.

Core capabilities

Capability Details
Queue (MMc) Discrete-event simulator; theoretical MM1 comparison
Epidemiology SIR / SEIR compartmental model with vaccination, Euler integration
Tournament Single, doubleelimination and roundrobin bracket generator
Traffic Cellular automaton grid road network; per-step FlowMetrics
Monte Carlo Parallel trial runner; configurable confidence intervals; histogram
SSE streaming GET /api/v1/simulate/{epi,traffic,montecarlo}/stream — stepbystep events
Flutter app Line charts, bar charts, bracket diagram, heatmap, histogram; CSVJSONPNG export

Primary couplings

Module Relationship
koder-sim/app/ Flutter frontend; consumes REST + SSE from sim-server
None (standalone) No auth, no external dependencies at runtime

Architecture

koder-sim/
  cmd/sim-server/      Go HTTP server — port 8108
  internal/
    engine/            Discrete-event engine (heap-based DES clock)
    epi/               SIR/SEIR compartmental models
    queue/             M/M/c queue simulator
    tournament/        Bracket generator
    traffic/           Grid road network + vehicle agents
    montecarlo/        Parallel Monte Carlo framework
  app/
    lib/
      core/            Theme, API base URL
      models/          Typed result classes per simulation type
      services/        SimService (HTTP + SSE), ExportService (CSV/JSON/PNG)
      screens/         HomeScreen, QueueScreen, EpiScreen, TournamentScreen,
                       TrafficScreen, MonteCarloScreen
      widgets/         SimLineChart, BracketWidget, HeatmapWidget, ExportBar

REST API

Method Path Description
GET /health Health check
POST /api/v1/simulate/queue MMc batch simulation
POST /api/v1/simulate/epi SIR/SEIR batch simulation
POST /api/v1/simulate/tournament Bracket generation
POST /api/v1/simulate/traffic Traffic flow batch
POST /api/v1/simulate/montecarlo Monte Carlo batch
GET /api/v1/simulate/epi/stream SSE — daybyday epi results
GET /api/v1/simulate/traffic/stream SSE — stepbystep traffic metrics
GET /api/v1/simulate/montecarlo/stream SSE — batched trial results

Changelog

Version Date Summary
1.1.0 20260422 Flutter visualization app; SSE streaming endpoints; HistBin.ConfLevel
1.0.0 20260402 Initial engine + REST API

Source: ../home/koder/dev/koder/meta/docs/stack/modules/koder-sim.md