Start Building

Deployment and Shipping

How to Deploy a SaaS App to Vercel: The Complete Production Checklist

5 min read

You push your code. Vercel builds it. The deployment succeeds. You open the URL and nothing works.

The database won't connect. The auth flow redirects to localhost. Stripe webhooks return 404s. Environment variables are missing or wrong. Your staging site looks fine but production is broken in three different ways.

Deploying a SaaS to production is not the same as deploying a portfolio site. The number of moving parts — database connections, payment processors, auth callbacks, email providers, third-party APIs — means a deployment can succeed at the build level and fail completely at the runtime level. Getting this right requires a checklist, not hope.

Why SaaS Deployments Break Differently

A static site deployment has one real failure mode: the build fails. A SaaS deployment has a dozen runtime failure modes that only surface when real traffic hits real infrastructure.

The most common production breakages fall into predictable categories:

Environment variable mismatches — Variables that work locally are missing, misspelled, or set to development values in production. The app builds fine because build-time checks don't catch runtime config errors.

Database connection failures — MongoDB Atlas network access lists block Vercel's IP ranges. Connection strings are correct locally but wrong in production. Connection pooling settings that work for a local dev server behave differently under Vercel's serverless function model.

OAuth redirect URI errors — Google and GitHub OAuth require exact redirect URIs registered in the developer console. The URI that works on localhost breaks on the production domain because no one updated the OAuth app settings.

Stripe webhook failures — Webhooks pointing to localhost or a staging URL in the Stripe dashboard don't fire against the production endpoint. Webhook signing secrets set to test values in production cause signature verification failures.

CORS errors — API routes that accept requests from localhost reject requests from the production frontend domain because CORS configuration was never updated.

Missing build output — Server-side rendering, API routes, and edge functions each have different output requirements. A misconfigured build can produce a deployment that looks successful but serves incorrect responses.

None of these are hard to fix. But each one requires deliberate configuration, and skipping any of them produces a broken production deployment.

Visual walkthrough of app deployment workflow on Vercel

The Vercel Deployment Model for SaaS

Vercel is the natural deployment target for Next.js SaaS products and works well for Nextjs stacks with a separately deployed API. Understanding how Vercel handles your application is essential for getting deployment right.

Serverless functions — Vercel deploys your API routes and server-side rendering logic as serverless functions. This means each request spins up a fresh function instance. Database connections cannot persist between requests the way they do in a long-running Node server. You need connection pooling configured correctly for a serverless environment, or you will exhaust your MongoDB Atlas connection limit under moderate traffic.

Environment variables — Vercel manages environment variables per project and per environment (production, preview, development). Variables must be explicitly added in the Vercel dashboard or via the Vercel CLI. They are not read from your local dotenv files.

Preview deployments — Every pull request gets a unique preview URL. This is powerful for testing but creates complexity for OAuth callbacks, Stripe webhooks, and any service that requires registered URLs. You need a strategy for preview environment configuration before it becomes a problem.

Build cache — Vercel caches build output aggressively. This speeds up deployments but occasionally serves stale assets after a deployment. Understanding cache invalidation behavior prevents confusing bugs where code changes don't appear to take effect.

The Complete Pre-Deployment Checklist

Work through every item on this list before pointing a production domain at your deployment.

Environment Variables

Every environment variable your application reads must be set in the Vercel dashboard for the production environment. Go through your local dotenv file line by line and add each variable. Common variables that get missed: JWT secret, refresh token secret, MongoDB connection string, Stripe publishable key, Stripe secret key, Stripe webhook secret, OAuth client IDs and secrets, email provider API key, and any third-party service keys.

Variables that should differ between environments: database connection strings, Stripe keys (test vs live), OAuth redirect URIs, and any feature flags. Variables that should be identical: JWT secrets (unless you want to invalidate all sessions on deployment), email templates, and application configuration.

MongoDB Atlas Configuration

Atlas restricts network access by IP address by default. Vercel's serverless functions do not have fixed IP addresses — they run across a dynamic IP range. You have two options: whitelist all IP addresses (0.0.0.0/0) which is acceptable for most SaaS products at early scale, or use a static IP proxy service to route database traffic through a fixed IP.

Configure your MongoDB connection string for serverless by setting the connection pool size appropriately. A pool size of 10 is a reasonable starting point for a Vercel deployment. Add connection timeout and server selection timeout settings to handle cold start latency.

OAuth Configuration

Every OAuth provider your app uses — Google, GitHub, or others — requires the production redirect URI to be registered in the developer console. Log into each OAuth provider's developer console and add your production domain's callback URL. The exact format depends on your auth implementation but typically follows the pattern of your production domain followed by your auth callback path.

Do this before testing auth on the production deployment. OAuth errors are confusing to debug because the error message from the provider is often generic.

Stripe Configuration

Switch your Stripe keys from test mode to live mode for the production environment. Set the Stripe webhook endpoint in the Stripe dashboard to your production URL. Generate a new webhook signing secret for the production endpoint and add it to your production environment variables — do not reuse the test webhook secret.

Test the webhook endpoint after deployment by using Stripe's dashboard to send a test event. Confirm it arrives and is processed correctly before considering the billing integration production-ready.

For teams managing multiple pricing tiers, confirming that payment plans are configured correctly in the live Stripe environment before launch prevents billing inconsistencies that are painful to debug with real customer data.

