Loading...
Loading...
> Deploy your Fabrk application to Vercel with automatic SSL, CDN, and edge functions.
Complete Vercel deployment with automatic HTTPS, global CDN, preview deployments for PRs, and environment variable management.
DESC: Your code must be in a Git repository
DESC: Go to vercel.com/new and import your repository
DESC: Create a secure NEXTAUTH_SECRET before configuring Vercel
1$openssl rand -base64 3223$# Expected output:4$# dGhpc2lzYXJhbmRvbWJhc2U2NGVuY29kZWRzdHJpbmc=5$#6$# Copy this output - you'll add it to Vercel in the next step
DESC: Add environment variables in Vercel Dashboard
1$# In Vercel Dashboard:2$# 1. Go to your project → Settings → Environment Variables3$#4$# 2. For EACH variable below, click "Add New"5$#6$# 3. IMPORTANT: Select the correct environment:7$# - Production: Live site with real payments (sk_live_ keys)8$# - Preview: PR previews with test payments (sk_test_ keys)9$# - Development: Local dev (usually use .env.local instead)10$#11$# Recommendation: Start by adding to "Production" only1213$# Core (Required for Production)14$DATABASE_URL="postgresql://..." # Your production database URL15$NEXTAUTH_URL="https://your-domain.vercel.app" # Your Vercel deployment URL16$NEXTAUTH_SECRET="paste-output-from-previous-step" # The secret you just generated
DESC: Click deploy and wait ~2 minutes
Fastest way to deploy
1$# Add this button to your README2$[](https://vercel.com/new/clone?repository-url=https://github.com/yourusername/fabrk)34$# Or use the Vercel CLI5$npm i -g vercel6$vercel78$# Follow the prompts:9$# 1. Link to existing project? No10$# 2. Project name? your-app-name11$# 3. Directory? ./12$# 4. Override settings? No
Add in Vercel Dashboard → Settings → Environment Variables
1$# IMPORTANT: Select "Production" environment when adding these variables2$# (You can add "Preview" environment variables later for testing)34$# Core (Required)5$DATABASE_URL="postgresql://..." # Get from Supabase/Neon/Railway6$NEXTAUTH_URL="https://your-domain.vercel.app" # Your Vercel URL7$NEXTAUTH_SECRET="paste-secret-from-openssl-command" # From earlier step89$# Email (Required if using email features)10$RESEND_API_KEY="re_..." # Get from https://resend.com11$EMAIL_FROM="noreply@your-domain.com" # Must be from verified domain1213$# Stripe (Required if accepting payments - USE LIVE KEYS FOR PRODUCTION)14$STRIPE_SECRET_KEY="sk_live_..." # LIVE key from https://dashboard.stripe.com/apikeys15$STRIPE_WEBHOOK_SECRET="whsec_..." # From Stripe webhook endpoint setup16$NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_live_..." # LIVE publishable key17$NEXT_PUBLIC_STRIPE_PRICE_FABRK="fabrk_purchase" # Lookup key (NOT price_1234)1819$# Optional20$GOOGLE_CLIENT_ID="..." # For Google OAuth login21$GOOGLE_CLIENT_SECRET="..."22$NEXT_PUBLIC_APP_URL="https://your-domain.com" # Your custom domain2324$# WARNING: Production uses LIVE Stripe keys (sk_live_/pk_live_)25$# Preview environment should use TEST keys (sk_test_/pk_test_)
Optional advanced settings
1// vercel.json2{3 "buildCommand": "prisma generate && next build",4 "framework": "nextjs",5 "regions": ["iad1"],6 "headers": [7 {8 "source": "/(.*)",9 "headers": [10 { "key": "X-Content-Type-Options", "value": "nosniff" },11 { "key": "X-Frame-Options", "value": "DENY" },12 { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" }13 ]14 }15 ],16 "crons": [17 { "path": "/api/cron/cleanup", "schedule": "0 0 * * *" }18 ]19}
Connect your custom domain
1$# 1. Go to Project Settings → Domains2$# 2. Add your domain (e.g., myapp.com)3$# 3. Add DNS records at your registrar:45$# For apex domain (myapp.com)6$Type: A7$Name: @8$Value: 76.76.21.21910$# For www subdomain11$Type: CNAME12$Name: www13$Value: cname.vercel-dns.com1415$# 4. Wait for DNS propagation (up to 48 hours)16$# 5. SSL certificate is automatically provisioned
Step-by-step webhook configuration in Stripe Dashboard
1$# Step 1: Open Stripe Dashboard2$# Go to https://dashboard.stripe.com3$# Make sure you're in LIVE mode (toggle in top left should say "Live")45$# Step 2: Navigate to Webhooks6$# Click "Developers" in top navigation7$# Click "Webhooks" in the sidebar8$# Click "+ Add endpoint" button910$# Step 3: Enter your webhook URL11$# Endpoint URL: https://your-domain.vercel.app/api/webhooks/stripe12$# (Replace your-domain.vercel.app with your actual Vercel URL)1314$# Step 4: Select events to listen for15$# Click "Select events"16$# Search for and select these events:17$# ✓ checkout.session.completed18$# ✓ customer.subscription.created19$# ✓ customer.subscription.updated20$# ✓ customer.subscription.deleted21$# ✓ invoice.paid22$# ✓ invoice.payment_failed2324$# Step 5: Click "Add endpoint"2526$# Step 6: Copy the webhook signing secret27$# After creating, click on your new webhook endpoint28$# Find "Signing secret" section29$# Click "Reveal" and copy the value (starts with whsec_)3031$# Step 7: Add to Vercel32$# In Vercel: Settings → Environment Variables33$# Name: STRIPE_WEBHOOK_SECRET34$# Value: whsec_... (paste the signing secret)35$# Environment: Production36$# Click "Save"3738$# Step 8: Redeploy39$# Go to Deployments tab → Click "..." on latest deployment → "Redeploy"40$# This ensures the new STRIPE_WEBHOOK_SECRET is loaded
Every pull request gets a unique preview URL for testing
1$# What are preview deployments?2$# When you create a pull request on GitHub, Vercel automatically:3$# 1. Builds your code4$# 2. Deploys to a temporary URL5$# 3. Adds a comment to the PR with the preview link67$# Preview URL format:8$# https://your-project-git-branch-name-your-team.vercel.app910$# Example:11$# https://fabrk-git-feature-auth-acme.vercel.app1213$# Configure preview environment variables:14$# 1. Go to Vercel Dashboard → Settings → Environment Variables15$# 2. Click "Add New"16$# 3. IMPORTANT: Select "Preview" environment (NOT Production)1718$# Use TEST Stripe keys for previews (never use live keys):19$STRIPE_SECRET_KEY="sk_test_..." # Test mode only20$STRIPE_WEBHOOK_SECRET="whsec_test_..." # From local stripe listen21$NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."2223$# Why separate keys?24$# - Preview deployments are for testing - you don't want real charges25$# - Use test credit cards (4242 4242 4242 4242) in preview26$# - Production uses live keys for real payments
Build Fails with Prisma Error:
Add prisma generate to build command in package.json
Environment Variables Not Working:
1. Check correct environment (Prod/Preview/Dev)
2. Client-side vars need NEXT_PUBLIC_ prefix
3. Redeploy after adding variables
Database Connection Timeout:
Use connection pooling (Supabase Pooler or PgBouncer)