Official docs, website, and handbook for PostHog.
See the code
Support - Roadmap - Open an issue - Style guide
This is the repository for the PostHog website. We treat it like a product. It contains:
AGENTS.mdis equipped with instructions for the most fundamental parts of running the app.If you find places where current documentation is lacking, email cory@posthog.com with the subject, "AGENTS.md".
Pre-installation
Install Node (version 22) - if you installed Node using nvm, you can run nvm use to automatically switch to the correct version.
Install pnpm. The easiest way to do this is via corepack use pnpm@latest-10.
Start developing
Clone the repo and navigate into your new site’s directory:
git clone git@github.com:PostHog/posthog.com.git && cd posthog.com/
If you're using an Apple Silicon Mac (M1 or later) you'll need to run the following commands:
rm -rf ./node_modules
brew install vips
Then install the site dependencies, and start it up:
pnpm install
pnpm start
Tip: Seeing a discrepancy between local development and staging/production? Preview the production build locally by running
gatsby build && gatsby serve
Open the source code and start editing!
Your site is now running at http://localhost:8001!
Note: You'll also see a second link:
http://localhost:8001/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.
See full instructions on developing PostHog.com locally in our manual.
masterpnpm clean && mkdir .cache & pnpm start or delete node_modules and .cache/docs/api?The site will load the API schema from US Cloud by default. You can override this to use your local PostHog instance with an env var:
POSTHOG_OPEN_API_SPEC_URL="http://127.0.0.1:8000/api/schema/" pnpm start
You’ll need to set environment variables for these. See (private) instructions for this.
To see your local version of the posts section, /posts needs to be visited directly (http://localhost:8001/posts)
PR previews build with GATSBY_MINIMAL=true (same idea as pnpm build:minimal). Post listing pages such as /tutorials, /blog, and /posts are not generated, so those URLs may break in the preview. Open the direct URL to your doc or post (e.g. /tutorials/your-slug) to review changes. Listings and search stay aligned with production after merge to master. More detail: Developing the website → PR preview deployments.
Additional environment variables are needed to develop the merch store:
SHOPIFY_APP_PASSWORDGATSBY_MYSHOPIFY_URLGATSBY_SHOPIFY_STOREFRONT_TOKENCurrently, these environment variables are excluded from Vercel preview builds to disable merch store node creation and speed up build times on non-merch related PRs.
To develop a dynamic open graph image:
pnpm build with both the ASHBY_API_KEY and GITHUB_API_KEY set.gatsby/onPostBuild.ts, temporarily comment out the following:
if (process.env.VERCEL_GIT_COMMIT_REF !== 'master') return
public/og-images/We <3 contributions big and small. In priority order (although everything is appreciated) with the most helpful first:
336 followers · starred Sep 2025
544 followers · starred Feb 2026
103 followers · starred Nov 2025
502 followers · starred Sep 2025
Official docs, website, and handbook for PostHog.
See the code
Support - Roadmap - Open an issue - Style guide
This is the repository for the PostHog website. We treat it like a product. It contains:
AGENTS.mdis equipped with instructions for the most fundamental parts of running the app.If you find places where current documentation is lacking, email cory@posthog.com with the subject, "AGENTS.md".
Pre-installation
Install Node (version 22) - if you installed Node using nvm, you can run nvm use to automatically switch to the correct version.
Install pnpm. The easiest way to do this is via corepack use pnpm@latest-10.
Start developing
Clone the repo and navigate into your new site’s directory:
git clone git@github.com:PostHog/posthog.com.git && cd posthog.com/
If you're using an Apple Silicon Mac (M1 or later) you'll need to run the following commands:
rm -rf ./node_modules
brew install vips
Then install the site dependencies, and start it up:
pnpm install
pnpm start
Tip: Seeing a discrepancy between local development and staging/production? Preview the production build locally by running
gatsby build && gatsby serve
Open the source code and start editing!
Your site is now running at http://localhost:8001!
Note: You'll also see a second link:
http://localhost:8001/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.
See full instructions on developing PostHog.com locally in our manual.
masterpnpm clean && mkdir .cache & pnpm start or delete node_modules and .cache/docs/api?The site will load the API schema from US Cloud by default. You can override this to use your local PostHog instance with an env var:
POSTHOG_OPEN_API_SPEC_URL="http://127.0.0.1:8000/api/schema/" pnpm start
You’ll need to set environment variables for these. See (private) instructions for this.
To see your local version of the posts section, /posts needs to be visited directly (http://localhost:8001/posts)
PR previews build with GATSBY_MINIMAL=true (same idea as pnpm build:minimal). Post listing pages such as /tutorials, /blog, and /posts are not generated, so those URLs may break in the preview. Open the direct URL to your doc or post (e.g. /tutorials/your-slug) to review changes. Listings and search stay aligned with production after merge to master. More detail: Developing the website → PR preview deployments.
Additional environment variables are needed to develop the merch store:
SHOPIFY_APP_PASSWORDGATSBY_MYSHOPIFY_URLGATSBY_SHOPIFY_STOREFRONT_TOKENCurrently, these environment variables are excluded from Vercel preview builds to disable merch store node creation and speed up build times on non-merch related PRs.
To develop a dynamic open graph image:
pnpm build with both the ASHBY_API_KEY and GITHUB_API_KEY set.gatsby/onPostBuild.ts, temporarily comment out the following:
if (process.env.VERCEL_GIT_COMMIT_REF !== 'master') return
public/og-images/We <3 contributions big and small. In priority order (although everything is appreciated) with the most helpful first:
336 followers · starred Sep 2025
544 followers · starred Feb 2026
103 followers · starred Nov 2025
502 followers · starred Sep 2025