Prerequisites
Before deploying, make sure you have:- Node.js 18 or later and npm installed
- A Convex account with a project created
- A Clerk account with an application created
- A Liveblocks account with a project created
Environment variables
DocuSphere requires seven environment variables. Set these in your hosting platform’s dashboard (or in a.env.local file if running locally).
| Variable | Description |
|---|---|
CONVEX_DEPLOYMENT | Your Convex deployment identifier. Use prod:your-deployment for production deployments. |
NEXT_PUBLIC_CONVEX_URL | The HTTPS URL of your Convex deployment (e.g. https://your-deployment.convex.cloud). Exposed to the browser. |
NEXT_PUBLIC_CONVEX_SITE_URL | The site URL of your Convex deployment (e.g. https://your-deployment.convex.site). Exposed to the browser. |
CLERK_JWT_ISSUER_DOMAIN | Your Clerk JWT issuer domain, used by Convex to verify authentication tokens (e.g. https://your-domain.clerk.accounts.dev). Keep this server-side. |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Your Clerk publishable key (starts with pk_). Exposed to the browser — this is safe. |
CLERK_SECRET_KEY | Your Clerk secret key (starts with sk_). Never expose this to the browser. |
NEXT_PUBLIC_LIVEBLOCKS_SECRET_KEY | Your Liveblocks secret key (starts with sk_dev_ or sk_prod_). Read only in a server-side API route — not exposed to the browser despite the NEXT_PUBLIC_ prefix in its name. |
Deploy the Convex backend
Before building the Next.js app, deploy your Convex functions and schema to the production Convex environment:Build and start the Next.js app
Once the Convex backend is deployed, build the Next.js app:Deploying to Vercel
Vercel is the recommended hosting platform for DocuSphere because it is designed for Next.js and supports serverless deployment out of the box.Connect your repository
Go to vercel.com, create a new project, and import your DocuSphere repository from GitHub.
Add environment variables
In the Vercel project settings, navigate to Settings → Environment Variables and add all seven variables listed in the table above. Set each variable for the Production environment (and Preview if needed).
Deploy
Trigger a deployment from the Vercel dashboard or by pushing to your main branch. Vercel runs
npm run build automatically and serves the output.You must run
npx convex deploy separately before or after each Vercel deployment when you make changes to your Convex schema or functions. Vercel does not run Convex deployment as part of its build step unless you add it to the build command in your project settings.