CORS Configuration

Update your API's CORS configuration to allow requests from your production domain. If your API is deployed separately from your frontend, this is a required step — not an optional one. A CORS misconfiguration produces errors that look like network failures in the browser, which can be confusing to trace back to a configuration issue.

Developer building a SaaS dashboard using SassyPack-2

Common Deployment Mistakes

These are the patterns that consistently break SaaS deployments:

Deploying without testing the full auth flow on the production URL. Auth flows that work locally break in production for reasons unrelated to code — OAuth redirect URIs, cookie domain settings, and secure cookie flags all behave differently in production. Always test sign up, sign in, and sign out on the production URL before announcing launch.

Using test Stripe keys in production. Test mode payments appear to work but do not charge real cards. Launching with test keys means early customers complete checkout but are never charged. This is embarrassing and creates manual reconciliation work.

Not setting secure and sameSite flags on cookies in production. Cookies that work over HTTP localhost break over HTTPS production if the secure flag is not set. The sameSite flag affects cross-origin cookie behavior that surfaces differently in production than in local development.

Deploying environment changes without redeploying. Vercel does not automatically redeploy when you update environment variables. After changing a variable in the Vercel dashboard, trigger a manual redeploy to pick up the new values.

Not monitoring the first deployment. The first production deployment should be watched in real time. Open Vercel's function logs, open your database monitoring dashboard, and walk through the application manually. The first ten minutes after a production deployment are when environment issues surface.

Pro Tips for Zero-Downtime SaaS Deployments

Deploy to a staging environment that mirrors production exactly. A staging environment with production-equivalent configuration catches environment-specific bugs before they affect real users. The investment in maintaining a staging environment pays off the first time it catches a breaking deployment.

Use Vercel's preview deployments for integration testing. Before merging any significant change, test it on a preview deployment with a staging database and test-mode payment keys. Preview deployments are free on Vercel and provide an isolated environment for each branch.

Implement health check endpoints. A simple API route that checks database connectivity and returns a status response lets you verify that a deployment is functional in under five seconds. Add this to your deployment process and check it immediately after every deployment.

Version your API routes. Prefixing API routes with a version identifier makes it safe to deploy breaking API changes without affecting users on the current version. This is a small upfront investment that prevents significant coordination overhead as your product grows.

Set up error monitoring before launch. Sentry, LogRocket, or a similar error monitoring service should be configured and receiving events before your first real user signs up. Errors in production that are not monitored are errors you will not know about until a user reports them.

How SassyPack Handles Deployment

SassyPack ships with Vercel deployment configuration already in place. Environment variable conventions follow production best practices, with clear separation between development and production values. The MongoDB connection is configured for Vercel's serverless model with appropriate pooling settings. CORS configuration covers the common production patterns.

The deployment guide included with SassyPack walks through every step of a production deployment — from environment variable setup to OAuth configuration to Stripe webhook registration — so the first production deployment is a checklist exercise rather than a debugging session.

For developers who want to understand the full picture of what a production-ready SaaS foundation includes before choosing a starting point, the SassyPack vs building from scratch comparison covers deployment configuration alongside auth, payments, and routing.

A Realistic Deployment Scenario

A developer finishing the first version of a B2B SaaS product is ready to deploy. The application works perfectly in local development.

Without a deployment checklist: three hours of debugging environment variable issues, an OAuth redirect error that takes 45 minutes to trace, a Stripe webhook 404 that causes the first test subscription to never activate, and a MongoDB Atlas connection error under load that only surfaces after the first ten simultaneous users.

With a systematic deployment checklist: environment variables configured in 20 minutes, OAuth redirect URIs updated in five minutes, Stripe webhook endpoint registered and tested in ten minutes, database connection validated before launch. Total deployment time: under an hour, with confidence.

Action Plan: Production Deployment Checklist

Work through these steps in order for every production deployment:

  1. Set all environment variables in Vercel dashboard. Go line by line through your local dotenv file. Do not skip any variable.
  2. Configure MongoDB Atlas network access. Whitelist Vercel's IP range or open to all IPs with a strong connection string password.
  3. Register production OAuth redirect URIs. Update every OAuth provider's developer console with the production callback URL.
  4. Switch to live Stripe keys and register the production webhook endpoint. Generate a new webhook signing secret and add it to production environment variables.
  5. Update CORS configuration to allow requests from the production domain.
  6. Deploy and immediately test the full auth flow. Sign up, verify email, sign in, access a protected page, sign out.
  7. Test the full payment flow with a real card in live mode. Confirm the webhook fires and subscription activates.
  8. Check function logs for errors in the first ten minutes after deployment.

Deployment Is the Last Mile That Matters

Building a SaaS product correctly and deploying it incorrectly produces the same result as not building it at all — users cannot use it. The deployment checklist is not optional infrastructure. It is the last mile between finished code and a working product in the hands of real users.

The good news is that deployment mistakes are almost always configuration errors, not code errors. They are predictable, documentable, and repeatable to fix once you know the pattern.

Ready to ship your SaaS without the deployment debugging session? Explore SassyPack and launch with a deployment configuration that is already production-ready.

Keep Reading

Related Articles

View all posts

Free Tools

Ready to put the guide to work?

Use the free SaaS tools to plan pricing, validate ideas, and check your launch setup.

Open Free Tools