How I wired Stripe subscriptions to Supabase in Next.js 15 (the parts tutorials skip)
The article discusses the integration of Stripe subscriptions with Supabase in a Next.js 15 application. It emphasizes the importance of using three different Supabase clients to handle various contexts effectively. Additionally, it highlights common pitfalls and provides middleware solutions for session management and webhook handling.
- ▪Every SaaS requires a foundation of authentication, payments, a database, and protected routes.
- ▪Using the wrong Supabase client in the wrong context can lead to subtle bugs and errors.
- ▪The middleware provided in the article refreshes user sessions and manages redirects based on authentication status.
Opening excerpt (first ~120 words) tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 3953073) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Jonathan Diniz Posted on May 26 How I wired Stripe subscriptions to Supabase in Next.js 15 (the parts tutorials skip) #nextjs #supabase #stripe #webdev Every SaaS needs the same foundation: auth, payments, a database, protected routes. I've built this from scratch too many times. This post covers the parts that actually trip people up — not the happy path, but the edge cases that break production apps. The three Supabase client problem Most tutorials show one Supabase client.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at DEV.to (Top).