Skip to main content

Deploy NetPad to Vercel

Deploy Your Own NetPad Instanceโ€‹

NetPad can be self-hosted on Vercel with your own MongoDB Atlas database. This gives you complete control over your data, custom domain support, and the ability to customize your instance.

Key Benefitsโ€‹

  • Full data ownership and control
  • Custom domain support
  • Use your existing MongoDB Atlas cluster
  • Free tier available (Vercel Hobby + MongoDB M0)
  • Automatic SSL and CDN

Quick Start - One-Click Deployโ€‹

The fastest way to deploy NetPad:

Deploy with Vercel

What happens when you click:โ€‹

  1. Vercel forks the NetPad repository to your GitHub account
  2. You're prompted to configure required environment variables
  3. Vercel builds and deploys your instance
  4. Your NetPad instance is live in ~2-3 minutes

Prerequisitesโ€‹

Before deploying, you'll need:

RequirementDescriptionLink
Vercel AccountFree or paid accountSign up
GitHub AccountTo fork and manage your instanceSign up
MongoDB Atlas AccountFor your databaseSign up

Environment Variablesโ€‹

Required Variablesโ€‹

These must be configured for NetPad to function:

VariableDescriptionHow to Generate
MONGODB_URIMongoDB connection stringSee MongoDB Atlas Setup below
SESSION_SECRETSecret for session encryption (min 32 characters)Run: openssl rand -hex 32
VAULT_ENCRYPTION_KEYBase64 key for vault encryption (32 bytes)Run: openssl rand -base64 32
VariableDescriptionDefault
MONGODB_DATABASEDatabase name for NetPad dataforms
NEXT_PUBLIC_APP_URLPublic URL of your deployment${VERCEL_URL} (auto-detected)
APP_URLServer-side URL for callbacks${VERCEL_URL} (auto-detected)

Optional Variables - Featuresโ€‹

VariableDescriptionEnables
OPENAI_API_KEYOpenAI API keyAI form/workflow generation
BLOB_READ_WRITE_TOKENVercel Blob storage tokenFile uploads in forms
GOOGLE_CLIENT_IDGoogle OAuth client IDGoogle login
GOOGLE_CLIENT_SECRETGoogle OAuth secretGoogle login
GITHUB_CLIENT_IDGitHub OAuth client IDGitHub login
GITHUB_CLIENT_SECRETGitHub OAuth secretGitHub login
SMTP_HOSTSMTP server hostnameMagic link email login
SMTP_PORTSMTP server portMagic link email login
SMTP_USERSMTP usernameMagic link email login
SMTP_PASSSMTP passwordMagic link email login
FROM_EMAILSender email addressMagic link email login

Optional Variables - Billingโ€‹

VariableDescription
STRIPE_SECRET_KEYStripe secret key
STRIPE_PUBLISHABLE_KEYStripe publishable key
STRIPE_WEBHOOK_SECRETStripe webhook signing secret

Setting Up MongoDB Atlasโ€‹

Step 1: Create a Free Clusterโ€‹

  1. Go to MongoDB Atlas
  2. Create a new project or use an existing one
  3. Click "Build a Database"
  4. Select M0 (Free) for testing, or M2/M5 for production
  5. Choose a cloud provider (AWS recommended) and region close to your Vercel deployment region

Step 2: Create a Database Userโ€‹

  1. Navigate to Security โ†’ Database Access
  2. Click "Add New Database User"
  3. Select Password authentication
  4. Enter a username (e.g., netpad-user)
  5. Click "Autogenerate Secure Password" and save it securely
  6. Set privileges to "Read and write to any database"
  7. Click "Add User"

Step 3: Configure Network Accessโ€‹

  1. Navigate to Security โ†’ Network Access
  2. Click "Add IP Address"
  3. For quick setup: Click "Allow Access from Anywhere" (0.0.0.0/0)
note

For production, consider using Vercel's IP ranges or MongoDB Atlas Private Endpoints

  1. Click "Confirm"

Step 4: Get Your Connection Stringโ€‹

  1. Navigate to Databases โ†’ Connect
  2. Click "Connect your application"
  3. Select Driver: Node.js and Version: 5.5 or later
  4. Copy the connection string
  5. Replace <password> with your database user's password
  6. Add your database name before the ?:
mongodb+srv://username:password@cluster.mongodb.net/forms?retryWrites=true&w=majority

Manual Deployment Stepsโ€‹

If you prefer to deploy manually instead of using the one-click button:

Step 1: Fork the Repositoryโ€‹

  1. Go to github.com/mrlynn/netpad-v3
  2. Click "Fork" in the top right
  3. This creates your own copy of NetPad that you can customize

Step 2: Import to Vercelโ€‹

  1. Go to vercel.com/new
  2. Click "Import" next to your forked repository
  3. Configure the project:
    • Framework Preset: Next.js (auto-detected)
    • Root Directory: Leave empty
    • Build Command: npm run build (default)
    • Output Directory: Leave empty (default)

Step 3: Add Environment Variablesโ€‹

In the Vercel project configuration:

  1. Expand "Environment Variables"
  2. Add each required variable:
    • MONGODB_URI = your connection string
    • SESSION_SECRET = your generated secret
    • VAULT_ENCRYPTION_KEY = your generated key
  3. Add any optional variables for features you want

Step 4: Deployโ€‹

  1. Click "Deploy"
  2. Wait for the build to complete (~2-3 minutes)
  3. Click "Visit" to see your deployment

