# getsentry/relay architecture

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

- Interactive diagram: https://gitdiagram.com/getsentry/relay
- Repository: https://github.com/getsentry/relay

## Overview

Relay is a proxy service between Sentry SDKs and Sentry, handling inbound submissions and either forwarding them upstream or, with processing enabled, normalizing, filtering, rate-limiting, and producing events to Kafka. Its documented product capabilities also include PII scrubbing and support for multiple data types. The graph emphasizes the server’s service orchestration and major domain subsystems; some implementation relationships are omitted because their source was not sampled.

Main entry points: [`relay-server/src/processing/mod.rs`](https://github.com/getsentry/relay/blob/master/relay-server/src/processing/mod.rs) (Event processing), [`relay-server/src/service.rs`](https://github.com/getsentry/relay/blob/master/relay-server/src/service.rs) (Service orchestration), [`relay-server/src/services/processor.rs`](https://github.com/getsentry/relay/blob/master/relay-server/src/services/processor.rs) (Envelope processor), [`relay-server/src/services/upstream.rs`](https://github.com/getsentry/relay/blob/master/relay-server/src/services/upstream.rs) (Upstream relay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Relay runtime"]
  node_entry["Relay entrypoint<br/>[main.rs]"]
  node_server["Service orchestration<br/>[service.rs]"]
  node_http["HTTP endpoints<br/>[mod.rs]"]
  node_auth["Authentication<br/>[lib.rs]"]
  node_projects["Project configuration<br/>[mod.rs]"]
end

subgraph group_ingestion["Ingestion and processing"]
  node_processor["Envelope processor<br/>[processor.rs]"]
  node_pipeline["Event processing<br/>[mod.rs]"]
  node_normalize["Normalization<br/>[lib.rs]"]
  node_filters["Inbound filters<br/>[lib.rs]"]
  node_quotas["Rate limits<br/>[lib.rs]"]
end

subgraph group_domain["Event data"]
  node_schema["Event protocol<br/>[event.rs]"]
  node_pii["PII scrubbing<br/>[lib.rs]"]
  node_profiles["Profiling<br/>[lib.rs]"]
  node_replays["Replays<br/>[lib.rs]"]
  node_metrics["Metrics and spans<br/>[lib.rs]"]
end

subgraph group_delivery["Delivery and integrations"]
  node_buffer["Envelope buffer<br/>[mod.rs]"]
  node_store["Event store<br/>[store.rs]"]
  node_upstream["Upstream relay<br/>[upstream.rs]"]
  node_kafka["Kafka<br/>[lib.rs]"]
  node_objectstore["Object storage<br/>[objectstore.rs]"]
end

node_sdk(("SDK or app"))
node_sentry(("Sentry server"))

node_sdk -.->|"submits events"| node_http
node_entry -.->|"runs services"| node_server
node_server -->|"starts"| node_processor
node_server -->|"starts"| node_buffer
node_server -->|"starts"| node_store
node_server -->|"starts"| node_upstream
node_server -->|"starts"| node_objectstore
node_server -->|"starts"| node_projects
node_http -.->|"authenticates"| node_auth
node_processor -.->|"processes"| node_pipeline
node_pipeline -->|"normalizes"| node_normalize
node_pipeline -->|"filters"| node_filters
node_pipeline -->|"rate limits"| node_quotas
node_pipeline -.->|"scrubs PII"| node_pii
node_pipeline -.->|"processes events"| node_schema
node_processor -->|"produces events"| node_kafka
node_server -->|"forwards submissions"| node_upstream
node_upstream -.->|"forwards"| node_sentry
node_pipeline -.->|"handles profiles"| node_profiles
node_pipeline -.->|"handles replays"| node_replays
node_pipeline -.->|"handles metrics"| node_metrics

click node_entry "https://github.com/getsentry/relay/blob/master/relay/src/main.rs"
click node_server "https://github.com/getsentry/relay/blob/master/relay-server/src/service.rs"
click node_http "https://github.com/getsentry/relay/blob/master/relay-server/src/endpoints/mod.rs"
click node_auth "https://github.com/getsentry/relay/blob/master/relay-auth/src/lib.rs"
click node_projects "https://github.com/getsentry/relay/blob/master/relay-server/src/services/projects/source/mod.rs"
click node_processor "https://github.com/getsentry/relay/blob/master/relay-server/src/services/processor.rs"
click node_pipeline "https://github.com/getsentry/relay/blob/master/relay-server/src/processing/mod.rs"
click node_normalize "https://github.com/getsentry/relay/blob/master/relay-event-normalization/src/lib.rs"
click node_filters "https://github.com/getsentry/relay/blob/master/relay-filter/src/lib.rs"
click node_quotas "https://github.com/getsentry/relay/blob/master/relay-quotas/src/lib.rs"
click node_schema "https://github.com/getsentry/relay/blob/master/relay-event-schema/src/protocol/event.rs"
click node_pii "https://github.com/getsentry/relay/blob/master/relay-pii/src/lib.rs"
click node_profiles "https://github.com/getsentry/relay/blob/master/relay-profiling/src/lib.rs"
click node_replays "https://github.com/getsentry/relay/blob/master/relay-replays/src/lib.rs"
click node_metrics "https://github.com/getsentry/relay/blob/master/relay-metrics/src/lib.rs"
click node_buffer "https://github.com/getsentry/relay/blob/master/relay-server/src/services/buffer/mod.rs"
click node_store "https://github.com/getsentry/relay/blob/master/relay-server/src/services/store.rs"
click node_upstream "https://github.com/getsentry/relay/blob/master/relay-server/src/services/upstream.rs"
click node_kafka "https://github.com/getsentry/relay/blob/master/relay-kafka/src/lib.rs"
click node_objectstore "https://github.com/getsentry/relay/blob/master/relay-server/src/services/objectstore.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_entry,node_server,node_http,node_auth,node_projects toneBlue
class node_processor,node_pipeline,node_normalize,node_filters,node_quotas toneAmber
class node_schema,node_pii,node_profiles,node_replays,node_metrics,node_sentry toneMint
class node_buffer,node_store,node_upstream,node_kafka,node_objectstore toneRose
class node_sdk toneIndigo
```

## Components

### Relay runtime

- [Relay entrypoint](https://github.com/getsentry/relay/blob/master/relay/src/main.rs): `relay/src/main.rs`
- [Service orchestration](https://github.com/getsentry/relay/blob/master/relay-server/src/service.rs): `relay-server/src/service.rs`
- [HTTP endpoints](https://github.com/getsentry/relay/blob/master/relay-server/src/endpoints/mod.rs): `relay-server/src/endpoints/mod.rs`
- [Authentication](https://github.com/getsentry/relay/blob/master/relay-auth/src/lib.rs): `relay-auth/src/lib.rs`
- [Project configuration](https://github.com/getsentry/relay/blob/master/relay-server/src/services/projects/source/mod.rs): `relay-server/src/services/projects/source/mod.rs`

### Ingestion and processing

- [Envelope processor](https://github.com/getsentry/relay/blob/master/relay-server/src/services/processor.rs): `relay-server/src/services/processor.rs`
- [Event processing](https://github.com/getsentry/relay/blob/master/relay-server/src/processing/mod.rs): `relay-server/src/processing/mod.rs`
- [Normalization](https://github.com/getsentry/relay/blob/master/relay-event-normalization/src/lib.rs): `relay-event-normalization/src/lib.rs`
- [Inbound filters](https://github.com/getsentry/relay/blob/master/relay-filter/src/lib.rs): `relay-filter/src/lib.rs`
- [Rate limits](https://github.com/getsentry/relay/blob/master/relay-quotas/src/lib.rs): `relay-quotas/src/lib.rs`

### Event data

- [Event protocol](https://github.com/getsentry/relay/blob/master/relay-event-schema/src/protocol/event.rs): `relay-event-schema/src/protocol/event.rs`
- [PII scrubbing](https://github.com/getsentry/relay/blob/master/relay-pii/src/lib.rs): `relay-pii/src/lib.rs`
- [Profiling](https://github.com/getsentry/relay/blob/master/relay-profiling/src/lib.rs): `relay-profiling/src/lib.rs`
- [Replays](https://github.com/getsentry/relay/blob/master/relay-replays/src/lib.rs): `relay-replays/src/lib.rs`
- [Metrics and spans](https://github.com/getsentry/relay/blob/master/relay-metrics/src/lib.rs): `relay-metrics/src/lib.rs`

### Delivery and integrations

- [Envelope buffer](https://github.com/getsentry/relay/blob/master/relay-server/src/services/buffer/mod.rs): `relay-server/src/services/buffer/mod.rs`
- [Event store](https://github.com/getsentry/relay/blob/master/relay-server/src/services/store.rs): `relay-server/src/services/store.rs`
- [Upstream relay](https://github.com/getsentry/relay/blob/master/relay-server/src/services/upstream.rs): `relay-server/src/services/upstream.rs`
- [Kafka](https://github.com/getsentry/relay/blob/master/relay-kafka/src/lib.rs): `relay-kafka/src/lib.rs`
- [Object storage](https://github.com/getsentry/relay/blob/master/relay-server/src/services/objectstore.rs): `relay-server/src/services/objectstore.rs`

### Other components

- **SDK or app**
- **Sentry server**

## Connections

- SDK or app → HTTP endpoints: submits events (evidence: `README.md`)
- Relay entrypoint → Service orchestration: runs services
- Service orchestration → Envelope processor: starts (evidence: `relay-server/src/service.rs`)
- Service orchestration → Envelope buffer: starts (evidence: `relay-server/src/service.rs`)
- Service orchestration → Event store: starts (evidence: `relay-server/src/service.rs`)
- Service orchestration → Upstream relay: starts (evidence: `relay-server/src/service.rs`)
- Service orchestration → Object storage: starts (evidence: `relay-server/src/service.rs`)
- Service orchestration → Project configuration: starts (evidence: `relay-server/src/service.rs`)
- HTTP endpoints → Authentication: authenticates
- Envelope processor → Event processing: processes
- Event processing → Normalization: normalizes (evidence: `README.md`)
- Event processing → Inbound filters: filters (evidence: `README.md`)
- Event processing → Rate limits: rate limits (evidence: `README.md`)
- Event processing → PII scrubbing: scrubs PII (evidence: `README.md`)
- Event processing → Event protocol: processes events
- Envelope processor → Kafka: produces events (evidence: `README.md`)
- Service orchestration → Upstream relay: forwards submissions (evidence: `README.md`)
- Upstream relay → Sentry server: forwards (evidence: `README.md`)
- Event processing → Profiling: handles profiles
- Event processing → Replays: handles replays
- Event processing → Metrics and spans: handles metrics
