
Photo by Shahadat Rahman on Unsplash
How to Add Authentication, Billing, and Email to Your SaaS MVP Fast
How to Add Authentication, Billing, and Email to Your SaaS MVP Fast
Authentication, billing, and email are the three pillars of every SaaS application. Without auth, users can't log in. Without billing, you can't make money. Without email, you can't communicate with users.
Together, these three features typically consume 3-6 weeks of development time when built from scratch. With the right tools and approach, you can have all three working in 3-5 days.
Here's how.
Part 1: Authentication (Day 1)
Choose Your Auth Solution
| Solution | Setup Time | Cost | Best For |
|---|---|---|---|
| NextAuth (Auth.js) | 2-4 hours | Free | Full control, self-hosted |
| Clerk | 30-60 minutes | Free (10K MAU) | Fastest setup, beautiful UI |
| Supabase Auth | 1-2 hours | Free (with Supabase) | Already using Supabase for DB |
| Auth0 | 2-3 hours | Free (7.5K MAU) | Enterprise features needed |
| Custom (bcrypt + sessions) | 3-5 days | Free | Maximum control, most risk |
Recommendation for speed: Clerk (30 minutes to fully working auth). Recommendation for flexibility: NextAuth (free, self-hosted, no vendor lock-in).
What to Implement
Must have:
- Sign up with email and password
- Sign in
- Sign out (clear session + local storage)
- Password reset via email
- Protected routes (redirect unauthenticated users to login)
- Session persistence (stay logged in across page refreshes)
Defer:
- Social login (Google, GitHub) — add later, it's a config change
- Two-factor authentication — enterprise feature
- Magic link login — nice to have, not essential
- SSO/SAML — enterprise feature
Common Auth Mistakes
- Storing passwords in plain text — Always hash with bcrypt or argon2
- Not validating email format — Use Zod or similar on both client and server
- Forgetting to clear sessions on logout — Clear cookies AND local storage
- No rate limiting on login — Prevents brute force attacks
- Exposing user IDs in URLs — Use non-sequential IDs (cuid, uuid)
Part 2: Billing with Stripe (Days 2-3)
Setup Checklist
- Create a Stripe account (takes 5 minutes)
- Install the Stripe SDK (
npm install stripe @stripe/stripe-js) - Add Stripe API keys to environment variables
- Create Products and Prices in Stripe Dashboard
Implementation Steps
Step 1: Create a Checkout Session (Backend)
When a user clicks "Subscribe" or "Buy", create a Stripe Checkout Session that redirects them to Stripe's hosted payment page.
Key parameters:
customer_email— Pre-fill with the user's emailprice— The Stripe Price ID for the selected plansuccess_url— Where to redirect after successful paymentcancel_url— Where to redirect if they cancelmetadata— Store your user ID for webhook processing
Step 2: Handle Webhooks (Backend)
Create a webhook endpoint that Stripe calls when events happen:
| Event | Action |
|---|---|
checkout.session.completed | Mark user as subscribed, store Stripe customer ID |
customer.subscription.updated | Update plan info in your database |
customer.subscription.deleted | Mark user as cancelled |
invoice.payment_failed | Send failed payment email, start grace period |
Critical: Always verify the webhook signature to prevent spoofing.
Step 3: Access Control (Frontend + Backend)
Check subscription status before allowing access to paid features:
- Active or trialing → Full access
- Past due → Warning banner + grace period
- Cancelled or expired → Upgrade prompt
Step 4: Customer Portal
Link to Stripe's hosted Customer Portal for self-service:
- Update payment method
- View invoices
- Cancel subscription
- Change plans
This saves you from building a billing management UI.
Common Billing Mistakes
- Not handling webhooks — Relying on redirect URLs alone is unreliable
- Not verifying webhook signatures — Security vulnerability
- Hardcoding prices — Use Stripe Price IDs from environment variables
- Not handling failed payments — Users churn silently without grace periods
- Building a custom billing UI — Use Stripe Customer Portal instead
Part 3: Transactional Email (Day 4)
Choose Your Email Service
| Service | Free Tier | Setup Time | Best Feature |
|---|---|---|---|
| Resend | 3,000/mo | 20 minutes | React email templates |
| SendGrid | 100/day | 30 minutes | Established, reliable |
| Postmark | 100/mo | 20 minutes | Fastest delivery |
| AWS SES | 62K/mo (from EC2) | 1-2 hours | Cheapest at scale |
Recommendation: Resend. Best developer experience and the free tier covers MVP needs.
Essential Emails to Build
| Trigger | Priority | |
|---|---|---|
| Welcome | After sign up | Must have |
| Password reset | User requests reset | Must have |
| Payment confirmation | After successful payment | Must have |
| Payment failed | Invoice payment fails | Must have |
| Trial ending | 3 days before trial expires | Should have |
Email Implementation Tips
- Use a template system — Resend supports React components as email templates
- Always include an unsubscribe link — Required by law (CAN-SPAM, GDPR)
- Set a proper "from" address —
hello@yourdomain.com, notnoreply@ - Test email delivery — Send test emails to Gmail, Outlook, and Yahoo
- Check spam scores — Use Mail Tester (free) to verify deliverability
- Configure DNS records — SPF, DKIM, and DMARC prevent emails from landing in spam
Common Email Mistakes
- Not setting up DNS records — Your emails will go to spam
- Sending too much too early — Welcome + essential transactional only for MVP
- HTML emails that break on mobile — Use a responsive email framework
- No unsubscribe link — Legal requirement, not optional
- Using personal Gmail as sender — Looks unprofessional, deliverability issues
The 5-Day Implementation Timeline
| Day | Focus | Deliverable |
|---|---|---|
| Day 1 | Authentication | Sign up, sign in, sign out, password reset, protected routes |
| Day 2 | Stripe setup | Products created, checkout flow working |
| Day 3 | Stripe webhooks | Webhooks handling events, access control working |
| Day 4 | Welcome, password reset, payment emails sending | |
| Day 5 | Integration testing | Full flow: sign up → subscribe → receive emails → access features |
The Fastest Path: Use a Boilerplate
If 5 days still feels like too much for infrastructure, a SaaS boilerplate gives you all three — auth, billing, and email — pre-configured on day one. You skip straight to building your unique features.
Final Thoughts
Auth, billing, and email are infrastructure, not product. Spend the minimum time required to get them working reliably, then move on to what makes your SaaS unique.
Use managed services (Clerk, Stripe, Resend) over custom implementations. Use a boilerplate if available. And remember: every day you spend perfecting your login screen is a day you're not building the feature your customers will pay for.
Want all of this pre-built? Browse SaaS boilerplates on MVPHub.
Building a subscription SaaS? Read How to Build a Subscription SaaS MVP.
Choosing your full stack? See The Ultimate SaaS MVP Tech Stack.