Step 5: Verifyโ€‹

Check the health endpoint:

https://your-app.vercel.app/api/v1/health

Expected response:

{
"status": "healthy",
"api": { "status": "operational", "responseTimeMs": 10 },
"database": { "status": "connected", "responseTimeMs": 50 }
}

Post-Deployment Configurationโ€‹

Setting Up OAuth Loginโ€‹

Google OAuthโ€‹

  1. Go to Google Cloud Console
  2. Create a new OAuth 2.0 Client ID
  3. Set authorized redirect URI: https://your-app.vercel.app/api/auth/google/callback
  4. Add GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET to Vercel

GitHub OAuthโ€‹

  1. Go to GitHub Developer Settings
  2. Create a new OAuth App
  3. Set callback URL: https://your-app.vercel.app/api/auth/github/callback
  4. Add GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET to Vercel
  1. Choose an SMTP provider (SendGrid, Postmark, AWS SES, etc.)
  2. Add the SMTP environment variables
  3. Redeploy to apply changes

Setting Up AI Featuresโ€‹

  1. Get an API key from OpenAI Platform
  2. Add OPENAI_API_KEY to Vercel
  3. Redeploy to enable AI form/workflow generation

Setting Up File Uploadsโ€‹

  1. In Vercel Dashboard, go to Storage โ†’ Create Database โ†’ Blob
  2. Create a new Blob store
  3. Copy the BLOB_READ_WRITE_TOKEN
  4. Add it to your environment variables

Custom Domain Setupโ€‹

  1. Go to your Vercel project โ†’ Settings โ†’ Domains
  2. Add your custom domain (e.g., forms.yourcompany.com)
  3. Configure DNS as instructed by Vercel
  4. Update environment variables:
NEXT_PUBLIC_APP_URL=https://forms.yourcompany.com
APP_URL=https://forms.yourcompany.com
  1. Update OAuth callback URLs if using Google/GitHub login

Keeping Your Instance Updatedโ€‹

Set up GitHub Actions to sync with the main NetPad repository:

  1. In your forked repo, go to Settings โ†’ Actions โ†’ General
  2. Enable workflows
  3. Updates will be merged automatically (or create PRs for review)

Manual Updatesโ€‹

# Add upstream remote
git remote add upstream https://github.com/mrlynn/netpad-v3.git

# Fetch updates
git fetch upstream

# Merge updates
git merge upstream/main

# Push to your fork (triggers Vercel redeploy)
git push

Troubleshootingโ€‹

"Database connection failed"โ€‹

  • Verify MONGODB_URI is correct and includes the password
  • Check MongoDB Atlas Network Access allows your IP (or 0.0.0.0/0)
  • Ensure the database user has correct permissions
  • Try the connection string in MongoDB Compass to verify

"Session error" or "Authentication failed"โ€‹

  • Ensure SESSION_SECRET is at least 32 characters
  • Don't share secrets between different deployments
  • Regenerate and redeploy if you suspect compromise

"Vault encryption failed"โ€‹

  • VAULT_ENCRYPTION_KEY must be valid base64
  • Must decode to exactly 32 bytes
  • Generate fresh: openssl rand -base64 32

"OAuth callback failed"โ€‹

  • Verify callback URLs match your deployment domain exactly
  • Check for trailing slashes in URLs
  • Ensure client ID and secret are correct

Build failsโ€‹

  • Check build logs in Vercel dashboard
  • Ensure Node.js version 18+ is being used
  • Verify all required environment variables are set

Workflows not runningโ€‹

  • Vercel Cron requires Pro plan or higher
  • Check /api/workflows/process endpoint is accessible
  • Verify no errors in Vercel Functions logs

Architecture Overviewโ€‹

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your Vercel Deployment โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ Next.js โ”‚ โ”‚ Vercel Cron โ”‚ โ”‚ Vercel Blob โ”‚ โ”‚
โ”‚ โ”‚ App โ”‚ โ”‚ (workflows) โ”‚ โ”‚ (file storage) โ”‚ โ”‚
โ”‚ โ”‚ (Edge/ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ Serverless)โ”‚ โ”‚ Every min โ”‚ โ”‚ Optional โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚ โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your MongoDB Atlas Cluster โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚
โ”‚ โ”‚ Database: forms โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ users (user accounts) โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ organizations (teams/workspaces) โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ forms (form definitions) โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ form_responses (submissions) โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ workflows (automation definitions) โ”‚โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ workflow_jobs (execution history) โ”‚โ”‚
โ”‚ โ”‚ โ””โ”€โ”€ connection_vaults (encrypted connections) โ”‚โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Frequently Asked Questionsโ€‹

Q: Is self-hosting free? A: Yes! Vercel's Hobby plan and MongoDB Atlas M0 are both free. You only pay if you need more resources.

Q: Can I use my existing MongoDB cluster? A: Absolutely. Just use your existing connection string in MONGODB_URI.

Q: Will my data sync with netpad.io? A: No. Self-hosted instances are completely independent. Your data stays in your own database.

Q: Can I customize the code? A: Yes! Fork the repository and make any changes you need. It's open source under MIT license.

Q: How do I backup my data? A: Use MongoDB Atlas's built-in backup features, or use mongodump for manual backups.

Q: Can I migrate from netpad.io to self-hosted? A: Yes. Export your forms and data from netpad.io and import to your self-hosted instance.


Getting Helpโ€‹


Next Stepsโ€‹