A production-ready Next.js template featuring authentication, dark mode support, Stripe integration, and a clean, modern UI. Built with TypeScript and Tailwind CSS.
πΉ Full Video Guide: youtube link βοΈ Buy me a coffee: Cafe Latte
- π Authentication with Supabase
- π³ Stripe payment integration
- π Dark mode support
- π± Responsive design
- π¨ Tailwind CSS styling
- π Framer Motion animations
- π‘οΈ TypeScript support
- π Error boundary implementation
- π SEO optimized
- Node.js 18+
- npm or yarn
- A Supabase account
- A Stripe account
- A Google Cloud Platform account
- Clone the template:
git clone https://github.com/ShenSeanChen/launch-stripe-nextjs-supabase my-full-stack-app
cd my-full-stack-app
rm -rf .git
git init
git add .
git commit -m "Initial commit"
# git remote add origin https://github.com/ShenSeanChen/my-full-stack-app.git
git remote add origin https://github.com/USE_YOUR_OWN_GITHUB_NAME/my-full-stack-app.git
git push -u origin main
- Install dependencies:
npm install
or
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
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
# NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_
NEXT_PUBLIC_STRIPE_BUTTON_ID=buy_btn_
# STRIPE_SECRET_KEY=sk_test_
STRIPE_SECRET_KEY=sk_live_
# STRIPE_WEBHOOK_SECRET=whsec_
STRIPE_WEBHOOK_SECRET=whsec_
# 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
- Anon Public Key β NEXT_PUBLIC_SUPABASE_ANON_KEY
- Service Role Secret β 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. Create a live account and configure:
- Create product in Product Catalog
- Create promotional coupon codes
- Set up Payment Link with trial period
b. Get required keys:
- Publishable Key β NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
- Secret Key β 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 dev
or
yarn dev
- Open http://localhost:3000 in your browser.
βββ app/ # Next.js 14 app directory
β βββ api/ # API routes
β β βββ stripe/ # Stripe payment endpoints
β β βββ user/ # User API endpoints
β βββ auth/ # Auth-related pages
β β βββ callback/ # handle auth callback
β βββ 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
βββ hooks/ # Custom React hooks
βββ utils/ # Utility functions
βββ types/ # TypeScript type definitions
βββ public/ # Static assets
βββ styles/ # Global styles
- Next.js - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Supabase - Authentication & Database
- Stripe - Payments
- 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
X - @ShenSeanChen
YouTube - @SeanTechStories
Discord - @Sean's Stories
Instagram - @SeanTechStories
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