Created an app to try to convince Stan to hire me. Did not get the role but gained a lot of clout and connections :D LinkedIn Post
This repository currently ships a single Next.js application in apps/web. The app is an X creator assistant and growth workflow product with onboarding, chat-based AI orchestration, reply assistance, source-material grounding, billing, and a companion extension API.
This README documents the live implementation in the repo today. When the code and older planning docs disagree, treat the code in apps/web as the source of truth.
- Active runtime:
apps/web - Primary stack: Next.js 16, React 19, TypeScript, Tailwind CSS 4
- Persistence: Prisma 7 on PostgreSQL
- Auth: Supabase identity plus a custom app session cookie
- AI runtime: Groq SDK for structured chat, planning, drafting, revision, reply, and analysis flows
- Billing: Stripe checkout, portal, webhooks, and local entitlement tracking
- Companion surfaces: browser extension APIs, onboarding APIs, creator chat APIs
Important repo note:
- The top-level
apps/api,packages/*,workers/*, andinfra/folders are currently empty placeholders, not the shipped runtime. - The old root README described a planned multi-package architecture with Neon and Upstash workers. That is not the current implementation.
The live app combines several product surfaces:
- Landing and onboarding for X account analysis and strategy bootstrapping
- A
/chatworkspace with multi-turn AI assistance for ideation, planning, drafting, revision, replies, and post analysis - Source-material management for grounding outputs in user-provided facts, stories, and playbooks
- Billing and entitlement controls for free, Pro, and lifetime plans
- Companion extension APIs for reply opportunity ranking and reply draft workflows
The practical layout for engineers is:
.
├── README.md
├── PLAN.md
├── Artifact.md
├── LIVE_AGENT.md
├── apps/
│ └── web/
│ ├── app/ # App Router pages and API routes
│ ├── components/ # Shared UI and providers
│ ├── lib/ # Domain logic: agent runtime, onboarding, billing, auth, extension
│ ├── prisma/ # Schema and migrations
│ ├── public/
│ ├── scripts/
│ ├── package.json
│ └── .env.example
└── docs/
├── app-architecture.md
└── app-diagrams.md
The root package is not the app entrypoint. Develop from apps/web.
-
Install dependencies for the app package:
cd apps/web pnpm install -
Copy the environment template:
cp .env.example .env
-
Fill the minimum required values:
DATABASE_URLDATABASE_MIGRATION_URLSUPABASE_URLSUPABASE_ANON_KEYSESSION_SECRETGROQ_API_KEY
-
Start the app:
pnpm dev
-
Open http://localhost:3000.
The canonical env template lives at apps/web/.env.example.
The variables are grouped into these areas:
- Core app: database, Supabase, session secret
- AI provider: Groq API key and optional model override
- Public URLs and support email
- Monetization flags and pricing display values
- Stripe checkout and webhook configuration
- Onboarding source mode selection
- X scrape and X API credentials
- Onboarding backfill tuning
- Developer flags and script-only helpers
Operational notes:
NEXTAUTH_*variables are marked deprecated in the env template.ONBOARDING_MODEcontrols whether onboarding uses scrape, X API, mock, or auto fallback.- In production, mock onboarding fallback is intentionally guarded by
ONBOARDING_ALLOW_MOCK_FALLBACK.
Run these from apps/web:
pnpm dev
pnpm build
pnpm lint
pnpm test:ui
pnpm test:e2e
pnpm test:v2
pnpm test:extensionAdditional useful scripts:
pnpm replay:creator-transcript
pnpm capture:user-tweets
pnpm scrape:user-tweets:httpAt a high level, the app works like this:
- The browser UI submits structured chat or onboarding requests to Next.js route handlers in
apps/web/app/api. - Route-boundary helpers normalize input, resolve workspace and auth state, and assemble domain context.
- Domain logic in
apps/web/libhandles AI orchestration, onboarding analysis, billing, extension workflows, and persistence policies. - Prisma writes chat threads, messages, memories, onboarding runs, source materials, billing state, extension tokens, and product events to PostgreSQL.
- External services provide identity, billing, model inference, and X data access.
For the detailed audit and diagrams, see:
apps/web/app/page.tsx: landing entrypointapps/web/app/onboarding/*: onboarding flowapps/web/app/chat/page.tsx: primary chat workspaceapps/web/app/chat/_features/*: extracted chat feature state and UIapps/web/app/pricing/*,apps/web/app/login/*,apps/web/app/extension/connect/*: supporting product surfaces
apps/web/app/api/auth/*: auth login, session, logout, email code flowsapps/web/app/api/onboarding/*: preview, run, validate, scrape, backfillapps/web/app/api/creator/v2/*: chat, threads, preferences, source materials, feedback, draft analysis/candidatesapps/web/app/api/billing/*andapps/web/app/api/stripe/webhook/route.ts: checkout, portal, billing state, Stripe eventsapps/web/app/api/extension/*: extension token, opportunity batch, reply options, reply drafts, reply logs
apps/web/lib/agent-v2/*: AI runtime, capabilities, validators, workers, memory, responses, groundingapps/web/lib/onboarding/*: data-source resolution, analysis, strategy, profile hydration, persistence, backfillapps/web/lib/billing/*: entitlements, policy, Stripe helpers, credit ledger logicapps/web/lib/auth/*: Supabase auth integration and custom session handlingapps/web/lib/extension/*: token auth, reply opportunity logic, extension contracts
- The shipped app is a single Next.js deployment boundary, not a live multi-service monorepo.
- The chat runtime is mid-migration toward cleaner runtime boundaries, and the supporting migration notes live in the docs below.
- A legacy NextAuth dependency and route exist in the repo, but the primary login/session flow is Supabase-backed with a custom cookie session.
- The current LLM gateway is the Groq SDK. The code also supports
openai/*model identifiers through the same client path.
These files are still useful, but they describe migration intent and target-state architecture more than the exact shipped runtime:
Use them as architecture direction, not as a replacement for the live code audit in docs/.
