This guide explains how to deploy the ObjectDocs example project (or any CLI-created project) to Vercel.
- A Vercel account (free tier works)
- A GitHub/GitLab/Bitbucket repository (or use Vercel CLI)
- Node.js 18+ configured in Vercel
-
Push to Git Repository
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/yourusername/your-docs.git git push -u origin main
-
Import in Vercel
- Go to vercel.com/new
- Select your repository
- Configure project settings:
- Framework Preset: Next.js (auto-detected)
- Root Directory:
.(orexampleif in monorepo) - Build Command:
pnpm build(auto-detected from package.json) - Output Directory:
.next(auto-detected) - Install Command:
pnpm install
-
Deploy
- Click "Deploy"
- Vercel will build and deploy your site
-
Install Vercel CLI
npm i -g vercel
-
Deploy from example directory
cd example vercel -
Follow the prompts
- Link to existing project or create new
- Configure settings (or use defaults)
-
Deploy to production
vercel --prod
The example includes a vercel.json file with recommended settings:
{
"buildCommand": "pnpm build",
"devCommand": "pnpm dev",
"installCommand": "pnpm install",
"framework": "nextjs",
"outputDirectory": ".next"
}These settings help Vercel auto-detect the correct build configuration.
If using AI translation or other features:
- Go to Project Settings → Environment Variables
- Add required variables:
OPENAI_API_KEY(for translation)OPENAI_BASE_URL(optional, for custom endpoints)
Vercel auto-detects Next.js projects. If you need custom settings:
- Framework: Next.js
- Node.js Version: 18.x or 20.x
- Package Manager: pnpm (recommended) or npm
- Build Command:
pnpm buildorobjectdocs build - Output Directory:
.next
Cause: The CLI package.json uses workspace:* reference instead of npm version.
Solution:
- Ensure
@objectdocs/clipackage.json has proper dependency:{ "dependencies": { "@objectdocs/site": "^0.2.11" // NOT "workspace:*" } } - Republish the CLI package if needed
Cause: Missing dependencies or incorrect package resolution.
Solution:
# Clear lock file and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm installCause: The CLI can't locate Next.js from @objectdocs/site.
Solution:
- Check that
@objectdocs/siteis properly installed as a dependency of@objectdocs/cli - Verify the CLI's require.resolve logic in dev.mjs and build.mjs
Cause: Content directory not found or DOCS_DIR env var incorrect.
Solution:
- Ensure
content/docs/exists with proper structure - Check that
meta.jsonand.mdxfiles are committed - Verify frontmatter in MDX files is correct
Cause: Production build has different behavior than dev.
Solution:
- Test production build locally first:
pnpm build pnpm start
- Check Vercel function logs in dashboard
- Verify all dependencies are in
dependenciesnotdevDependencies
After deployment, verify:
- ✅ Site loads at the Vercel URL
- ✅ All pages are accessible
- ✅ Navigation works (sidebar, header links)
- ✅ Dark mode toggle works
- ✅ Search functionality works (if enabled)
- ✅ Images and assets load correctly
- ✅ No console errors in browser
For better performance, configure static export in content/docs.site.json:
{
"build": {
"output": "export"
}
}This generates static HTML files that deploy faster and cost less.
Place images in the public/ directory and reference them with absolute paths:
- Go to Project Settings → Domains
- Add your custom domain
- Configure DNS records as instructed
Once connected to Git:
- Automatic Deploys: Push to main branch triggers production deployment
- Preview Deploys: Pull requests get preview URLs
- Rollback: Easy rollback to previous deployments in dashboard
-
Free Tier: Suitable for documentation sites
- 100GB bandwidth/month
- Serverless function execution
- Automatic HTTPS
-
Pro Tier: For larger sites or teams
- 1TB bandwidth/month
- Advanced analytics
- Team collaboration
- Configure custom domain
- Set up preview deployments for PRs
- Add analytics (Vercel Analytics or Google Analytics)
- Optimize images and assets
- Set up monitoring and alerts
If you encounter issues:
- Check Vercel Documentation
- Review Next.js Deployment Guide
- Open an issue in the ObjectDocs repository
- Contact Vercel support (Pro tier)
After deployment, your site will be available at:
- Production:
https://your-project.vercel.app - Custom Domain:
https://docs.yourcompany.com(if configured) - Preview:
https://your-project-git-branch.vercel.app(for branches)