This directory contains the standalone, production-ready Vercel Serverless edition of FormHub.
It runs natively on Vercel Serverless Functions (Node.js) with persistent MongoDB Atlas integration, sub-100ms cold starts, and automatic global edge scaling.
vercel/
├── api/
│ └── index.js # Vercel Serverless Function entrypoint
├── src/
│ ├── auth.js # JWT issue & verification (jose v6)
│ ├── crypto-utils.js # PBKDF2 & AES-256-GCM encryption
│ ├── db.js # Serverless connection pool caching
│ ├── index.js # Core Web Request Router
│ ├── security.js # Security headers, CSP & bot verification
│ ├── shopify.js # Shopify Admin API Metaobjects & Files sync
│ ├── validation.js # Input validation, EXIF stripping, binary sniff
│ ├── routes/ # Modular API endpoint handlers
│ └── ui/ # Full-featured Single-Page Dashboard & Form Builder
├── .env.example # Environment variables template
├── .gitignore # Vercel-specific gitignore
├── package.json # Minimal serverless dependencies
├── vercel.json # Vercel rewrite & function configuration
└── README.md # Deployment documentation
- Open your terminal in the
verceldirectory:cd vercel - Run the Vercel deploy command:
npx vercel
- When prompted, link or create your project.
- Deploy to production:
npx vercel --prod
- Go to vercel.com/new and import your GitHub repository.
- In the Project Settings:
- Set Root Directory to
vercel. - Framework Preset: Other.
- Set Root Directory to
- Under Environment Variables, add the required keys:
MONGODB_URI: Your MongoDB Atlas SRV connection string (e.g.mongodb+srv://user:pass@cluster0.mongodb.net/formhub?appName=FormHub).JWT_SECRET: A secure 64-character random hex string.ENCRYPTION_KEY: A secure 32-byte base64-encoded key.- (Optional)
PLATFORM_TURNSTILE_SITE_KEY&PLATFORM_TURNSTILE_SECRET_KEY: For Cloudflare CAPTCHA bot protection. - (Optional)
DASHBOARD_ALLOWED_ORIGINS: Set to*or your custom domain.
- Click Deploy.
- Connection Pool Caching: src/db.js caches the
MongoClientinstance across warm Lambda invocations to avoid exhausting database sockets. - Pure Web Standards: Leverages standard
Request,Response,Headers, andcrypto.subtlefor fast, lightweight execution without heavy web framework overhead. - Auto-Routing: vercel.json routes all public endpoints (
/api/:username/:appname/,/health,/, and dashboard SPA) through/api/index.js.