docs/published/handbook/engineering/project-structure.md
Note: This page refers to our main product repository, not our website.
.
├── bin # Shell scripts wrapped by hogli, the unified developer CLI
├── common # Shared code: hogli CLI, PostHog SQL parser, HogVM, shared UI packages
├── ee # Enterprise platform package features (separate license)
├── frontend # React/TypeScript frontend application
│ └── src
│ └── layout # App layout components (navigation, sidebars)
│ └── lib # Reusable components and utilities
│ └── scenes # Page-specific components
│ └── queries # Query builder components
│ └── toolbar # PostHog Toolbar code
├── livestream # Golang service for live events API
├── playwright # End-to-end tests using Playwright
├── nodejs # Node.js service for event ingestion and plugins
├── posthog # Django backend application
│ └── api # REST API endpoints
│ └── clickhouse # ClickHouse database interactions
│ └── hogql # HogQL query language implementation
│ └── models # Django ORM models
│ └── tasks # Celery background tasks
├── products # Product-specific code (vertical slices)
└── rust # High-performance Rust services
*Selected subdirectories only
frontendThe PostHog web application, built with React and TypeScript. Uses Kea for state management.
src/lib – Reusable components and utilitiessrc/scenes – Page-specific components organized by featuresrc/queries – Query builder and data visualization componentssrc/toolbar – Code for the PostHog ToolbarposthogThe Django backend application. Key subdirectories:
api – REST API endpoints and serializersclickhouse – ClickHouse schema definitions and migrationshogql – PostHog SQL query language compiler and executormodels – Django ORM models (PostgreSQL)tasks – Celery background tasksproductsProduct-specific code organized as vertical slices. Each product folder contains its own backend (Django app), frontend (React), and optionally shared code. This structure allows features to evolve independently.
See the products README for detailed conventions.
nodejsNode.js service responsible for:
rustHigh-performance Rust services including:
capture – Event capture endpointfeature-flags – Feature flag evaluationcymbal – Error tracking symbolicationcommonShared code used across the codebase:
hogli – Unified developer CLI for building, testing, and running PostHoghogql_parser – PostHog SQL parser (C++)hogvm – Hog virtual machinetailwind – Shared Tailwind configurationeeEnterprise edition licensed features. This directory has a separate license - not MIT. For 100% FOSS code, see PostHog/posthog-foss.
playwrightEnd-to-end tests using Playwright. Tests live in the e2e/ subdirectory.
livestreamGolang service powering the live events feed in the Activity tab.