Complete Setup Guide
This guide walks through the full setup including payments and email.Time estimate: 10-15 minutes for basic setup, 30 minutes with Stripe and Resend fully configured.
Prerequisites
Node.js 18+
Check with
node -v. Download Node.jspnpm or npm
Package manager for dependencies
Supabase Account
Free tier works. Create account
Stripe Account
Test mode for development. Sign up
Installation
1
Clone the repository
2
Install dependencies
Run
npm run lint to verify everything installed correctly.3
Create environment file
Configure Supabase
1
Create a Supabase project
- Go to supabase.com/dashboard
- Click New Project
- Choose organization, name, password, and region
- Wait for project to initialize (~2 minutes)
2
Get your API keys
Go to Settings → API and copy:
| Key | Environment Variable |
|---|---|
| Project URL | NEXT_PUBLIC_SUPABASE_URL |
anon public key | NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY |
service_role key | SUPABASE_SECRET_KEY |
3
Configure Auth URLs
Go to Authentication → URL Configuration:
| Setting | Value |
|---|---|
| Site URL | http://localhost:3000 |
| Redirect URLs | http://localhost:3000/auth/callback |
4
Run database migrations
Option A: Using Supabase CLIOption B: Manual SQL
- Go to SQL Editor in Supabase Dashboard
- Copy contents of
supabase/migrations/*.sql - Run the SQL
Verify tables exist:
user_subscriptions, one_time_purchases, payment_history, user_profilesConfigure Stripe (Optional)
Skip this section if you want to run the app without payments first.
1
Get API keys
Go to Stripe Dashboard and copy:
| Key | Environment Variable |
|---|---|
| Publishable key | NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY |
| Secret key | STRIPE_SECRET_KEY |
2
Create products and prices
- Go to Products in Stripe Dashboard
- Create products for Standard and Ultimate plans
- Set prices (one-time for lifetime access)
- Copy Price IDs (start with
price_)
.env.local:3
Set up local webhook forwarding
Install Stripe CLI and forward webhooks:Copy the webhook signing secret and add to
.env.local:Configure Resend (Optional)
1
Get API key
- Sign up at resend.com
- Go to API Keys and create one
- Add to
.env.local:
2
Verify domain (production)
Add DNS records as shown in Resend Dashboard for SPF, DKIM, and DMARC.
Your .env.local File
Here’s a complete example with all variables:Run the App
1
Start development server
2
Open in browser
Navigate to http://localhost:3000
You should see the marketing homepage with hero, pricing, and footer.
3
Test authentication
- Go to
/sign-up - Create an account with email/password
- Check email for verification (or check Supabase Auth logs)
- Sign in and land on
/dashboard
Verify Everything Works
| Feature | How to Test |
|---|---|
| Marketing pages | Visit /, /pricing |
| Authentication | Sign up, sign in, sign out at /sign-up, /sign-in |
| Dashboard | Access /dashboard after signing in |
| Payments | Click pricing button, complete Stripe checkout (test mode) |
| Blog | Visit /blog to see MDX content |
Common Issues
Auth redirect fails
Auth redirect fails
Check Supabase URL Configuration:
- Site URL:
http://localhost:3000(exact match) - Redirect URLs: includes
http://localhost:3000/auth/callback - Not using
127.0.0.1(uselocalhostinstead)
Stripe webhook errors
Stripe webhook errors
Ensure webhook listener is running:
bash stripe listen --forward-to localhost:3000/api/webhooks/stripe - Copy the whsec_... secret each time
you restart - Listener must be running when testing checkoutDatabase tables missing
Database tables missing
Run migrations:
bash npx supabase db push Or manually run SQL from
supabase/migrations/ in Supabase SQL Editor.Environment variables not loading
Environment variables not loading
- Restart dev server after changing
.env.local NEXT_PUBLIC_prefix required for client-side variables- No spaces around
=in env file