Koder Sim

  • Area: Developer Platform
  • Path: koder-sim/
  • Kind: Go simulation engine + REST/SSE server + Flutter visualization app
  • Version: 1.1.0
  • Status: Active

Role in the stack

Koder Sim is a multi-domain discrete-event and compartmental simulation platform. It ships as a self-contained Go binary (sim-server) exposing a REST API on port 8108, and a Flutter desktop app (koder-sim/app/) 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, double-elimination and round-robin 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 — step-by-step 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 — day-by-day epi results
GET /api/v1/simulate/traffic/stream SSE — step-by-step traffic metrics
GET /api/v1/simulate/montecarlo/stream SSE — batched trial results

Changelog

Version Date Summary
1.1.0 2026-04-22 Flutter visualization app; SSE streaming endpoints; HistBin.ConfLevel
1.0.0 2026-04-02 Initial engine + REST API