A production-ready Next.js template featuring authentication, dark mode support, Stripe integration, automated email workflows with Resend, and a clean, modern UI. Built with TypeScript and Tailwind CSS.
πΉ Full YouTube Guide: Youtube link
π X Post: X link
π‘ Try the App: App link
βοΈ Buy me a coffee: Cafe Latte
π€οΈ Discord: Invite link
- π Authentication with Supabase
- π³ Stripe payment integration
- π§ Automated Email Workflows with Resend (welcome, billing, cancellation emails)
- π Dark mode support
- π± Responsive design
- π¨ Tailwind CSS styling
- π Framer Motion animations
- π‘οΈ TypeScript support
- π Error boundary implementation
- π SEO optimized
- π€ MCP integration for AI-powered development
- Node.js 18+
- npm or yarn
- A Supabase account
- A Stripe account
- A Resend account (for emails)
- A Google Cloud Platform account
- Clone the template:
Option A: Use GitHub's Template Feature (Easiest)
- Click the green "Use this template" button on GitHub
- This creates a fresh repo with clean history
Option B: Clone and Start Fresh (Recommended for production)
git clone https://github.com/ShenSeanChen/launch-mvp-stripe-nextjs-supabase my-full-stack-app
cd my-full-stack-app
rm -rf .git # Remove template's git history
git init # Start fresh with your own history
git add .
git commit -m "Initial commit from LaunchMVP template"
git remote add origin https://github.com/YOUR_USERNAME/my-full-stack-app.git
git push -u origin mainOption C: Fork (For contributors or to receive updates)
- Click "Fork" on GitHub to maintain connection to this template
- Install dependencies:
npm installor
yarn install- Create .env.local with all variables from .env.example
NEXT_PUBLIC_APP_URL=http://localhost:8000
NEXT_PUBLIC_API_URL=http://localhost:8080
NEXT_PUBLIC_WS_URL=ws://localhost:8080
# Supabase Configuration
# Note: In Supabase Dashboard, these are now called "Publishable key" and "Secret key"
# but the variable names below still work correctly
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_ANON_KEY=
SUPABASE_SERVICE_ROLE_KEY=
# OpenAI Configuration (you'll need to add your key)
OPENAI_API_KEY=
# Stripe Configuration
# β οΈ Use TEST keys (pk_test_, sk_test_) during development!
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_
NEXT_PUBLIC_STRIPE_BUTTON_ID=buy_btn_
STRIPE_SECRET_KEY=sk_test_
STRIPE_WEBHOOK_SECRET=whsec_
# Email Configuration (Resend)
RESEND_API_KEY=re_xxxxxxxxxxxx
INTERNAL_API_KEY=your_internal_api_key
# ANALYTICS
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
-
Set up Google Cloud Platform (GCP):
- Create new OAuth 2.0 credentials in GCP Console
- Configure authorized JavaScript origins
- Configure redirect URIs
- Save the Client ID and Client Secret
-
Configure Supabase:
a. Get API Keys (Project Settings > API):
- Project URL β NEXT_PUBLIC_SUPABASE_URL
- Publishable Key (or Anon Key in legacy tab) β NEXT_PUBLIC_SUPABASE_ANON_KEY
- Secret Key (or Service Role in legacy tab) β SUPABASE_SERVICE_ROLE_KEY
b. Set up Authentication:
- Go to Authentication > Providers > Google
- Add your GCP Client ID and Client Secret
- Update Site URL and Redirect URLs
c. Database Setup:
- Enable Row Level Security (RLS) for all tables
- Create policies for authenticated users and service roles
- Create the following trigger function:
CREATE OR REPLACE FUNCTION public.handle_new_user() RETURNS trigger AS $$ BEGIN INSERT INTO public.users (id, email, created_at, updated_at, is_deleted) VALUES (NEW.id, NEW.email, NOW(), NOW(), FALSE); INSERT INTO public.user_preferences (user_id, has_completed_onboarding) VALUES (NEW.id, FALSE); INSERT INTO public.user_trials (user_id, trial_start_time, trial_end_time) VALUES (NEW.id, NOW(), NOW() + INTERVAL '48 hours'); RETURN NEW; END; $$ LANGUAGE plpgsql SECURITY DEFINER; CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION public.handle_new_user();
-
Set up Stripe:
a. Use TEST mode during development:
- Go to Stripe Dashboard and ensure "Test mode" is enabled (toggle in top-right)
- Use test card number:
4242 4242 4242 4242 - Create product in Product Catalog
- Create promotional coupon codes
- Set up Payment Link with trial period
b. Get required keys (from TEST mode):
- Publishable Key (pk_test_xxx) β NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
- Secret Key (sk_test_xxx) β STRIPE_SECRET_KEY
- Buy Button ID β NEXT_PUBLIC_STRIPE_BUTTON_ID
c. Configure webhooks:
- Add endpoint: your_url/api/stripe/webhook
- Subscribe to events: customer.subscription., checkout.session., invoice., payment_intent.
- Copy Signing Secret β STRIPE_WEBHOOK_SECRET
-
Start the development server:
npm run devor
yarn dev- Open http://localhost:3000 in your browser.
This template includes automated transactional emails using Supabase Database Triggers, Supabase Edge Functions, and Resend. When a user signs up, subscribes, or cancels, they automatically receive beautiful emails.
πΉ Video Tutorial: Follow along with the YouTube video for a step-by-step walkthrough of this section.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β WHERE THINGS RUN β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β VERCEL (Next.js App) SUPABASE (Database + Functions) β
β βββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
β β’ Your website UI β’ Database (PostgreSQL) β
β β’ API routes (/api/*) β’ Database Triggers (pg_net) β
β β’ Email service β’ Edge Functions (Deno runtime) β
β β
β Uses: .env.local or Uses: supabase secrets β
β Vercel Environment Variables (separate from Vercel!) β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Why supabase secrets? Edge Functions run on Supabase's infrastructure (not Vercel), so they need their own environment variables set via supabase secrets set. This is different from the .env.local / Vercel env vars used by your Next.js app.
- Create account at resend.com
- Verify your domain at resend.com/domains
- Add DNS records to your domain
- For this tutorial:
seanchen.iois verified, using[email protected]
- Get API key from resend.com/api-keys
- Add to your
.env.local:RESEND_API_KEY=re_xxxxxxxxxxxx INTERNAL_API_KEY=generate_a_random_secret_here - Also add these to Vercel β Project Settings β Environment Variables
β Verification: Go to Resend dashboard β API Keys. You should see your key listed.
Database triggers need the pg_net extension to make HTTP calls to Edge Functions.
- Go to Supabase Dashboard β SQL Editor
- Run this SQL:
CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions;
β Verification: Go to Database β Extensions β Search "pg_net" β Should show "Enabled"
This table prevents duplicate emails and tracks email history.
- Go to Supabase Dashboard β SQL Editor
- Run the contents of
supabase/scripts/setup/02-create-user-email-log-table.sql
β
Verification: Go to Table Editor β You should see user_email_log table
Edge Functions process the trigger and call your email API.
# Install Supabase CLI
npm install -g supabase
# Login (opens browser for authentication)
supabase login
# Link to your project
# Find your project ref at: Supabase Dashboard β Project Settings β General β Reference ID
supabase link --project-ref YOUR_PROJECT_REF
# Set secrets for Edge Functions (these are DIFFERENT from Vercel env vars!)
supabase secrets set APP_URL=https://my-full-stack-app-iota.vercel.app
supabase secrets set RESEND_API_KEY=re_your_actual_key
supabase secrets set INTERNAL_API_KEY=your_internal_key
# Deploy the functions
supabase functions deploy send-welcome-email
supabase functions deploy send-billing-email
supabase functions deploy send-cancellation-emailβ Verification:
- Go to Supabase Dashboard β Edge Functions
- You should see all 3 functions listed with "Active" status
- Click on a function β Check "Logs" tab for any errors
Triggers watch for database changes and call the Edge Functions.
- Go to Supabase Dashboard β SQL Editor
- IMPORTANT: Open
supabase/scripts/setup/03-create-public-users-trigger.sqland replace:YOUR_SUPABASE_PROJECT_REFβ Your project referenceYOUR_SUPABASE_ANON_KEYβ Your anon key (find at Project Settings β API)
- Run the modified SQL
- Repeat for
supabase/scripts/setup/04-create-billing-cancellation-triggers.sql
β Verification:
- The SQL output should show "β Trigger Created Successfully!"
- Go to Database β Triggers β You should see the triggers listed
- Go to your app (e.g.,
http://localhost:3000) - Sign up with a new account
- Check your email inbox for the Welcome email!
β Verification if something goes wrong:
- Supabase β Edge Functions β Click function β Logs (see if trigger called it)
- Vercel β Deployments β Functions β Check
/api/email/sendlogs - Resend β Emails (see if email was sent)
Visit http://localhost:3000/preview-email to preview your email templates locally before deploying.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EMAIL AUTOMATION FLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β User Signs Up β Supabase Auth β public.users INSERT β
β β β
β Database Trigger β
β β β
β Edge Function β
β β β
β /api/email/send β
β β β
β Resend API β
β β β
β π§ Email Delivered β
β β
β Similarly for Billing & Cancellation emails via subscriptions table β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Email Type | Trigger | Description |
|---|---|---|
| Welcome | User signs up | Sent when public.users receives an INSERT |
| Billing Confirmation | Subscription created | Sent when subscriptions receives an INSERT |
| Cancellation | Subscription cancelled | Sent when subscriptions is updated with cancelled status |
MCP (Model Control Protocol) enables enhanced AI assistant capabilities for this project, allowing the AI to interact directly with your Stripe and Supabase accounts to help with debugging, configuring, and managing your application.
For a comprehensive demonstration of MCP capabilities, check out our dedicated demo repository:
- π launch-mcp-demo - Collection of powerful MCP tools
- πΉ Full YouTube Guide
- π X Post
-
Create an
mcp.jsonfile:Copy the example file to create your own configuration:
cp .cursor/mcp.json.example .cursor/mcp.json
-
Configure your credentials:
a. Stripe Integration:
- Get your Stripe API key from the Stripe Dashboard
- Replace
your_stripe_test_key_herewith your actual test key
b. Supabase Integration:
- Generate a Supabase access token from your Supabase dashboard (Project Settings > API)
- Replace
your_supabase_access_token_herewith your actual token
c. GitHub Integration (optional):
- Create a GitHub Personal Access Token with appropriate permissions
- Replace
your_github_personal_access_token_herewith your actual token
-
Example of a completed
mcp.jsonfile:{ "mcpServers": { "stripe": { "command": "npx", "args": [ "-y", "@stripe/mcp" ], "env": { "STRIPE_SECRET_KEY": "sk_test_51ABC123..." } }, "supabase": { "command": "npx", "args": [ "-y", "@supabase/mcp-server-supabase@latest", "--access-token", "sbp_1234abcd5678efgh..." ] } } } -
Using MCP with AI assistants:
After configuring
mcp.json, the AI assistant within the Cursor editor will be able to:- Query and manage your Stripe subscriptions
- Interact with your Supabase database
- Help troubleshoot integration issues
- Provide contextual help based on your actual configuration
-
Security Considerations:
- Never commit your
mcp.jsonfile to version control - Use test credentials during development
- Limit access tokens to only the permissions needed
- Never commit your
The MCP framework can be extended with various tools beyond Stripe and Supabase. Our launch-mcp-demo repository demonstrates how to integrate basic MCP examples.
To integrate these additional tools with your project:
-
Clone the demo repository:
git clone https://github.com/ShenSeanChen/launch-mcp-demo.git
-
Follow the installation instructions in the repository's README
-
Update your
.cursor/mcp.jsonto include the additional tools:{ "mcpServers": { "stripe": { // Your existing Stripe configuration }, "supabase": { // Your existing Supabase configuration }, "weather": { "command": "/path/to/your/python/environment", "args": [ "--directory", "/path/to/launch-mcp-demo/weather", "run", "weather.py" ] }, "files": { "command": "/path/to/your/python/environment", "args": [ "--directory", "/path/to/launch-mcp-demo/files", "run", "files.py" ] } } } -
Restart your Cursor editor to apply the changes
These additional tools can help enhance your development workflow and provide more capabilities to the AI assistant when working with your project.
βββ app/ # Next.js 14 app directory
β βββ api/ # API routes
β β βββ email/send/ # Email sending API
β β βββ stripe/ # Stripe payment endpoints
β β βββ user/ # User API endpoints
β βββ auth/ # Auth-related pages
β β βββ callback/ # handle auth callback
β βββ preview-email/ # Email template preview
β βββ dashboard/ # Dashboard pages
β βββ pay/ # Payment pages
β βββ profile/ # User profile pages
β βββ reset-password/ # Reset password pages
β βββ update-password/ # Update password pages
β βββ verify-email/ # Verify email pages
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
βββ components/ # Reusable components
βββ contexts/ # React contexts
βββ emails/ # Email templates (React Email)
β βββ templates/
βββ hooks/ # Custom React hooks
βββ services/ # Service layer (emailService, etc.)
βββ supabase/ # Supabase configuration
β βββ functions/ # Edge Functions
β βββ scripts/setup/ # SQL migration scripts
βββ utils/ # Utility functions
βββ types/ # TypeScript type definitions
βββ public/ # Static assets
βββ styles/ # Global styles
βββ .cursor/ # Cursor editor and MCP configurations
βββ mcp.json.example # Example MCP configuration
βββ mcp.json # Your custom MCP configuration (gitignored)
- Next.js - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Supabase - Authentication & Database
- Stripe - Payments
- Resend - Transactional Emails
- React Email - Email Templates
- Framer Motion - Animations
The template includes a custom Tailwind configuration with:
- Custom colors
- Dark mode support
- Extended theme options
- Custom animations
Authentication is handled through Supabase with support for:
- Email/Password
- Google OAuth
- Magic Links
- Password Reset
Stripe integration includes:
- Subscription management
- Trial periods
- Webhook handling
- Payment status tracking
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js team for the amazing framework
- Vercel for the deployment platform
- Tailwind CSS team for the utility-first CSS framework
- Supabase team for the backend platform
- Stripe team for the payment infrastructure
- Resend team for the email infrastructure
- Cursor team for the AI-powered editor and MCP capabilities
- Anthropic for Claude AI and Claude Desktop integration
- MCP framework developers for enabling extended AI capabilities
X - @ShenSeanChen
YouTube - @SeanAIStories
Discord - @Sean's AI Stories
Instagram - @SeanAIStories
Project Link: https://github.com/ShenSeanChen/launch-stripe-nextjs-supabase
The easiest way to deploy your Next.js app is to use the Vercel Platform.
Made with π₯ by ShenSeanChen