PostHog Files and Variables
NEXT_PUBLIC_APP_ENV=development
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_DEBUG=false
NEXT_PUBLIC_POSTHOG_KEY_DEV=
NEXT_PUBLIC_POSTHOG_KEY_STAGING=
NEXT_PUBLIC_POSTHOG_KEY_PROD=
NEXT_PUBLIC_POSTHOG_HOST_DEV=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_HOST_STAGING=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_HOST_PROD=https://us.i.posthog.com
- lib/posthog.js
- lib/posthog.constants.js
- ../jampack-saas-starterkit/POSTHOG_DASHBOARD_SETUP.md
- ../jampack-saas-starterkit/scripts/posthog-seed-dashboard.mjs
How PostHog Is Structured
- The helper picks keys and hosts by NEXT_PUBLIC_APP_ENV first, then falls back to the single-project values.
- trackEvent() automatically appends app_env to captured events.
- identifyPostHogUser() and setPostHogGroup() are available for user and workspace association.
- Feature flag hooks are wrapped by useAppFeatureFlagEnabled() and useAppFeatureFlagVariantKey().
Events and Flags Already Defined
The constants live in lib/posthog.constants.js and are already referenced by pricing success and checkout pages.
- workspace_created
- workspace_switched
- switched_to_personal
- checkout_started
- checkout_redirected
- checkout_success
- new_ui
- checkout_experiment
- session_replay_enabled
Sentry Files and Variables
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_DSN=
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE=0.1
SENTRY_TRACES_SAMPLE_RATE=0.1
SENTRY_ORG=
SENTRY_PROJECT=
SENTRY_AUTH_TOKEN=
- ../jampack-saas-starterkit/instrumentation.js
- ../jampack-saas-starterkit/instrumentation-client.js
- ../jampack-saas-starterkit/sentry.server.config.ts
- ../jampack-saas-starterkit/sentry.edge.config.ts
- ../jampack-saas-starterkit/next.config.mjs
How Sentry Is Enabled
The current config also sets a Sentry tunnel route at /monitoring and enables automatic Vercel monitor integration.
- Client config initializes browser tracing in instrumentation-client.js.
- Server and edge configs both initialize only when production mode and DSN are present.
- instrumentation.js loads server or edge config depending on NEXT_RUNTIME.
- next.config.mjs wraps Next.js with both next-intl and withSentryConfig(...).
Verification Checklist
- Create and switch a workspace.
- Start a checkout flow.
- Confirm PostHog events appear with app_env attached.
- Visit the Sentry example route or force an error path.
- Confirm client or server errors arrive in Sentry only for production-like configuration.