# openrailassociation/osrd architecture

> Architecture diagram of the GitHub repository openrailassociation/osrd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openrailassociation/osrd
- Repository: https://github.com/openrailassociation/osrd

## Overview

#### Purpose and system entry points
OSRD is a railway infrastructure design, capacity-analysis, timetabling, simulation, and short-notice path-request platform. The browser application starts at `front/src/index.tsx`; its principal backend is the Rust Editoast service at `editoast/src/main.rs`. Simulation and pathfinding execute in the JVM Core worker, whose application entry point is `core/src/main/java/fr/sncf/osrd/App.java`. Deployment-facing ingress/auth proxy starts at `gateway/src/main.rs`.

#### Web client and user workflows
The TypeScript/React frontend provides separate operational domains: infrastructure editing, operational studies/timetables, rolling-stock editing, and STDCM requests. Key application roots are `front/src/applications/editor/Editor.tsx`, `front/src/applications/operationalStudies/views/Scenario/ScenarioView.tsx`, and `front/src/applications/stdcm/StdcmView.tsx`. It calls generated/API clients under `front/src/common/api/`, displays map layers and simulation visualizations, and maintains shared client state through `front/src/store/index.ts`.

#### Editoast: persistence and HTTP domain API
Editoast is the system-of-record API for infrastructure, rolling stock, projects/studies/scenarios, train schedules, timetables, search environments, and map-ready generated data. Routing and middleware live in `editoast/src/views/server/router.rs` and `editoast/src/views/server/middlewares.rs`; domain endpoints are organized in `editoast/src/views/infra/`, `editoast/src/views/timetable/`, and `editoast/src/views/operational_studies/`. Rust models and database mappings are centered in `editoast/editoast_models/src/`, with schema evolution in `editoast/migrations/`.

#### Simulation and railway computation core
The Gradle Java/Kotlin Core service owns computational semantics rather than business persistence. It exposes worker/API operations for standalone simulation, path properties, signal projection, conflict detection, ETCS braking, block pathfinding, and STDCM; representative endpoint boundaries are `core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt`, `core/src/main/kotlin/fr/sncf/osrd/api/pathfinding/PathfindingBlocksEndpoint.kt`, and `core/src/main/kotlin/fr/sncf/osrd/api/stdcm/STDCMEndpoint.kt`. The underlying physics uses speed/distance-time envelopes in `core/envelope-sim/` and train/path representations in `core/kt-osrd-path/`.

#### Infrastructure, signaling, and routing pipeline
RailJSON is the shared railway-data model: schema types reside in `core/osrd-railjson/src/main/java/fr/sncf/osrd/railjson/schema/infra/`, while parsing and construction lead into simulation infrastructure abstractions under `core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/`. Signaling has a generic simulator in `core/kt-osrd-signaling/src/main/kotlin/fr/sncf/osrd/signaling/` and SNCF-specific BAL/BAPR/ETCS/TVM implementations in `core/kt-osrd-sncf-signaling/src/main/kotlin/fr/sncf/osrd/signaling/`. Core pathfinding builds constrained graph searches through `core/src/main/kotlin/fr/sncf/osrd/pathfinding/Pathfinding.kt`.

#### Timetable conflicts and short-term capacity
Conflict detection converts simulated requirements into spacing/resource occupancies and incrementally detects conflicts; its main boundary is `core/src/main/kotlin/fr/sncf/osrd/conflicts/IncrementalConflictDetector.kt`. STDCM performs time-aware path search against timetable availability, combining graph exploration, block simulation, delay/backtracking, and post-processing in `core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt` and `core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMSimulations.kt`. Editoast prepares persisted timetable/scenario inputs and delegates computation through `editoast/core_client/src/`.

#### Runtime topology and external services
The gateway authenticates and proxies external requests; its auth providers include bearer and OIDC implementations under `gateway/actix_auth/src/providers/`. Editoast delegates Core work through message-queue clients (`editoast/core_client/src/mq_client.rs`); Core workers are provisioned/scaled by Osrdyne, whose queue controller and Docker/Kubernetes drivers are in `osrdyne/src/queue_controller.rs` and `osrdyne/src/drivers/`. Local and chart deployments define PostgreSQL/PostGIS persistence, RabbitMQ, Valkey cache, OpenFGA authorization, S3-compatible storage, and Jaeger telemetry in `docker-compose.yml` and `chart/templates/`.

