42f5745c97
Documentation pass — reviewed codebase in full, identified stale references, and aligned docs with actual code state. Changes: - CLAUDE.md, PRODUCTION_SETUP.md, LAUNCH_CHECKLIST.md, src/auth.config.ts: middleware path src/middleware.ts → src/proxy.ts (Next.js 16+ convention) - CLAUDE.md, ENVIRONMENT.md, README.md: dev server port localhost:3000 → localhost:4000 (per package.json dev script 'next dev --webpack -H 0.0.0.0 -p 4000') - PRODUCTION_DEPLOYMENT_CHECKLIST.md: rewrote migration list — actual db/migrations/ contains 10 files (0000–0091), not the Supabase-era 001–092 series. Updated platform version 1.6 → 2.0 and last-updated stamp. - MEMORY.md: refreshed 'Last updated' to 2026-06-25 and added a current-state header flagging the 'Auth.js v5 wiring' section as historical (current auth is Neon Auth/Better Auth). Also flags the 'GitHub origin' notes as historical (only Gitea origin exists). - LAUNCH_CHECKLIST.md: added 'Last updated: 2026-06-25' header and refresh note in footer. Verification: - npx tsc --noEmit: pre-existing Stripe API version + test mock errors only (verified by stashing changes and re-running — same error set). - No new errors introduced.
2.5 KiB
2.5 KiB
Route Commerce - Production Setup Guide
Quick Start
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env.local
# Start development server
npm run dev
Configuration
1. Neon Auth (Better Auth)
- Set up Neon Auth on your Neon project (
neonctl neon-auth init) - Copy keys to
.env.local:NEON_AUTH_BASE_URL=https://xxx.neonauth.io NEON_AUTH_COOKIE_SECRET=<openssl rand -base64 32> NEXT_PUBLIC_SITE_URL=https://yourdomain.com - Configure middleware in
src/proxy.ts
2. Stripe Payments
- Create Stripe account
- Create products and prices in Stripe Dashboard
- Update
.env.localwith: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.
- Provision a Postgres database (Neon recommended — it also hosts Neon Auth)
- Run migrations:
npm run migrate - Update
.env.localwith: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
- Connect repository to Vercel
- Add all environment variables
- Deploy
Other Platforms
Ensure environment variables are set before deployment.
Key Files
src/proxy.ts- Neon Auth (Better Auth) middlewaresrc/lib/stripe-billing.ts- Stripe integrationsrc/lib/analytics.ts- PostHog analyticssrc/lib/sentry.ts- Sentry error trackingsrc/components/admin/AnalyticsDashboard.tsx- Admin dashboardsrc/components/onboarding/OnboardingFlow.tsx- User onboardingsrc/components/referral/ReferralSystem.tsx- Referral trackingsrc/components/changelog/ChangelogFeed.tsx- Product updatesdb/migrations/- Database schema (applied viascripts/migrate.js)
Scripts
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
- Launch checklist: LAUNCH_CHECKLIST.md