This is a Next.js project bootstrapped with create-next-app
that demonstrates the integration of SaaS Subscription Helper for Stripe and Supabase subscription management.
First, set up your environment variables:
# .env.local
STRIPE_SECRET_KEY=sk_test_your_secret_key
SUPABASE_URL=https://your_supabase_instance.supabase.co
SUPABASE_KEY=your_supabase_service_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
STRIPE_CUSTOMER_PORTAL_URL=https://billing.stripe.com/p/login/test_00abc
You can also rename env.sample
to .env
and fill in the values.
Then, install the dependencies:
npm install
npm install saas-subscription-helper stripe @supabase/supabase-js
Finally, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
/app
/api
/webhooks
route.js # Stripe webhook handler
/subscription
/upgrade
route.js # Subscription upgrade endpoint
/cancel
route.js # Subscription cancel endpoint
/components
SubscriptionManager.jsx # Subscription management UI
page.js # Main demo page
- Stripe webhook handling for subscription events
- Supabase database synchronization
- Subscription management (upgrades/downgrades)
- User authentication flow
- Error handling and logging
To learn more about the technologies used in this project:
- SaaS Subscription Helper Documentation
- Next.js Documentation
- Stripe Documentation
- Supabase Documentation
The easiest way to deploy this demo is to use the Vercel Platform.
Don't forget to:
- Configure environment variables in your Vercel project
- Set up Stripe webhook endpoints
- Configure Supabase connection details
Check out the deployment documentation for more details.