PostHog Project Structure

The all-in-one platform for product analytics, session replay, and feature flags. PostHog is built as a highly performant polyglot monorepo, combining a Django backend, a React frontend, and a specialized Rust-based ingestion engine.

Updated 2025-12-30

#posthog #analytics #django #react #rust #clickhouse #monorepo #open-source
PNGPDF

Project Directory

posthog/
posthog/
The core Django application
api/
REST API endpoints
models/
Data models
hogql/
HogQL (SQL-like) engine
frontend/
Main dashboard (React)
src/
React source code
scenes/
Page-level components
plugin-server/
Node.js service for ingestion and plugins
rust/
High-performance services (e.g., Capture)
ee/
Enterprise edition features
infra-scripts/
Deployment and infra tools
package.json
Root workspace file

Repository Info

  • Repository-PostHog/posthog
  • Stars-20k+
  • License-MIT / Proprietary (ee)
  • Last Analyzed-December 2025

Tech Stack

  • Backend-Python (Django)
  • Frontend-React
  • Ingestion-Node.js & Rust
  • Database-ClickHouse & PostgreSQL
  • Queuing-Kafka & Redis

Architecture Notes

PostHog is a 'Product OS' that manages massive data volumes. Its architecture is built around ClickHouse for lightning-fast analytical queries and Kafka for high-throughput data ingestion. The monorepo strategy allows them to manage closely coupled services—like the Django API and the Node.js plugin server—while using Rust for performance-critical ingestion paths. They've also pioneered 'HogQL', an internal SQL dialect that enables powerful, type-safe data exploration directly from their frontend.

Key Directories

  • posthog/-Houses the primary business logic, API, and the HogQL analytical engine
  • frontend/-A complex React application featuring a data-rich dashboard and session replay tools
  • plugin-server/-Handles real-time data processing, plugin execution, and Kafka ingestion
  • rust/-Contains optimized services for capturing events at scale with minimal latency

Why This Structure?

PostHog is one of the most sophisticated open-source architectures available. It's a goldmine for anyone interested in high-volume data ingestion, analytical databases (ClickHouse), and building a platform that combines multiple technologies (Python, Node, Rust) into a unified product experience.

Share this template

Related Templates

© 2025 FolderStructure.dev