# statsig-io/statsig-server-core architecture

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

- Interactive diagram: https://gitdiagram.com/statsig-io/statsig-server-core
- Repository: https://github.com/statsig-io/statsig-server-core

## Overview

Statsig Server Core is a multi-language server SDK for evaluating feature gates, dynamic configurations, and experiments, and for logging exposures and events. A typical flow starts with an application supplying a user and requesting an evaluation; the SDK returns a typed result and may record exposure or event data. The Rust core contains the evaluation and networking machinery, with language bindings exposing it to applications. The README documents the product capabilities; several internal links below are dashed because the sampled excerpts do not show their runtime wiring.

Main entry points: [`statsig-rust/src/evaluation/evaluator.rs`](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluator.rs) (Evaluation engine), [`statsig-rust/src/statsig.rs`](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/statsig.rs) (Statsig runtime), [`statsig-rust/src/specs_adapter/specs_adapter_trait.rs`](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/specs_adapter/specs_adapter_trait.rs) (Specs adapters), [`statsig-java/src/main/java/com/statsig/Statsig.java`](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-java/src/main/java/com/statsig/Statsig.java) (Language SDKs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["SDK interfaces"]
  node_language_sdk["Language SDKs<br/>[Statsig.java]"]
  node_ffi["FFI bindings<br/>[lib.rs]"]
end

subgraph group_runtime["Core runtime"]
  node_rust_runtime["Statsig runtime<br/>[statsig.rs]"]
  node_user["User context<br/>[statsig_user.rs]"]
  node_storage[("Sticky storage")]
end

subgraph group_data["Specs and evaluation"]
  node_spec_adapter["Specs adapters"]
  node_spec_store[("Spec store<br/>[spec_store.rs]")]
  node_evaluator["Evaluation engine<br/>[evaluator.rs]"]
  node_gate["Feature gates"]
  node_dynamic_config["Dynamic configs"]
  node_experiment["Experiments and layers"]
end

subgraph group_telemetry["Events and transport"]
  node_event_logger["Event logging<br/>[event_logger.rs]"]
  node_event_queue["Event queue<br/>[queue.rs]"]
  node_network["Network client<br/>[network_client.rs]"]
end

node_app(("Server application"))
node_statsig_service(("Statsig service"))

node_app -->|"requests evaluations"| node_language_sdk
node_language_sdk -.->|"calls native bridge"| node_ffi
node_ffi -.->|"dispatches calls"| node_rust_runtime
node_app -->|"requests evaluations"| node_rust_runtime
node_app -.->|"provides context"| node_user
node_rust_runtime -.->|"loads specs"| node_spec_adapter
node_spec_adapter -.->|"fetches specs"| node_statsig_service
node_spec_adapter -.->|"updates specs"| node_spec_store
node_rust_runtime -.->|"evaluates requests"| node_evaluator
node_evaluator -.->|"reads specs"| node_spec_store
node_evaluator -.->|"reads context"| node_user
node_evaluator -->|"returns gate results"| node_gate
node_evaluator -->|"returns configurations"| node_dynamic_config
node_evaluator -->|"returns experiment results"| node_experiment
node_evaluator -.->|"uses sticky values"| node_storage
node_rust_runtime -.->|"logs events"| node_event_logger
node_event_logger -.->|"queues events"| node_event_queue
node_event_queue -.->|"sends batches"| node_network
node_network -.->|"sends requests"| node_statsig_service

click node_language_sdk "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-java/src/main/java/com/statsig/Statsig.java"
click node_ffi "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-ffi/src/lib.rs"
click node_rust_runtime "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/statsig.rs"
click node_user "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/user/statsig_user.rs"
click node_spec_adapter "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/specs_adapter/specs_adapter_trait.rs"
click node_spec_store "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/spec_store.rs"
click node_evaluator "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluator.rs"
click node_gate "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluation_types.rs"
click node_dynamic_config "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/dynamic_returnable.rs"
click node_experiment "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluation_types.rs"
click node_storage "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/persistent_storage/persistent_storage_trait.rs"
click node_event_logger "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/event_logging/event_logger.rs"
click node_event_queue "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/event_logging/event_queue/queue.rs"
click node_network "https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/networking/network_client.rs"

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_language_sdk,node_ffi toneBlue
class node_rust_runtime,node_user,node_storage toneAmber
class node_spec_adapter,node_spec_store,node_evaluator,node_gate,node_dynamic_config,node_experiment,node_app toneMint
class node_event_logger,node_event_queue,node_network toneRose
class node_statsig_service toneIndigo
```

## Components

### SDK interfaces

- [Language SDKs](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-java/src/main/java/com/statsig/Statsig.java): `statsig-java/src/main/java/com/statsig/Statsig.java`
- [FFI bindings](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-ffi/src/lib.rs): `statsig-ffi/src/lib.rs`

### Core runtime

- [Statsig runtime](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/statsig.rs): `statsig-rust/src/statsig.rs`
- [User context](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/user/statsig_user.rs): `statsig-rust/src/user/statsig_user.rs`
- [Sticky storage](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/persistent_storage/persistent_storage_trait.rs): `statsig-rust/src/persistent_storage/persistent_storage_trait.rs`

### Specs and evaluation

- [Specs adapters](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/specs_adapter/specs_adapter_trait.rs): `statsig-rust/src/specs_adapter/specs_adapter_trait.rs`
- [Spec store](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/spec_store.rs): `statsig-rust/src/spec_store.rs`
- [Evaluation engine](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluator.rs): `statsig-rust/src/evaluation/evaluator.rs`
- [Feature gates](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluation_types.rs): `statsig-rust/src/evaluation/evaluation_types.rs`
- [Dynamic configs](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/dynamic_returnable.rs): `statsig-rust/src/evaluation/dynamic_returnable.rs`
- [Experiments and layers](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/evaluation/evaluation_types.rs): `statsig-rust/src/evaluation/evaluation_types.rs`

### Events and transport

- [Event logging](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/event_logging/event_logger.rs): `statsig-rust/src/event_logging/event_logger.rs`
- [Event queue](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/event_logging/event_queue/queue.rs): `statsig-rust/src/event_logging/event_queue/queue.rs`
- [Network client](https://github.com/statsig-io/statsig-server-core/blob/main/statsig-rust/src/networking/network_client.rs): `statsig-rust/src/networking/network_client.rs`

### Other components

- **Server application**
- **Statsig service**

## Connections

- Server application → Language SDKs: requests evaluations (evidence: `README.md`)
- Language SDKs → FFI bindings: calls native bridge
- FFI bindings → Statsig runtime: dispatches calls
- Server application → Statsig runtime: requests evaluations (evidence: `README.md`)
- Server application → User context: provides context
- Statsig runtime → Specs adapters: loads specs
- Specs adapters → Statsig service: fetches specs
- Specs adapters → Spec store: updates specs
- Statsig runtime → Evaluation engine: evaluates requests
- Evaluation engine → Spec store: reads specs
- Evaluation engine → User context: reads context
- Evaluation engine → Feature gates: returns gate results (evidence: `README.md`)
- Evaluation engine → Dynamic configs: returns configurations (evidence: `README.md`)
- Evaluation engine → Experiments and layers: returns experiment results (evidence: `README.md`)
- Evaluation engine → Sticky storage: uses sticky values
- Statsig runtime → Event logging: logs events
- Event logging → Event queue: queues events
- Event queue → Network client: sends batches
- Network client → Statsig service: sends requests
