# Poolday.ai — Marketing Website

This is the Next.js marketing site for [poolday.ai](https://poolday.ai).

Poolday is an autonomous video editing agent powered by Creator-1, a multi-agent system of 25+ coordinated AI agents. This repo contains the public-facing website, not the product itself.

## Tech stack

- **Framework**: Next.js 14 (App Router)
- **Language**: TypeScript
- **Styling**: Tailwind CSS + custom CSS variables (variant H theme)
- **Fonts**: JetBrains Mono / IBM Plex Mono (main site), Inter (legacy pages)
- **Analytics**: PostHog (consent-gated), Google Tag Manager
- **Database**: Supabase (blog posts)
- **Storage**: Vercel Blob (example videos, uploads)
- **Deployment**: Vercel

## Project layout

```
app/
  (marketing)/          Public marketing pages
    page.tsx            Home (renders LandingH)
    blog/               Blog listing + article pages
    blog/[slug]/        Individual blog post (server-rendered from Supabase)
    blog/docs/          Hidden API documentation for blog CMS partners
    pricing/            Pricing page (variant H)
    use-cases/          Use cases page
    examples/           Examples gallery with shareable deep links
    changelog/          Changelog
    agent-guide/        Agent usage guide
    agent-onboarding/   Onboarding form
    researchprogram/    Research program
  api/
    blog/               Blog CMS REST API (CRUD, publish/unpublish)
    og/blog/            Dynamic OG image generation (edge, @vercel/og)
    onboard/            Onboarding submission + file upload
    upload/             General file upload (Vercel Blob)
  sitemap.xml/          Sitemap index (points to page + blog sub-sitemaps)
  page-sitemap.xml/     Static page sitemap
  blog-sitemap.xml/     Dynamic blog sitemap (from Supabase)
  robots.txt/           Robots rules (allows AI bots)
  not-found.tsx         Custom 404 page (variant H styling, inline styles)
  layout.tsx            Root layout (PostHog, cookie consent, GTM)

components/
  variants/h/           Main site components (landing, nav, footer, all pages)
  posthog/              Analytics (page views, auto-track, provider)
  cookie-consent/       GDPR consent (banner, context, conditional scripts)
  button/
    UnifiedCTA.tsx      Shared CTA with auto-UTM and PostHog tracking
    CTAButton.tsx       Legacy wrapper → delegates to UnifiedCTA
  onboarding/           Onboarding form components
  navbar/               Legacy navbar (not used on main site)

lib/
  blog.ts               Blog data layer (Supabase CRUD)
  blog-schema.ts        JSON-LD structured data (BlogPosting, BreadcrumbList, FAQPage)
  blog-auth.ts          API key auth for blog CMS
  supabase.ts           Supabase client (lazy-init, admin + public)
  utm.ts                UTM parameter storage and URL building
  utils.ts              Shared utilities

constants/
  site.ts               SITE_URL (centralized base URL)
  config.ts             APP_URL, CALENDLY_URL, DISCORD_INVITE_LINK
  features.ts           Feature page data

public/
  AGENTS.md             This file (for coding agents)
  llms.txt              Product description for LLM crawlers (llmstxt.org spec)
  logo.png              Logo (PNG, used in JSON-LD publisher schema)
  og.png                Default Open Graph image
  examples/             Example video/image assets (most served from Vercel Blob)

middleware.ts           Redirects old /a-/h variant paths; blocks /features, /guide
```

## Key patterns

- **Variant H is the only design system.** All pages use components from `components/variants/h/` with CSS variables defined in `components/variants/h/styles.css`. The old A-G variants were removed.
- **Blog is Supabase-backed.** Posts are stored in the `blog_posts` table. The blog CMS API at `/api/blog` requires a `BLOG_API_KEY` header. Posts can also be inserted directly into Supabase.
- **UnifiedCTA** is the canonical CTA component. It auto-attaches UTM params based on page context and fires a consistent `cta_clicked` PostHog event. `CTAButton` is a thin wrapper for backward compatibility.
- **Dynamic OG images** are generated at `/api/og/blog` for blog posts without a manual cover image.
- **Middleware** blocks `/features` and `/guide` (returning 404) and 301-redirects old `/a`-`/h` variant paths to `/`.

## Environment variables

Required for the site to function:

| Variable | Purpose |
|----------|---------|
| `NEXT_PUBLIC_APP_URL` | Production base URL (https://poolday.ai) |
| `NEXT_PUBLIC_SUPABASE_URL` | Supabase project URL |
| `NEXT_PUBLIC_SUPABASE_ANON_KEY` | Supabase public key |
| `SUPABASE_SERVICE_ROLE_KEY` | Supabase service role key |
| `BLOB_READ_WRITE_TOKEN` | Vercel Blob storage token |
| `BLOG_API_KEY` | API key for blog CMS write operations |
| `NEXT_PUBLIC_POSTHOG_KEY` | PostHog project key |
| `NEXT_PUBLIC_POSTHOG_HOST` | PostHog host URL |
