CRM that builds itself from your email and calendar. No manual entry.
- Next.js 15 (App Router) — frontend + API routes
- Supabase — Postgres database + Google OAuth
- Anthropic Claude — deal intelligence + daily digest
- Resend — digest email delivery
- Vercel — hosting (zero config deploy)
git clone https://github.com/yourname/relai
cd relai
npm installSupabase
- Create project at supabase.com
- Go to SQL Editor → paste and run
supabase/schema.sql - Go to Authentication → Providers → enable Google
- Copy URL and anon key from Settings → API
Anthropic
- Get API key at console.anthropic.com
Google OAuth
- Go to console.cloud.google.com
- Create project → Enable Gmail API + Google Calendar API
- OAuth consent screen → add scopes:
gmail.readonlycalendar.readonly
- Create OAuth 2.0 credentials → Web application
- In Supabase Auth, add redirect URLs:
https://your-domain.com/auth/callbackhttp://localhost:3000/auth/callback
Resend (optional — for email digest)
- Get API key at resend.com
- Verify your sending domain
cp .env.example .env.localFill in all values in .env.local
npm run devnpm i -g vercel
vercelAdd all .env.local values as environment variables in the Vercel dashboard.
Update NEXT_PUBLIC_APP_URL to your Vercel URL.
Update Google OAuth redirect URI to your Vercel URL.
src/
app/
api/
analyse/route.ts ← deal intelligence (Claude)
digest/route.ts ← daily briefing (Claude + Resend)
contacts/route.ts ← contacts CRUD
pipeline/ ← kanban board
contacts/ ← contact list
analyse/ ← thread analysis form
digest/ ← daily digest
login/ ← Google OAuth login
auth/callback/ ← OAuth callback
components/
layout/Sidebar.tsx ← persistent navigation
lib/
claude.ts ← all AI calls (analyseThread, generateDigest)
supabase/
client.ts ← browser Supabase client
server.ts ← server Supabase client
types/
index.ts ← shared TypeScript types
supabase/
schema.sql ← run once in Supabase SQL editor
supabase/schema.sqlis the canonical fresh-install schema and includes refresh-token storage,deaddeals, anddeal_contacts- Vercel cron jobs hit
/api/cron/syncevery 15 minutes and/api/cron/digestevery 30 minutes - Required server secrets include
SUPABASE_SERVICE_ROLE_KEY,CRON_SECRET, andTOKEN_ENCRYPTION_KEY