# sp-tarkov/server-csharp architecture

> Architecture diagram of the GitHub repository sp-tarkov/server-csharp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sp-tarkov/server-csharp
- Repository: https://github.com/sp-tarkov/server-csharp

## Overview

SPTarkov is a locally run server for the modified Escape From Tarkov client. The principal workflow is a client request entering the server, being dispatched to a game-domain controller, and receiving a game-shaped response; domain handlers also read or update player profiles and game data. The tree documents broad gameplay areas including profiles, inventory, bots, quests, hideout, traders, flea market, and raid behavior. Relationships below are limited to README statements and visible SOURCE INDEX references; several domain links are documented at subsystem level because their implementations were not sampled.

Main entry points: [`SPTarkov.Server/Program.cs`](https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Program.cs) (Server startup), [`Libraries/SPTarkov.Server.Core/Models/Spt/Tables/TemplateTable.cs`](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Spt/Tables/TemplateTable.cs) (Game templates), [`Libraries/SPTarkov.Server.Core/Controllers`](https://github.com/sp-tarkov/server-csharp/tree/main/Libraries/SPTarkov.Server.Core/Controllers) (Game controllers), [`Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs`](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs) (Market pricing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_program["Server startup<br/>[Program.cs]"]
  node_importer["Database importer"]
  node_di["Dependency injection"]
  node_http["HTTP server"]
  node_logger["Logging<br/>[ISptLogger.cs]"]
end

subgraph group_gameplay["Game request handling"]
  node_router["Request routing<br/>[Router.cs]"]
  node_controllers["Game controllers<br/>[Controllers]"]
  node_callbacks["Request callbacks<br/>[Callbacks]"]
  node_itemevents["Item event routes"]
  node_ragfair["Flea market"]
  node_prices["Market pricing"]
  node_bots["Bot generation<br/>[BotGenerator.cs]"]
  node_quests["Quest handling<br/>[QuestHelper.cs]"]
  node_raid["Raid handling<br/>[InRaidHelper.cs]"]
end

subgraph group_state["Game state and data"]
  node_profile["Player profiles<br/>[ProfileHelper.cs]"]
  node_save["Profile persistence<br/>[SaveServer.cs]"]
  node_items["Item logic<br/>[ItemHelper.cs]"]
  node_itemmodel["Item data model<br/>[Item.cs]"]
  node_templates[("Game templates<br/>[TemplateTable.cs]")]
  node_globaldata[("Global game data<br/>[GlobalTable.cs]")]
end

subgraph group_extensions["Mod and administration"]
  node_modloader["Mod loading<br/>[ModLoader.cs]"]
  node_webadmin["Web administration"]
end

node_client(("Modified client"))

node_client -->|"sends requests"| node_http
node_program -->|"imports data"| node_importer
node_program -->|"loads mods"| node_modloader
node_program -->|"starts server"| node_http
node_program -->|"configures services"| node_di
node_http -.->|"dispatches requests"| node_router
node_router -.->|"routes requests"| node_controllers
node_controllers -.->|"delegates handling"| node_callbacks
node_itemevents -->|"routes flea events"| node_callbacks
node_controllers -.->|"uses profile logic"| node_profile
node_profile -.->|"persists profiles"| node_save
node_items -->|"reads templates"| node_templates
node_items -->|"processes items"| node_itemmodel
node_ragfair -->|"gets prices"| node_prices
node_prices -->|"reads templates"| node_templates
node_prices -->|"checks item types"| node_items
node_ragfair -->|"updates offers"| node_profile
node_bots -.->|"uses game data"| node_templates
node_quests -.->|"uses quest data"| node_templates
node_raid -.->|"uses global settings"| node_globaldata
node_webadmin -.->|"edits configuration"| node_globaldata
node_program -->|"configures logging"| node_logger

click node_program "https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Program.cs"
click node_importer "https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Helpers/DatabaseImporter.cs"
click node_di "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.DI/DependencyInjectionHandler.cs"
click node_http "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Server/HttpServerHelper.cs"
click node_router "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/DI/Router.cs"
click node_controllers "https://github.com/sp-tarkov/server-csharp/tree/main/Libraries/SPTarkov.Server.Core/Controllers"
click node_callbacks "https://github.com/sp-tarkov/server-csharp/tree/main/Libraries/SPTarkov.Server.Core/Callbacks"
click node_itemevents "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs"
click node_profile "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Profile/ProfileHelper.cs"
click node_save "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs"
click node_items "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Items/ItemHelper.cs"
click node_itemmodel "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs"
click node_templates "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Spt/Tables/TemplateTable.cs"
click node_globaldata "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Spt/Tables/GlobalTable.cs"
click node_ragfair "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs"
click node_prices "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs"
click node_bots "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Generators/Bot/BotGenerator.cs"
click node_quests "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Quest/QuestHelper.cs"
click node_raid "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/InRaid/InRaidHelper.cs"
click node_modloader "https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Modding/ModLoader.cs"
click node_webadmin "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Web/Services/ConfigEditorService.cs"
click node_logger "https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Common/Models/Logging/ISptLogger.cs"

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_program,node_importer,node_di,node_http,node_logger,node_client toneBlue
class node_router,node_controllers,node_callbacks,node_itemevents,node_ragfair,node_prices,node_bots,node_quests,node_raid toneAmber
class node_profile,node_save,node_items,node_itemmodel,node_templates,node_globaldata toneMint
class node_modloader,node_webadmin toneRose
```

## Components

### Server runtime

- [Server startup](https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Program.cs): `SPTarkov.Server/Program.cs`
- [Database importer](https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Helpers/DatabaseImporter.cs): `SPTarkov.Server/Helpers/DatabaseImporter.cs`
- [Dependency injection](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.DI/DependencyInjectionHandler.cs): `Libraries/SPTarkov.DI/DependencyInjectionHandler.cs`
- [HTTP server](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Server/HttpServerHelper.cs): `Libraries/SPTarkov.Server.Core/Helpers/Server/HttpServerHelper.cs`
- [Logging](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Common/Models/Logging/ISptLogger.cs): `Libraries/SPTarkov.Common/Models/Logging/ISptLogger.cs`

### Game request handling

- [Request routing](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/DI/Router.cs): `Libraries/SPTarkov.Server.Core/DI/Router.cs`
- [Game controllers](https://github.com/sp-tarkov/server-csharp/tree/main/Libraries/SPTarkov.Server.Core/Controllers): `Libraries/SPTarkov.Server.Core/Controllers`
- [Request callbacks](https://github.com/sp-tarkov/server-csharp/tree/main/Libraries/SPTarkov.Server.Core/Callbacks): `Libraries/SPTarkov.Server.Core/Callbacks`
- [Item event routes](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs): `Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs`
- [Flea market](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs): `Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs`
- [Market pricing](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs): `Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs`
- [Bot generation](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Generators/Bot/BotGenerator.cs): `Libraries/SPTarkov.Server.Core/Generators/Bot/BotGenerator.cs`
- [Quest handling](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Quest/QuestHelper.cs): `Libraries/SPTarkov.Server.Core/Helpers/Quest/QuestHelper.cs`
- [Raid handling](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/InRaid/InRaidHelper.cs): `Libraries/SPTarkov.Server.Core/Helpers/InRaid/InRaidHelper.cs`

### Game state and data

- [Player profiles](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Profile/ProfileHelper.cs): `Libraries/SPTarkov.Server.Core/Helpers/Profile/ProfileHelper.cs`
- [Profile persistence](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs): `Libraries/SPTarkov.Server.Core/Servers/SaveServer.cs`
- [Item logic](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Helpers/Items/ItemHelper.cs): `Libraries/SPTarkov.Server.Core/Helpers/Items/ItemHelper.cs`
- [Item data model](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs): `Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs`
- [Game templates](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Spt/Tables/TemplateTable.cs): `Libraries/SPTarkov.Server.Core/Models/Spt/Tables/TemplateTable.cs`
- [Global game data](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Core/Models/Spt/Tables/GlobalTable.cs): `Libraries/SPTarkov.Server.Core/Models/Spt/Tables/GlobalTable.cs`

### Mod and administration

- [Mod loading](https://github.com/sp-tarkov/server-csharp/blob/main/SPTarkov.Server/Modding/ModLoader.cs): `SPTarkov.Server/Modding/ModLoader.cs`
- [Web administration](https://github.com/sp-tarkov/server-csharp/blob/main/Libraries/SPTarkov.Server.Web/Services/ConfigEditorService.cs): `Libraries/SPTarkov.Server.Web/Services/ConfigEditorService.cs`

### Other components

- **Modified client**

## Connections

- Modified client → HTTP server: sends requests (evidence: `README.md`)
- Server startup → Database importer: imports data (evidence: `SPTarkov.Server/Program.cs`)
- Server startup → Mod loading: loads mods (evidence: `SPTarkov.Server/Program.cs`)
- Server startup → HTTP server: starts server (evidence: `SPTarkov.Server/Program.cs`)
- Server startup → Dependency injection: configures services
- HTTP server → Request routing: dispatches requests
- Request routing → Game controllers: routes requests
- Game controllers → Request callbacks: delegates handling
- Item event routes → Request callbacks: routes flea events (evidence: `Libraries/SPTarkov.Server.Core/Routers/ItemEvents/RagfairItemEventRouter.cs`)
- Game controllers → Player profiles: uses profile logic (evidence: `Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs`)
- Player profiles → Profile persistence: persists profiles (evidence: `Libraries/SPTarkov.Server.Core/Helpers/Profile/ProfileHelper.cs`)
- Item logic → Game templates: reads templates (evidence: `Libraries/SPTarkov.Server.Core/Helpers/Items/ItemHelper.cs`)
- Item logic → Item data model: processes items (evidence: `Libraries/SPTarkov.Server.Core/Helpers/Items/ItemHelper.cs`)
- Flea market → Market pricing: gets prices (evidence: `Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs`)
- Market pricing → Game templates: reads templates (evidence: `Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs`)
- Market pricing → Item logic: checks item types (evidence: `Libraries/SPTarkov.Server.Core/Services/Ragfair/RagfairPriceService.cs`)
- Flea market → Player profiles: updates offers (evidence: `Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs`)
- Bot generation → Game templates: uses game data
- Quest handling → Game templates: uses quest data
- Raid handling → Global game data: uses global settings
- Web administration → Global game data: edits configuration
- Server startup → Logging: configures logging (evidence: `SPTarkov.Server/Program.cs`)