Main entry points: [`core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt`](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt) (Compute endpoints), [`gateway/src/main.rs`](https://github.com/openrailassociation/osrd/blob/dev/gateway/src/main.rs) (Gateway), [`editoast/src/main.rs`](https://github.com/openrailassociation/osrd/blob/dev/editoast/src/main.rs) (Editoast API), [`core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt`](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt) (STDCM capacity search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_frontend["React frontend<br/>TypeScript application<br/>[index.tsx]"]
  node_frontend_apps["Operational app roots<br/>React views<br/>[ScenarioView.tsx]"]
  node_client_api["API clients and state<br/>TypeScript API layer"]
end

subgraph group_services["Application services"]
  node_gateway{{"Gateway<br/>Rust ingress proxy<br/>[main.rs]"}}
  node_gateway_auth["Auth providers<br/>Bearer and OIDC auth"]
  node_editoast["Editoast API<br/>Rust domain API<br/>[main.rs]"]
  node_editoast_router["HTTP routing<br/>Rust router and middleware<br/>[router.rs]"]
  node_domain_endpoints["Infrastructure and timetable APIs<br/>Domain endpoints"]
  node_models["Persistence models<br/>Rust database models"]
  node_core_client["Core queue client<br/>Rust MQ client<br/>[mq_client.rs]"]
end

subgraph group_core["Railway computation core"]
  node_core_app["Core worker<br/>JVM compute service<br/>[App.java]"]
  node_core_endpoints["Compute endpoints<br/>Kotlin API operations"]
  node_railjson["RailJSON model<br/>Railway infrastructure schema"]
  node_sim_infra["Simulation infrastructure<br/>Infrastructure abstraction"]
  node_signaling["Signaling simulation<br/>Generic and SNCF signaling"]
  node_pathfinding["Constrained pathfinding<br/>Rail graph search<br/>[Pathfinding.kt]"]
  node_conflicts["Conflict detection<br/>Incremental occupancy analysis"]
  node_stdcm["STDCM capacity search<br/>Time-aware path search"]
end

subgraph group_platform["Runtime platform"]
  node_osrdyne["Osrdyne<br/>Worker queue controller"]
  node_data_services[("Data and platform services<br/>PostGIS, cache, storage, telemetry<br/>[docker-compose.yml]")]
end

node_frontend -->|"mounts"| node_frontend_apps
node_frontend_apps -->|"uses"| node_client_api
node_client_api -->|"HTTPS requests"| node_gateway
node_gateway -->|"authenticates via"| node_gateway_auth
node_gateway -->|"proxies to"| node_editoast
node_editoast -->|"serves through"| node_editoast_router
node_editoast_router -->|"routes to"| node_domain_endpoints
node_domain_endpoints -->|"persists"| node_models
node_models -->|"uses persistence"| node_data_services
node_editoast -->|"delegates computation"| node_core_client
node_core_client -->|"submits jobs"| node_osrdyne
node_osrdyne -->|"provisions workers"| node_core_app
node_core_app -->|"exposes"| node_core_endpoints
node_core_endpoints -->|"builds infrastructure"| node_sim_infra
node_railjson -->|"parses into"| node_sim_infra
node_sim_infra -->|"drives"| node_signaling
node_core_endpoints -->|"invokes"| node_pathfinding
node_pathfinding -->|"respects signaling"| node_signaling
node_core_endpoints -->|"detects timetable conflicts"| node_conflicts
node_core_endpoints -->|"runs capacity search"| node_stdcm
node_stdcm -->|"explores routes"| node_pathfinding
node_stdcm -->|"checks availability"| node_conflicts

click node_frontend "https://github.com/openrailassociation/osrd/blob/dev/front/src/index.tsx"
click node_frontend_apps "https://github.com/openrailassociation/osrd/blob/dev/front/src/applications/operationalStudies/views/Scenario/ScenarioView.tsx"
click node_gateway "https://github.com/openrailassociation/osrd/blob/dev/gateway/src/main.rs"
click node_editoast "https://github.com/openrailassociation/osrd/blob/dev/editoast/src/main.rs"
click node_editoast_router "https://github.com/openrailassociation/osrd/blob/dev/editoast/src/views/server/router.rs"
click node_core_client "https://github.com/openrailassociation/osrd/blob/dev/editoast/core_client/src/mq_client.rs"
click node_core_app "https://github.com/openrailassociation/osrd/blob/dev/core/src/main/java/fr/sncf/osrd/App.java"
click node_core_endpoints "https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt"
click node_pathfinding "https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/pathfinding/Pathfinding.kt"
click node_conflicts "https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/conflicts/IncrementalConflictDetector.kt"
click node_stdcm "https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt"
click node_osrdyne "https://github.com/openrailassociation/osrd/blob/dev/osrdyne/src/queue_controller.rs"
click node_data_services "https://github.com/openrailassociation/osrd/blob/dev/docker-compose.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend,node_frontend_apps,node_client_api toneBlue
class node_gateway,node_gateway_auth,node_editoast,node_editoast_router,node_domain_endpoints,node_models,node_core_client toneAmber
class node_core_app,node_core_endpoints,node_railjson,node_sim_infra,node_signaling,node_pathfinding,node_conflicts,node_stdcm toneMint
class node_osrdyne,node_data_services toneRose
```

## Components

### Browser client

- [React frontend](https://github.com/openrailassociation/osrd/blob/dev/front/src/index.tsx): TypeScript application · Infrastructure, studies, rolling-stock, and STDCM workflows. · `front/src/index.tsx`
- [Operational app roots](https://github.com/openrailassociation/osrd/blob/dev/front/src/applications/operationalStudies/views/Scenario/ScenarioView.tsx): React views · `front/src/applications/operationalStudies/views/Scenario/ScenarioView.tsx`
- **API clients and state**: TypeScript API layer

### Application services

- [Gateway](https://github.com/openrailassociation/osrd/blob/dev/gateway/src/main.rs): Rust ingress proxy · Authenticates and proxies external requests. · `gateway/src/main.rs`
- **Auth providers**: Bearer and OIDC auth
- [Editoast API](https://github.com/openrailassociation/osrd/blob/dev/editoast/src/main.rs): Rust domain API · System of record and orchestration API. · `editoast/src/main.rs`
- [HTTP routing](https://github.com/openrailassociation/osrd/blob/dev/editoast/src/views/server/router.rs): Rust router and middleware · `editoast/src/views/server/router.rs`
- **Infrastructure and timetable APIs**: Domain endpoints
- **Persistence models**: Rust database models
- [Core queue client](https://github.com/openrailassociation/osrd/blob/dev/editoast/core_client/src/mq_client.rs): Rust MQ client · `editoast/core_client/src/mq_client.rs`

### Railway computation core

- [Core worker](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/java/fr/sncf/osrd/App.java): JVM compute service · Executes simulation, pathfinding, conflicts, and STDCM. · `core/src/main/java/fr/sncf/osrd/App.java`
- [Compute endpoints](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt): Kotlin API operations · `core/src/main/kotlin/fr/sncf/osrd/api/standalone_sim/SimulationEndpoint.kt`
- **RailJSON model**: Railway infrastructure schema
- **Simulation infrastructure**: Infrastructure abstraction
- **Signaling simulation**: Generic and SNCF signaling
- [Constrained pathfinding](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/pathfinding/Pathfinding.kt): Rail graph search · `core/src/main/kotlin/fr/sncf/osrd/pathfinding/Pathfinding.kt`
- [Conflict detection](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/conflicts/IncrementalConflictDetector.kt): Incremental occupancy analysis · `core/src/main/kotlin/fr/sncf/osrd/conflicts/IncrementalConflictDetector.kt`
- [STDCM capacity search](https://github.com/openrailassociation/osrd/blob/dev/core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt): Time-aware path search · `core/src/main/kotlin/fr/sncf/osrd/stdcm/graph/STDCMPathfinding.kt`

### Runtime platform

- [Osrdyne](https://github.com/openrailassociation/osrd/blob/dev/osrdyne/src/queue_controller.rs): Worker queue controller · Provisions and scales Core workers. · `osrdyne/src/queue_controller.rs`
- [Data and platform services](https://github.com/openrailassociation/osrd/blob/dev/docker-compose.yml): PostGIS, cache, storage, telemetry · `docker-compose.yml`

## Connections

- React frontend → Operational app roots: mounts
- Operational app roots → API clients and state: uses
- API clients and state → Gateway: HTTPS requests
- Gateway → Auth providers: authenticates via
- Gateway → Editoast API: proxies to
- Editoast API → HTTP routing: serves through
- HTTP routing → Infrastructure and timetable APIs: routes to
- Infrastructure and timetable APIs → Persistence models: persists
- Persistence models → Data and platform services: uses persistence
- Editoast API → Core queue client: delegates computation
- Core queue client → Osrdyne: submits jobs
- Osrdyne → Core worker: provisions workers
- Core worker → Compute endpoints: exposes
- Compute endpoints → Simulation infrastructure: builds infrastructure
- RailJSON model → Simulation infrastructure: parses into
- Simulation infrastructure → Signaling simulation: drives
- Compute endpoints → Constrained pathfinding: invokes
- Constrained pathfinding → Signaling simulation: respects signaling
- Compute endpoints → Conflict detection: detects timetable conflicts
- Compute endpoints → STDCM capacity search: runs capacity search
- STDCM capacity search → Constrained pathfinding: explores routes
- STDCM capacity search → Conflict detection: checks availability
