# Route Commerce - Production Setup Guide ## Quick Start ```bash # Install dependencies npm install # Copy environment variables cp .env.example .env.local # Start development server npm run dev ``` ## Configuration ### 1. Neon Auth (Better Auth) 1. Set up Neon Auth on your Neon project (`neonctl neon-auth init`) 2. Copy keys to `.env.local`: ``` NEON_AUTH_BASE_URL=https://xxx.neonauth.io NEON_AUTH_COOKIE_SECRET= NEXT_PUBLIC_SITE_URL=https://yourdomain.com ``` 3. Configure middleware in `src/proxy.ts` ### 2. Stripe Payments 1. Create Stripe account 2. Create products and prices in Stripe Dashboard 3. Update `.env.local` with: ``` STRIPE_SECRET_KEY=sk_test_xxx NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxx STRIPE_WEBHOOK_SECRET=whsec_xxx ``` ### 3. Database (Postgres / Neon) The app talks to Postgres directly via `pg` (no Supabase, no REST gateway). Point `DATABASE_URL` at any reachable Postgres — Neon, Supabase (the underlying Postgres), RDS, etc. The Supabase JS client and PostgREST are not used. 1. Provision a Postgres database (Neon recommended — it also hosts Neon Auth) 2. Run migrations: `npm run migrate` 3. Update `.env.local` with: ``` DATABASE_URL=postgresql://user:pass@host:5432/dbname?sslmode=require ``` ### 4. Optional Services #### Sentry (Error Monitoring) ``` SENTRY_DSN=https://xxx@sentry.io/xxx ``` #### PostHog (Analytics) ``` NEXT_PUBLIC_POSTHOG_API_KEY=phc_xxx ``` ## Deployment ### Vercel 1. Connect repository to Vercel 2. Add all environment variables 3. Deploy ### Other Platforms Ensure environment variables are set before deployment. ## Key Files - `src/proxy.ts` - Neon Auth (Better Auth) middleware - `src/lib/stripe-billing.ts` - Stripe integration - `src/lib/analytics.ts` - PostHog analytics - `src/lib/sentry.ts` - Sentry error tracking - `src/components/admin/AnalyticsDashboard.tsx` - Admin dashboard - `src/components/onboarding/OnboardingFlow.tsx` - User onboarding - `src/components/referral/ReferralSystem.tsx` - Referral tracking - `src/components/changelog/ChangelogFeed.tsx` - Product updates - `db/migrations/` - Database schema (applied via `scripts/migrate.js`) ## Scripts ```bash npm run dev # Start development server npm run build # Production build npm run lint # Run ESLint npm run migrate # Run database migrations ``` ## Documentation - Full documentation: [CLAUDE.md](./CLAUDE.md) - Launch checklist: [LAUNCH_CHECKLIST.md](./LAUNCH_CHECKLIST.md)