0ac4beaaa8
- Add requireAuth() to admin-permissions.ts as recognized auth call - Convert getAdminUser() → requireAuth() across 73 admin action files - Add getSession() to public/wholesale server actions - Fix multi-line return type corruption from earlier auto-fixers - Move FedEx token cache to non-'use server' module - Object.freeze module-level constants: PRICE_KEYS, EMPTY_MOBILE_DASHBOARD, EMPTY_PAY_PERIOD, LOCALE_CART_SUBJECT, WELCOME_EMAILS - Update Stripe API version 2026-05-27 → 2026-06-24 - Fix wholesale employee portal: getEmployeeSessionAction + EmployeePortalClient - Fix 51 TypeScript errors (return type corruption, missing imports)
2.2 KiB
2.2 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. Clerk Authentication
- Sign up at Clerk
- Create a new application
- Copy keys to
.env.local:NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx CLERK_SECRET_KEY=sk_test_xxx - 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. Supabase Database
- Create project at Supabase
- Run migrations:
npm run migrate - Update
.env.localwith:NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=xxx SUPABASE_SERVICE_ROLE_KEY=xxx
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- Clerk 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 updatessupabase/migrations/- Database schema
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