Sentry is an open-source application monitoring platform for real-time error tracking, performance tracing, session replay, and metrics.
- Language
- Python
- Database
- ClickHouse
- Running for
- 12 years
- Team
- 20+ people
Why this architecture
Pairing Django with Kafka and ClickHouse allows Sentry to ingest billions of events daily while providing sub-second analytical search across production traces.
Tech stack by layer
9 technologies · audited Sep 17, 2026- ReactDrives the performance dashboards, issue stream explorer, and trace visualizer in static/app.
- TypeScriptEnforces type safety across frontend application views, models, and API client types.
- EmotionCSS-in-JS styling library providing dynamic theme tokens and component styles.
- ClickHouseColumnar storage backing Snuba for petabyte-scale event queries and trace analytics.
- PostgreSQLPrimary relational database for projects, team memberships, user accounts, and auth tokens.
- KafkaStreaming message bus buffering incoming error events and telemetry between ingestion and storage.
- RedisHigh-speed cache for session states, rate limits, TSDB metric buffers, and Celery brokers.
Sentry architecture diagram
Open SVGDiagram as text
- Sentry SDKs (errors · spans) → Relay (Rust ingestion proxy): events
- Relay (Rust ingestion proxy) → Kafka (event topics): produce
- Kafka (event topics) → Event consumers (dedupe · fingerprint): consume
- Event consumers (dedupe · fingerprint) → Symbolicator (Rust · debug symbols): symbolicate
- Event consumers (dedupe · fingerprint) → Snuba (query engine): insert
- Snuba (query engine) → ClickHouse (events · spans): SQL
- Web app (React · TypeScript) → Sentry API (Django · Python): REST
- Sentry API (Django · Python) → Snuba (query engine): queries
- Sentry API (Django · Python) → PostgreSQL (orgs · projects): Django ORM
- Sentry API (Django · Python) → Redis (cache · broker): tasks
- Redis (cache · broker) → Celery tasks (alerts · digests): broker
Key architectural decisions
5 decisions- 01
Bifurcated architecture: transactional Django core with Snuba/ClickHouse analytics
Relational entities (organizations, projects, issue alert rules) reside in PostgreSQL via Django ORM, while raw crash events and performance spans route through Snuba into ClickHouse.
- 02
Kafka streaming pipeline buffers high-velocity event ingestion
Incoming crash reports from Sentry Relay proxies are queued into Apache Kafka topics before batch consumers perform deduplication, fingerprinting, and insertion into ClickHouse.
- 03
Symbolication and native stacktrace processing offloaded to Rust microservices
CPU-intensive debug symbol resolution (DWARF, dSYM, Proguard, Source maps) is delegated to specialized Rust services (Symbolicator, Relay) rather than blocking Python Django processes.
- 04
Snuba query engine provides a unified analytical API abstraction
Snuba sits in front of ClickHouse to parse structured analytical queries from Sentry, enforcing multi-tenant quotas, dataset aliases, and query optimizations automatically.
- 05
Hierarchical Redis caching and rate-limiting buffers
Redis buffers quota counters, rate limits, and short-lived session states, shielding PostgreSQL and Kafka from traffic bursts during severe production cascading outages.
How Sentry is built
How Sentry is structured
Sentry is developed as a comprehensive application monitoring platform spanning Python, TypeScript, and native services. The repository coordinates application servers, analytical query engines, frontend dashboards, and public developer APIs:
src/sentry/: The main Python codebase containing Django models (src/sentry/models/), REST API views (src/sentry/api/), background Celery tasks (src/sentry/tasks/), event ingestion rules, and notification dispatchers.static/app/: The single-page web dashboard built with React and TypeScript, housing the issue stream, distributed tracing flamegraphs, and performance analytics visualizers.bin/: Administrative CLI utilities, load generators (bin/mock-event), benchmark scripts (bin/benchmark-span-buffer), and local development bootstrapping tools.api-docs/: Automated OpenAPI documentation generation toolchain (api-docs/package.json) and schema validation scripts.
Frontend
The user interface in static/app/ is a large-scale React application built using modern TypeScript (package.json).
Sentry's dashboard delivers high-density developer data visualizations:
- Trace & Flamegraph Views: Visualizes end-to-end distributed transaction spans across microservice boundaries using custom Canvas rendering.
- Charts & Dashboards: Uses ECharts and custom SVG charting for time-series error volume, apdex scores, and latency percentiles (p50, p95, p99).
- Styling Architecture: Driven by Emotion CSS-in-JS, utilizing a comprehensive design token library that ensures accessible dark and light mode rendering.
- State Management: Combines React context, specialized reflux/reselect stores, and TanStack Query patterns for asynchronous server synchronization.
Backend & APIs
The backend server is implemented in Python on Django (pyproject.toml). Django manages organization hierarchies, role-based access control, SSO integrations, alert rules, and the extensive Sentry public REST API (/api/0/).
Event processing workflows operate asynchronously through Celery and Kafka:
- Ingestion & Relay: SDK telemetry payloads are received by Sentry Relay (a high-performance Rust proxy), validated, rate-limited against project quotas, and published to Apache Kafka.
- Consumer Processing: Python and Rust workers consume from Kafka topics, normalizing stacktraces, applying issue grouping fingerprints, and running alerting rule evaluations.
- Task Orchestration: Celery workers backed by Redis execute out-of-band operations, such as dispatching emails, Slack alerts, and external webhook web requests.
Data & persistence
Sentry employs a bifurcated database architecture designed to separate operational records from high-velocity telemetry:
- PostgreSQL: The relational system of record. PostgreSQL stores organizations, projects, user credentials, team permissions, integrations, saved queries, and alert configurations.
- ClickHouse & Snuba: All high-cardinality telemetry—error events, transaction spans, session recordings, and metric summaries—is stored in ClickHouse. Sentry accesses ClickHouse via Snuba, an internal query service that translates high-level analytics requests into optimized ClickHouse SQL.
- Apache Kafka: Acts as the central event distribution log between ingestion proxies, processing pipelines, and ClickHouse committers.
- Redis: Manages rate-limiting counters, project quota allocations, ephemeral cache stores, and Celery job queues.
Build, test & deploy
The build and quality assurance process includes:
- Linting & Type Checking: Enforced via Ruff for Python formatting, Mypy for static typing, and ESLint / oxfmtrc (
.oxfmtrc.json) for frontend TypeScript. - Testing: Thousands of unit and integration tests run with Pytest against containerized PostgreSQL, ClickHouse, and Kafka services. Frontend suites execute using Jest and Playwright.
- Continuous Integration: GitHub Actions workflows in
.github/workflowsrun automated matrix tests, file filters, and codeowners validation.
Self-hosting notes
Operating a self-hosted Sentry installation requires substantial infrastructure:
- Self-hosters typically utilize the
getsentry/self-hostedrepository, which orchestrates more than 20 interconnected containers via Docker Compose. - Recommended hardware requires at least 16 GB of RAM and fast NVMe storage to accommodate ClickHouse and Kafka disk writes.
- Key containers include Sentry Web, Sentry Worker, Sentry Cron, Sentry Relay, Snuba, ClickHouse, Kafka, Zookeeper, PostgreSQL, and Redis.
What to copy (and what not to)
Architectural patterns to emulate from Sentry:
- Separation of analytical storage from relational state: Delegating high-volume events to columnar ClickHouse while retaining PostgreSQL for users and rules keeps relational databases fast and maintainable.
- Intermediate event buffering: Placing Kafka in front of analytical ingestion pipelines allows systems to absorb sudden traffic spikes (e.g., error storms caused by a bad production release) without dropping events or crashing databases.
- Specialized native proxies for ingest validation: Offloading TLS termination, quota evaluation, and payload sanitization to high-performance proxies (like Relay in Rust) protects application servers from massive volumetric floods.
Avoid attempting to maintain this complex multi-tiered architecture (Kafka + ClickHouse + Snuba + Celery + PostgreSQL + Redis) for simple application monitoring needs when lightweight alternatives (like Sentry SaaS, GlitchTip, or basic OpenTelemetry collectors) suffice.
Sources & repo audit
- Audited
- Sep 17, 2026
- Commit
- 45f1842
- License
- NOASSERTION
- pyproject.toml (Python dependencies: Django, Celery, Redis, Kafka drivers, ClickHouse)
- package.json (Frontend dependencies: React 18, TypeScript, Emotion, ECharts)
- api-docs/package.json (OpenAPI documentation pipeline and schema generation)
Independent analysis of repository at github.com/getsentry/sentry. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/sentry)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Sentry's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# MISSION: Scaffold "Sentry" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Sentry**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Sentry
- **What It Does**: Sentry is an open-source application monitoring platform for real-time error tracking, performance tracing, session replay, and metrics.
- **Domain & Category**: Error Tracking Platform
- **Production Scale**: 20+ people
- **Development Mode**: CLASSIC
- **Architectural Rationale**: Pairing Django with Kafka and ClickHouse allows Sentry to ingest billions of events daily while providing sub-second analytical search across production traces.
- **Live Website Reference**: https://sentry.io
- **Source Repository**: https://github.com/getsentry/sentry
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: Python, Django, React, TypeScript, ClickHouse, PostgreSQL, Kafka, Redis, Celery
- **Primary Language(s)**: Python, TypeScript, MDX
- **License of the reference repo**: NOASSERTION
- **Frontend**: React — Drives the performance dashboards, issue stream explorer, and trace visualizer in static/app.; TypeScript — Enforces type safety across frontend application views, models, and API client types.; Emotion — CSS-in-JS styling library providing dynamic theme tokens and component styles.
- **Backend & APIs**: Python — Core backend runtime powering application endpoints, Celery workers, and event processing.; Django — Web framework serving the Sentry REST API, team permissions, and project configurations.; Celery — Distributed task queue managing asynchronous notifications, quotas, and digest delivery.
- **Data & persistence**: ClickHouse — Columnar storage backing Snuba for petabyte-scale event queries and trace analytics.; PostgreSQL — Primary relational database for projects, team memberships, user accounts, and auth tokens.; Kafka — Streaming message bus buffering incoming error events and telemetry between ingestion and storage.; Redis — High-speed cache for session states, rate limits, TSDB metric buffers, and Celery brokers.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/getsentry/sentry @ 45f1842)
1. **Bifurcated architecture: transactional Django core with Snuba/ClickHouse analytics**: Relational entities (organizations, projects, issue alert rules) reside in PostgreSQL via Django ORM, while raw crash events and performance spans route through Snuba into ClickHouse.
2. **Kafka streaming pipeline buffers high-velocity event ingestion**: Incoming crash reports from Sentry Relay proxies are queued into Apache Kafka topics before batch consumers perform deduplication, fingerprinting, and insertion into ClickHouse.
3. **Symbolication and native stacktrace processing offloaded to Rust microservices**: CPU-intensive debug symbol resolution (DWARF, dSYM, Proguard, Source maps) is delegated to specialized Rust services (Symbolicator, Relay) rather than blocking Python Django processes.
4. **Snuba query engine provides a unified analytical API abstraction**: Snuba sits in front of ClickHouse to parse structured analytical queries from Sentry, enforcing multi-tenant quotas, dataset aliases, and query optimizations automatically.
5. **Hierarchical Redis caching and rate-limiting buffers**: Redis buffers quota counters, rate limits, and short-lived session states, shielding PostgreSQL and Kafka from traffic bursts during severe production cascading outages.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
- Structure as a Turborepo monorepo with strict package boundaries:
- `apps/web`: Application UI, routing, layouts, and server endpoints.
- `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
- `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
- `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
- Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
- Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
- Isolate interactive UI state to leaf components. Keep core pages lightweight and performant.
4. **Design System & Aesthetics**:
- Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
- Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
- Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
- Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (ClickHouse, PostgreSQL, Kafka, Redis): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.Frequently asked about Sentry
What is Sentry built with?
Sentry is built with Python and Django on the backend, React and TypeScript on the frontend, using PostgreSQL, ClickHouse, Apache Kafka, and Redis for storage and streaming.
How does Sentry handle millions of error events per second?
Events are ingested through Rust-based Relay proxies, buffered in Apache Kafka, processed by distributed consumers, and stored in ClickHouse for high-speed columnar aggregation.
What is Snuba in the Sentry architecture?
Snuba is Sentry analytical search service and query engine that mediates queries over ClickHouse datasets, providing caching, quota tracking, and unified query schemas.
Can Sentry be self-hosted?
Yes. The Sentry Self-Hosted project provides an automated Docker Compose configuration orchestrating Django, ClickHouse, Kafka, PostgreSQL, and Redis.
One email a month: new deep dives and stack trends
New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.
Similar architectures
- PostHogHybridProduct Analytics Platform · 20+ peopleShares Django · Python · React
- GlitchTipHybridOpen-Source Error Tracking & APM · 2-5 PeopleShares Python · Django · PostgreSQL
- UmamiHybridWeb Analytics · SoloShares TypeScript · React · PostgreSQL
- Plausible AnalyticsClassicPrivacy Web Analytics · 2-5 peopleShares PostgreSQL · ClickHouse · React
- InfisicalHybridSecret Management · 6-20 peopleShares React · TypeScript · PostgreSQL
- TwentyHybridCRM SaaS · 6-20 peopleShares TypeScript · React · PostgreSQL