Skip to main content
This page walks you through deploying DocuSphere to a production environment. The recommended hosting platform is Vercel, which auto-detects Next.js and handles builds with no extra configuration. DocuSphere can also run on any platform that supports Node.js 18 or later.
Before deploying to production, you must switch your Clerk keys from pk_test_/sk_test_ to pk_live_/sk_live_, and your Liveblocks key from sk_dev_ to sk_prod_. Using development or test keys in a production environment will cause authentication and collaboration failures.

Build and start commands

CommandScriptWhat it does
npm run buildnext buildCompiles the Next.js application for production.
npm run startnext startStarts the production Next.js server.
npm run linteslintRuns the linter. Run this before deploying to catch issues early.

Deploy Convex functions

Before deploying the Next.js app, deploy your Convex schema and functions to the production Convex deployment:
npx convex deploy
This command reads your CONVEX_DEPLOYMENT variable (set to prod:your-deployment-name for production), pushes your schema and all Convex functions, and makes them live. Run this whenever you make changes to files in the convex/ directory.
1

Push your code to GitHub

Make sure your project is in a GitHub repository. Vercel pulls your code directly from GitHub on each deploy.
2

Import the repository in Vercel

Go to vercel.com/new, click Import Git Repository, and select your DocuSphere repository. Vercel automatically detects that it is a Next.js project.
3

Add environment variables

In the Vercel project settings, go to Settings > Environment Variables and add all seven required variables with your production values:
CONVEX_DEPLOYMENT=prod:your-convex-deployment
NEXT_PUBLIC_CONVEX_URL=https://your-convex-url.convex.cloud
NEXT_PUBLIC_CONVEX_SITE_URL=https://your-convex-url.convex.site
CLERK_JWT_ISSUER_DOMAIN=https://your-app.clerk.accounts.dev
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_your_clerk_publishable_key
CLERK_SECRET_KEY=sk_live_your_clerk_secret_key
NEXT_PUBLIC_LIVEBLOCKS_SECRET_KEY=sk_prod_your_liveblocks_secret_key
See the environment variables reference for full descriptions of each variable.
4

Deploy

Click Deploy. Vercel runs npm run build and starts the production server automatically. Future pushes to your main branch trigger new deployments.

Other platforms

Any platform that supports Node.js 18 or later can host DocuSphere. Run npm run build to produce the production build, then npm run start to serve it. Set all seven environment variables in the platform’s environment configuration before starting the server.
The Convex dev server (npx convex dev) and the Next.js dev server (npm run dev) are only needed for local development. In production, use npx convex deploy to deploy Convex functions and npm run start to serve the Next.js app.

Build docs developers (and LLMs) love