AI-powered SOP knowledge base. Ask questions about your company procedures and get step-by-step answers from your documentation.
- Next.js 15 (App Router)
- Supabase (Postgres + pgvector)
- OpenAI (embeddings + chat via Vercel AI SDK)
- shadcn/ui + Tailwind CSS
Create a Supabase project, then run the migration:
# Via Supabase dashboard: SQL Editor → paste contents of supabase/migrations/001_initial_schema.sql
# Or via CLI:
supabase db pushNote the id of the inserted "Demo Company" client — you'll need it for DEFAULT_CLIENT_ID.
cp .env.example .env.localFill in:
NEXT_PUBLIC_SUPABASE_URL— from Supabase project settingsNEXT_PUBLIC_SUPABASE_ANON_KEY— from Supabase project settingsSUPABASE_SERVICE_ROLE_KEY— from Supabase project settings (service role, not anon)OPENAI_API_KEY— from OpenAI dashboardDEFAULT_CLIENT_ID— UUID of the demo client row
npm install
npm run devWith the dev server running:
npx tsx seed/seed.tsThis creates 3 sample SOPs (Client Onboarding, Invoice Processing, New Employee Setup) with embedded chunks.
- / — Chat interface. Ask questions like "How do I onboard a new client?"
- /admin — Manage SOPs and view analytics
- SOPs are split into ~400-token chunks at
##heading boundaries - Each chunk is embedded via OpenAI
text-embedding-ada-002 - Chat queries are embedded and matched via pgvector cosine similarity
- Matched chunks are injected as context for GPT-4o-mini to answer
- Query logs track usage, confidence, and feedback for analytics