PostHog has two type generation systems that keep frontend and backend in sync. This guide covers both directions and best practices for each…
Language: en
Indexed excerpt
Copy pageType system guideContentsOverviewBackend → Frontend (API responses)OwnershipWhere types liveNaming conventionsZod validation schemasRegenerating typesAdding a new product's APIDocumenting query parametersTroubleshootingDesign decisionsFrontend → Backend (query types)How it worksRegeneratingWhen to add types hereHelp clean upQuick winsWhen touching existing codePostHog has two type generation systems that keep frontend and backend in sync. This guide covers both directions and best practices for each.OverviewFlowSource of truthGenerated outputUsed forBackend → FrontendDjango serializersTypeScript + Zod (Orval)API types, client functions, and validation schemasFrontend → BackendTypeScript schema.tsPydantic schema.pyQuery types (HogQL, filters, insights), some legacy typesThese are independent systems. Don't conflate them.Backend → Frontend (API responses)We use Orval to generate TypeScript types and API client functions from our OpenAPI schema.OwnershipBackend owns response types – Generated from Django serializers via OpenAPIFrontend owns request/query types – Handwritten types for queries, filters, UI stateDo not manually redefine backend response types in frontend codeWhe…
Note: This page refers to our main product repository , not our website. Frontend Web framework/library: React State management: Redux + Kea…
Language: en
Indexed excerpt
Copy pageTech stackContentsFrontendBackendTestingAdditional toolsWorkflow orchestrationWhen to use each toolCost: Temporal vs DagsterWhere do we use each?Note: This page refers to our main product repository, not our website.FrontendWeb framework/library: ReactState management: Redux + KeaLayout/components: Ant DesignBackendFramework: DjangoHigh scale services: RustDatabases: PostgreSQL and ClickHouseTask queue/event streaming: Redis and Apache KafkaTask Worker: Celery, Temporal and DagsterTestingFrontend E2E tests: PlaywrightBackend tests: Pytest and Django's built-in test suiteAdditional toolsCI/CD: GitHub ActionsContainerization: Docker and Docker ComposeLinter (frontend): ESLintFormatter (backend): BlackWorkflow orchestrationWe historically used Celery as our task worker. At PostHog’s current scale Celery can be unreliable for larger or long-running workflows, but it remains a practical fit for small, low-latency background tasks (e.g. sending emails or other quick async side-effects). New medium- and large-scale jobs should use Temporal or Dagster instead.We use both Temporal and Dagster for more complex orchestration, each chosen for their specific strengths.When to use each …
Manual setup This documentation is deprecated, and likely not up to date. Please use the Flox-based instant setup instead. 1. Spin up external…
Language: en
Indexed excerpt
Copy pageManual development setupContentsManual setup1. Spin up external services2. Prepare the frontend3. Prepare nodejs services4. Prepare the Django server5. Prepare databases6. Start PostHog7. DevelopManual setupThis documentation is deprecated, and likely not up to date. Please use the Flox-based instant setup instead.1. Spin up external servicesIn this step we will start all the external services needed by PostHog to work.First, append line 127.0.0.1 kafka clickhouse clickhouse-coordinator objectstorage and line ::1 kafka clickhouse clickhouse-coordinator objectstorage to /etc/hosts. Our ClickHouse and Kafka data services won't be able to talk to each other without these mapped hosts. You can do this with:TerminalPostHog AI[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}echo '127.0.0.1 kafka clickhouse clickhouse-coordinator objectstorage' | sudo tee -a /etc/hostsecho '::1 kafka clickhouse clickhouse-coordinator objectstorage' | sudo tee -a /etc/hostsIf you are using a newer (>=4.1) version of Podman instead of Docker, the host machine's /etc/host…
OAuth Development Guide This guide helps developers set up and test PostHog's OAuth apps locally. Quick Start 1. Configure RSA Keys OAuth uses RS25…
Language: en
Indexed excerpt
Copy pageOAuth Development GuideContentsOAuth Development GuideQuick Start1. Configure RSA Keys2. Set Up Your Environment3. Access the Demo ApplicationCreating an OAuth ApplicationVia Django AdminApplication FieldsBasic InformationAuthorization SettingsOwnershipClient TypesConfidential ClientsPublic ClientsOAuth FlowStandard Authorization Code Flow with PKCEAvailable ScopesOpenID Connect ScopesAccess LevelsTesting Your OAuth ApplicationUsing the Admin InterfaceManual TestingSelf-registered client logosSigned-out visitorsEndpointsToken IntrospectionAuthentication Methods1. HTTP Basic Authentication (Recommended)2. Client Credentials in Request Body3. Bearer Token AuthenticationScope RequirementsResponse FormatToken TypesExample: Introspecting with Client CredentialsExample: Introspecting with Bearer TokenTroubleshooting"Invalid client_id""Redirect URI mismatch""Invalid code_verifier""Invalid client_secret"Additional ResourcesOAuth Development GuideThis guide helps developers set up and test PostHog's OAuth apps locally.Quick Start1. Configure RSA KeysOAuth uses RS256 for signing JWT tokens. Copy the RSA private key from the example file:TerminalPostHog AI[data-radix-scroll-area-view…
❗️ This guide is intended only for development of PostHog itself. If you're looking to deploy PostHog for your product analytics needs, go to Self…
Language: en
Indexed excerpt
Copy pageDeveloping locallyContentsWhat does PostHog look like on the inside?Option 1: Developing locallyPrerequisitesmacOSUbuntuCloning the repositorySetup with Flox (recommended)Customizing which services runSetting environment variablesRunning in detached modeManual setupCommon gotchasOption 2: Developing with Coder workspaces (PostHog employees only)TestingFrontendBackendEnd-to-endDjango migrationsNon-blocking migrationsResolving merge conflictsExtra: Working with feature flagsExtra: Debugging with VS CodeExtra: Debugging the backend in PyCharmSetup PyCharmStart the debugging environmentExtra: Accessing PostgresExtra: Accessing ClickHouseExtra: Accessing the Django AdminExtra: Sending emailsExtra: Integrating with slackExtra: Use tracing with JaegerProduction usageSetting up Customer.io emailsSetting up SMTP emailsCreating a new emailExtra: Using AI assistants with your local dev environmentSetupAvailable toolsExample usageExtra: Developing paid features (PostHog employees only)Extra: Resetting your local databaseExtra: API typesExtra: Working on multiple branches simultaneouslyExtra: Working with the data warehouse❗️ This guide is intended only for development of PostHog itsel…
Setting up HTTPS locally can be useful if you're trying to debug hard to replicate issues (e.g cross domain cookies, etc). There are two ways you can…
Language: en
Indexed excerpt
Copy pageSetting up SSL locallyContentsSet up SSL via ngrokSet up SSL via NGINX and a local certificateSetting up HTTPS locally can be useful if you're trying to debug hard to replicate issues (e.g cross domain cookies, etc).There are two ways you can get HTTPS locally:ngrokNGINX and a local certificate.The easiest option is to use ngrok.Set up SSL via ngrokSign up for an ngrok account (or sign in with GitHub) and run ngrok authtoken <TOKEN>Find your ngrok config file location:TerminalPostHog AI[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}ngrok config check --log=stdoutOn macOS, this will show ~/Library/Application Support/ngrok/ngrok.yml (XDG location). The legacy location ~/.ngrok2/ngrok.yml is deprecated.Edit your ngrok config file and add the following after the line with authtoken: <TOKEN>:YAMLPostHog AI[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}tunnels: django: proto: http addr: 8000 webpack: proto: http addr: …
This is an internal guide to setting up and working with the data warehouse for PostHog engineers. If you're a PostHog user, check out our data…
Language: en
Indexed excerpt
Copy pageWorking with data warehouseContentsAdding a new sourceImporting your local Postgres instanceAccessing object storageSetting up a MySQL sourceWorking with a MS SQL sourceThis is an internal guide to setting up and working with the data warehouse for PostHog engineers. If you're a PostHog user, check out our data warehouse docs instead.Adding a new sourceLooking to add a new source to data warehouse? We have a detailed guide in the codebase.If you're a customer of PostHog Cloud and are looking to import data into your project, then you're likely looking for this section of the docs insteadImporting your local Postgres instanceHead to the new source flow in your local app, hit the link button next to PostgresUse the following settings:host = 127.0.0.1port = 5432database = posthoguser = posthogpassword = posthogschema = publicHit next, then select which tables you'd like to import. More info on the sync types can be found here. For the Postgres-specific xmin (cursorless incremental) sync type and its limitations, see the Postgres source READMEHit next and finish the import - temporal-worker-data-warehouse will then import the data into your local object storageAccessing object…
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
The desktop for product builders – run a fleet of agents that build your product, not just your code
Language: en
Indexed excerpt
LetPostHoganalyzedebuginstrumentshipexperimentqueryflagcodeanalyzecodeDiscordThe product editor for product buildersA multiplayer workspace for you, your team, and your agents – with your product data as context, and PostHog tools to ship and measure.Build and edit your productRun a fleet of agentsTurn product signals into PRsDownloadRead the docsThe old way to build with AIMost AI code editors lack context. They use your <codebase /> as the source of truth and wait for you to hit Build ↵ – not how people actually use your product.Sound familiar?You're using Claude Code, Codex, or another agent to prompt real engineering workYou've got the PostHog MCP wired into your editor, terminal, maybe your CIRunning a handful of agents in parallel doesn't even feel like a flex anymoreEvery session starts cold, no memory of the last decision or PRYou're still the one watching the rollout and catching regressionsTABLE STAKES 2026(yep, PostHog has that)parallel agents$0.00multi model$0.00MCP servers$0.00code diffs$0.00cloud sandboxes$0.00AI sparkles$0.00TOTAL$0.00thanks for shopping at agent martThe PostHog waySignalsIn-app activityLogsErrorsPaymentsSession recordingsTracesFunnel dropoffFeature …
PostHog has a powerful API that enables you to capture, evaluate, create, update, and delete nearly all of your information in PostHog. You can use it…
Language: en
Indexed excerpt
Copy pageAPI overviewContentsAuthenticationRate limitingResponsesStatus code: 200Status code: 400Status code: 401Status code: 503 (Deprecated)PaginationTipsGitHub secret scanningPostHog has a powerful API that enables you to capture, evaluate, create, update, and delete nearly all of your information in PostHog. You can use it to pull information into your app, update metadata programmatically, capture events from any language that can send HTTP requests, and more.The API is available for all users and instances. It contains two types of endpoints:Public POST-only endpoints such as /i/v0/e and /flags are used for capturing events, batching events, updating person or group information, and evaluating feature flags. These don't require authentication, but use your project token to handle the request.Private GET, POST, PATCH, DELETE endpoints are used for querying, creating, updating, or deleting nearly all data in PostHog. They give the same access as if you were logged into your PostHog instance, but require authentication with your personal API key.You must make API requests to the correct domain. On US Cloud, these are https://us.i.posthog.com for public endpoints and https://us.p…
We learned an interesting fact recently: only 20% of our users track their marketing website and their product using PostHog. This is our fault. We…
Language: en
Indexed excerpt
Copy pageHow (and why) our marketing team uses PostHogAndy VandervellSep 28, 2022Guides, Product analytics, MarketingContentsThe goals of our marketing teamMarketing dashboardCore KPIsCircuit breakersWebsite dashboardSEO performance trackingThings we don't measure.Content marketing effectivenessWhat is 'Showed Intent'?Content + intent = effectivenessHow did we do in Q3?What's next?Quality signals for new usersImproving how we track attributionMarketing experimentsFinal thoughtsWe learned an interesting fact recently: only 20% of our users track their marketing website and their product using PostHog. This is our fault. We market to engineers at PostHog, so it's not a surprise we're less used for marketing.But here's another fact: all the things that make PostHog great for understanding your product also apply to your marketing website. To demonstrate, we're sharing how we use PostHog for marketing.The goals of our marketing teamTo start, let's talk about our goals as a marketing team. In Q3 2022, these were:Average 420 weekly 'new organization signups'Increase Organic SEO traffic to 5,000 unique users per weekAcquire 20 new reviews on our G2 profileOf course, these are just top-lev…
The single platform for engineers to analyze, test, observe, and deploy new features. Product analytics, session replay, feature flags, experiments, CDP, and more.
Our mission Equip every developer to build successful products. Why is that our mission? Since the beginning, we've believed that engineers should be…
Language: en
Indexed excerpt
Copy pageWhy does PostHog exist? Our mission and strategyContentsOur missionWhy is that our mission?Our strategy1. Be the source of truth for all product context2. Provide every tool engineers need to build successful products3. Get in first4. Automate the iteration processSecret master planOur missionEquip every developer to build successful products.Why is that our mission?Since the beginning, we've believed that engineers should be way more involved in making product decisions than they've been historically. In order to help them do that, we've built a collection of tools for engineers. Similar tools to the ones we've built have existed for a long time, but they were always built with other users in mind. By building things like product analytics, session replays, feature flags and a data warehouse for engineers first, we give engineers the ability to make product decisions themselves. This massively increases the speed at which engineers can make good decisions.The other way PostHog helps engineers is by combining all the tools they need into one product. This avoids a ton of work integrating and linking up various products, both when integrating and ongoingly.We try to help en…
Data sources & import (ELT)Let AI connect your sources for youSkip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.npx @posthog/wizard warehouseLearn moreLet AI connect your sources for youConnect your external databases, SaaS tools, ad platforms, and more to sync data in bulk into your PostHog warehouse for analysis and modeling. All events and user data captured via PostHog SDKs are automatically available in your warehouse as well.1PasswordAblyActiveCampaignAdjustAdobe AnalyticsAdobe Commerce (Magento)AdRollAdyenAfterShipAgileCRMAha!Aha! IdeasAirbrakeAircallAirOpsAirtableAirwallexAivenAlgoliaAlgunaAlpha VantageAmazon AdsAmazon SESAmplitudeAnthropicApify DatasetApitallyApolloAppfiguresAppFollowApple (App Store Connect)Apple AdsAppLovinAppsFlyerAppSignalAppstackApptio Cloudability (IBM)Argo CDAsaasAsanaAshbyAskNicelyAssemblyAIAtlassian Bitbucket CloudAttentiveAttioAutomoxAutumnAvalara AvaTaxAviationstackAviatorAwinAWS BudgetsAWS Cost Anomaly DetectionAWS Cost ExplorerAWS OrganizationsAzure BlobAzure DevOpsBabelforceBack Market (Back Market SAS)BambooHRBaserowBatonBeamerbeehiivBetter StackBettermodeBigComm…
Small teamsWe've organized the company into small teams that are multi-disciplinary and as self-sufficient as possible. Learn how small teams work. AI GatewayAI ObservabilityAI ResearchAnalytics PlatformAPMBatch ExportsBillingBlitzscale4+Builder RelationsClickHouseClient LibrariesCloud FoundationsCloud PlatformConversationsCustomer AnalyticsCustomer Success EU3+Customer Success NA5+Data ModelingData ToolsDemand GenDeveloper ExperienceEditorialError TrackingExperimentsFeature FlagsForward Deployed EngineeringGraphicsGrowthGTM EngineeringIngestionManaged WarehouseMarketingMCP AnalyticsNew Business Sales4+OnboardingPeople & Ops2+Platform FeaturesPlatform UXPostHog Desktop3+Product AnalyticsProduct-Led Sales EastProduct-Led Sales West3+ReplaySecuritySelf-Driving5+Support8+SurveysTalent2+Warehouse SourcesWeb AnalyticsWebsiteWizard & DocsWorkflowsYouTube