This is the reference app for PolicyStack: one TanStack Start (React +
Vite) project that shows the whole picture end to end. The framework-neutral
config lives in src/policystack.ts — the only
framework-specific line is the provider wiring in
src/routes/__root.tsx. It also doubles as the
scanner regression net (the policyStack() plugin scans this source to
generate src/policystack.gen.ts).
- One
defineConfig()is the single source of truth — it generates the privacy + cookie policy documents and derives the consent runtime (categories, locked vs. consent-gated, re-prompt on policy change). - One provider for everything.
__root.tsxmounts the single<PolicyStack>from@policystack/react/provider. Because the config declarescookies, that same provider also mounts the consent store — no separate consent/cookies provider is wired. @policystack/reactcomponents (PrivacyPolicy,CookiePolicy) rendered directly as React components.- Three styling approaches across three routes:
/tailwind— policies styled with Tailwind utility classes/css-vars— policies styled with CSS custom properties/shadcn— a customHeadingusing a shadcnTooltipto surfacenode.context.reasonon hover
- Configuring the
policyStack()plugin invite.config.tsalongside TanStack Start.
vite.config.ts ← policyStack() plugin + TanStack Start + Tailwind
src/policystack.ts ← defineConfig() — framework-neutral, fully commented
src/policystack.gen.ts ← generated by policyStack()'s source scan
src/routes/__root.tsx ← root layout: <PolicyStack> (policy + consent) + nav
src/routes/index.tsx ← "/" — placeholder
src/routes/tailwind.tsx ← "/tailwind" — policies styled with Tailwind classes
src/routes/css-vars.tsx ← "/css-vars" — policies styled with CSS custom properties
src/routes/shadcn.tsx ← "/shadcn" — policies with custom Heading + shadcn Tooltip
src/components/ui/tooltip.tsx ← Radix UI Tooltip wrapper
vp install
vp dev # start dev server on http://localhost:3000
vp build # production build