A frontend-only SEIRS simulator built with TypeScript and Vite.
The app runs entirely in the browser and visualizes S / E / I / R / V / D time-series data while supporting:
- virus presets
- variant scenarios
- intervention scenarios
- vaccination and immunity parameters
- local scenario persistence with
localStorage
This is the browser-based ODE/compartment-model branch of a three-repository learning series, rather than a port of the original grid-based stochastic simulator.
| Repository | Model and implementation |
|---|---|
| sir-model-classic | Spatial, grid-based S/I/R/V/Q/D stochastic transitions in Python |
| sir-model-differential-equations | Python/SciPy ODE model, SIR core and extended GUI |
| sir-model-diff-web | TypeScript/RK4-based compartment model with an interactive browser UI |
The S / E / I / R / V / D compartments and changing scenario parameters are implemented in src/simulation.ts. This is an educational simulation: parameter presets and intervention scenarios are hypothetical, not calibrated clinical forecasts.
- SEIRS-style compartment model with vaccinated and deceased compartments
- RK4-based numerical integration
- Variant scenarios that override parameters from a given day
- Intervention scenarios that change transmission multiplier from a given day
- Editable simulation inputs and advanced disease parameters
- SVG chart rendering in the browser
- JSON-driven presets and labels from
public/data
- TypeScript
- Vite
- Vanilla DOM rendering
- Node.js 18+
- npm
Install dependencies:
npm installStart the development server:
npm run devDefault local URL:
http://localhost:5173
You can also use the Windows helper script:
run.batnpm run dev- start Vite dev servernpm run build- run TypeScript compile and production buildnpm run preview- preview the production build
.
├─ public/
│ └─ data/
│ ├─ interventions.json
│ ├─ ui_labels_ko.json
│ ├─ variants.json
│ └─ virus_presets.json
├─ src/
│ ├─ app.ts
│ ├─ main.ts
│ ├─ simulation.ts
│ ├─ style.css
│ └─ types.ts
├─ package.json
├─ run.bat
└─ vite.config.ts
The simulation tracks these compartments:
SsusceptibleEexposedIinfectedRrecoveredVvaccinatedDdeceased
Core parameters include:
betagammamuincubation_periodepsilon_nnat_durepsilon_vvax_durxixi_r_multiplier
The solver uses RK4 with 8 substeps per simulated day.
The app loads initial data from public/data:
ui_labels_ko.json- UI labelsvirus_presets.json- preset disease parameter setsvariants.json- default variant scenario listinterventions.json- default intervention scenario list
sir-model-diff-web:variantssir-model-diff-web:interventions
- This project is fully client-side and does not require a backend.
- It is suitable for learning, experimentation, and visualization, not for real-world medical or policy decisions.