How jamestrichmond/posthog works
PostHog is a product-data platform: teams and their agents send product context, then query it to understand behavior and take action. The repository includes event and replay ingestion, query and warehouse capabilities, and product areas for analytics, observability, experimentation, user communication, and AI. The README supports this high-level flow and capability map; sampled code additionally shows selected query, storage, and ingestion relationships. Many product modules are represented by their existing directories because their implementation was not sampled, so unverified internal connections are omitted.
Main entry points: services_query_runner.py Logs query · queryDatabaseLogic.tsx Warehouse editor · session-replay-pipeline.ts Replay ingestion · direct_query_engines.py SQL engine adapters
Components 23
Ingestion
- Event ingestion
nodejs/src/ingestion/common/common-ingestion-pipeline.ts - Replay ingestion
nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.ts - Log ingestion
nodejs/src/logs/framework/logs-pipeline-context.ts - Log consumer
nodejs/src/logs/logs-ingestion-consumer.ts
Query and data
- Warehouse sources
products/data_warehouse/backend - SQL engine adapters
products/data_warehouse/backend/direct_query_engines.py - Warehouse editor
frontend/src/scenes/data-warehouse/editor/sidebar/queryDatabaseLogic.tsx - HogQL parser
posthog/hogql/parser.py - Query runner
posthog/hogql_queries/query_runner.py - Query cache
posthog/query_cache/storage.py - Object storage
posthog/storage/object_storage.py - Data pipelines
products
Product analytics
- Product and web analytics
products - Session replay and heatmaps
common/replay-headless/src
Observability
- Logs query
products/logs/backend/services_query_runner.py - Log models
products/logs/backend/models.py - AI observability
products/ai_observability
Ship and engage
- Flags and experiments
products - Surveys and support
products
AI and agents
- PostHog AI
ee/hogai - MCP analytics
ee/hogai/mcp_tool.py - Self-driving
products
Other components
- Teams and agents
Connections 22
- Teams and agents → Event ingestion: send events
- Teams and agents → Replay ingestion: send recordings
- Teams and agents → Log ingestion: send logs
- Replay ingestion → Session replay and heatmaps: processes recordings
nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.ts - Log consumer → Log ingestion: uses context
nodejs/src/logs/framework/logs-pipeline-context.ts - Teams and agents → Warehouse editor: query data
- Warehouse editor → SQL engine adapters: selects sources
products/data_warehouse/backend/direct_query_engines.py - SQL engine adapters → Warehouse sources: builds table rows
products/data_warehouse/backend/direct_query_engines.py - Warehouse editor → Query runner: runs SQL
- Logs query → HogQL parser: uses parser
products/logs/backend/services_query_runner.py - Logs query → Query runner: uses query runner
products/logs/backend/services_query_runner.py - Logs query → Log models: queries models
products/logs/backend/services_query_runner.py - Query cache → Object storage: stores large results
posthog/query_cache/storage.py - Teams and agents → Product and web analytics: analyze behavior
- Teams and agents → Session replay and heatmaps: watch sessions
- Teams and agents → Flags and experiments: roll out and test
- Teams and agents → Surveys and support: engage users
- Teams and agents → Data pipelines: transform and export
- Teams and agents → AI observability: inspect AI traces
- Teams and agents → PostHog AI: ask product data
- Teams and agents → MCP analytics: inspect agent usage
- Teams and agents → Self-driving: review reports