integration-tanstack-start

Integrate PostHog analytics into TanStack Start apps for client and server event tracking.

1|1|Updated Jan 17, 2026
One-click install
npx skills add https://github.com/LucaDeLeo/ASTN --skill integration-tanstack-start
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: integration-tanstack-start
Source: https://github.com/LucaDeLeo/ASTN/tree/main/.claude/skills/posthog-integration-tanstack-start
Command: npx skills add https://github.com/LucaDeLeo/ASTN --skill integration-tanstack-start

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Integrates PostHog analytics into TanStack Start applications to enable both client-side and server-side event tracking, user identification, and error monitoring.

Core Features & Use Cases

  • Client-side analytics: instrument events with usePostHog and identify users on login to link events across sessions.
  • Server-side analytics: implement a singleton PostHog client in API routes to securely capture server events and tie them to user sessions.
  • Error tracking: capture exceptions from frontend and backend to diagnose issues quickly.
  • Dashboard insights: leverage PostHog dashboards to monitor funnels, retention, and key conversions for TanStack Start apps.

Quick Start

Wrap your app with PostHogProvider at the root and begin emitting client- and server-side events as demonstrated in the repository.

Frequently Asked Questions about integration-tanstack-start

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate PostHog analytics into a TanStack Start app?

You integrate PostHog by wrapping your app with PostHogProvider for client-side tracking and implementing a singleton PostHog client in API routes for secure server-side event capture.

How does server-side event tracking work with PostHog in TanStack Start API routes?

Server-side tracking uses a singleton PostHog client within API routes to securely capture backend events, enforcing environment-variable usage and linking server-side data to user sessions.

Can I track both client-side and server-side events and link them to the same user session?

Yes, user identification links events across sessions by identifying users on login with usePostHog client-side and correlating those frontend events with backend captures using linked user sessions.

What's the best way to capture frontend and backend errors for my TanStack Start application?

The best way to capture exceptions is using PostHog's error tracking to monitor frontend and backend errors, allowing you to diagnose application issues quickly from a unified dashboard.

Do I need environment variables to securely configure PostHog server-side analytics?

Yes, secure server communication requires enforcing environment-variable usage to configure your PostHog client, ensuring sensitive keys are handled correctly within your API routes.