Deployment Guide
This guide explains how to deploy the 3Lens documentation site.
Deployment Options
3Lens documentation supports three deployment targets:
| Platform | Config File | Best For |
|---|---|---|
| GitHub Pages | .github/workflows/deploy-docs.yml | Open source projects |
| Vercel | vercel.json | Preview deployments, edge caching |
| Netlify | netlify.toml | Branch deploys, form handling |
GitHub Pages (Recommended)
GitHub Pages is the primary deployment target for 3Lens documentation.
Setup
Enable GitHub Pages in repository settings:
- Go to Settings → Pages
- Source: "GitHub Actions"
Configure domain (optional):
- Add custom domain in Settings → Pages
- Create
docs/public/CNAMEwith your domain
Deploy:
- Push to
mainbranch - Or trigger manually in Actions tab
- Push to
Automatic Deployment
The workflow automatically deploys when:
- Changes are pushed to
mainbranch indocs/folder - Package source code changes (regenerates API docs)
- Workflow file is updated
- Manually triggered via "Run workflow"
Workflow Overview
yaml
# .github/workflows/deploy-docs.yml
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'packages/*/src/**'1
2
3
4
5
6
7
2
3
4
5
6
7
The workflow:
- Checks out repository with full history
- Installs dependencies with pnpm
- Builds all packages
- Generates TypeDoc API reference
- Builds VitePress site
- Deploys to GitHub Pages
Manual Deployment
- Go to Actions → Deploy Documentation
- Click "Run workflow"
- Select branch (usually
main) - Click "Run workflow"
Vercel
Setup
Import project on vercel.com:
- Connect GitHub repository
- Vercel auto-detects
vercel.json
Configure environment:
NODE_VERSION = 201Deploy:
- Automatic on every push
- Preview URLs for pull requests
Configuration
json
// vercel.json
{
"buildCommand": "pnpm docs:build",
"outputDirectory": "docs/.vitepress/dist"
}1
2
3
4
5
2
3
4
5
Features
- ✅ Automatic preview deployments
- ✅ Edge caching
- ✅ Analytics (optional)
- ✅ Custom domains
Netlify
Setup
Import project on netlify.com:
- Connect GitHub repository
- Netlify reads
netlify.toml
Build settings (auto-detected):
- Build command:
pnpm docs:build - Publish directory:
docs/.vitepress/dist
- Build command:
Deploy:
- Automatic on every push
- Deploy previews for PRs
Configuration
toml
# netlify.toml
[build]
command = "pnpm docs:build"
publish = "docs/.vitepress/dist"1
2
3
4
2
3
4
Features
- ✅ Deploy previews
- ✅ Branch deploys
- ✅ Form handling
- ✅ Split testing
Custom Domain
GitHub Pages
Add domain in Settings → Pages
Create DNS records:
# For apex domain (3lens.dev) A @ 185.199.108.153 A @ 185.199.109.153 A @ 185.199.110.153 A @ 185.199.111.153 # For subdomain (docs.3lens.dev) CNAME docs adriandarian.github.io1
2
3
4
5
6
7
8Create
docs/public/CNAME:docs.3lens.dev1
Vercel / Netlify
- Add domain in project settings
- Follow DNS configuration wizard
- SSL certificates are automatic
Build Scripts
bash
# Local development
pnpm docs:dev
# Production build
pnpm docs:build
# Preview production build
pnpm docs:preview
# Generate TypeDoc API reference
pnpm docs1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
Environment Variables
| Variable | Description | Default |
|---|---|---|
NODE_ENV | Build mode | development |
VITEPRESS_BASE | Base URL path | / |
Caching
GitHub Pages
- Assets cached for 10 minutes by default
- Use
?v=hashfor cache busting
Vercel / Netlify
- Immutable assets cached for 1 year
- HTML files have short TTL for updates
Troubleshooting
Build Fails
- Check Node.js version (requires 20+)
- Verify pnpm lockfile is committed
- Check for TypeScript errors:
pnpm typecheck
404 Errors
- Verify
basein VitePress config matches deployment path - Check
cleanUrlssetting - Ensure redirects are configured
Missing Styles
- Clear browser cache
- Check asset paths in build output
- Verify CSS imports in theme
Slow Builds
- Enable build caching in CI
- Use
pnpm install --frozen-lockfile - Consider incremental builds
Monitoring
Uptime Monitoring
- UptimeRobot - Free tier available
- Pingdom - More detailed
Performance
Analytics
- VitePress has no built-in analytics
- Add Plausible, Fathom, or Simple Analytics
- See Analytics Setup Guide
Next Steps
- SEO Configuration - Optimize for search engines
- Analytics Setup - Track user engagement
- Maintenance - Keep documentation healthy