Deploy docsblog-app to Cloudflare Workers, Vercel, or a self-hosted Node.js server
Deployment Guide
docsblog-app supports multiple deployment platforms. Choose the one that best fits your needs:
| Platform | Highlights | Best For |
|---|---|---|
| Cloudflare Workers | Edge computing, low cost, 300+ global nodes | Performance and cost optimization |
| Vercel | Zero config, native Next.js support | Developer experience and simple deployment |
| Node.js Self-Host | Full control, any server | Intranet deployment, self-managed infrastructure |
Common Setup
Regardless of which platform you choose, complete these steps first:
Environment Variables
Copy .env.example to .env and configure the core variables:
NEXT_PUBLIC_SITE_URL=https://your-domain.com
NEXT_PUBLIC_BASE_URL=https://your-domain.com
ENABLE_ADMIN=falseTip: The admin panel is for local development only. Set
ENABLE_ADMINtofalsein production.
Local Build Verification
pnpm install
pnpm buildVerify the build succeeds before proceeding with platform deployment.
Cloudflare Workers
Deploy to Cloudflare Workers using the OpenNext adapter, with ISR incremental static regeneration and KV caching.
1. Create a Cloudflare Account
- Sign up at dash.cloudflare.com/sign-up (free tier works)
- Note your Account ID (visible on the dashboard home page)
2. Create an API Token
- Go to API Tokens management
- Click Create Token → select Edit Cloudflare Workers template
- Confirm permissions:
Account - Workers Scripts - Edit,Account - Workers KV Storage - Edit - Create and copy the token (shown only once)
3. Create a KV Namespace
npx wrangler kv namespace create NEXT_INC_CACHE_KVNote the id from the output.
4. Configure wrangler.jsonc
Fill in the KV ID and production domain:
{
"kv_namespaces": [
{
"binding": "NEXT_INC_CACHE_KV",
"id": "<your-kv-namespace-id>"
}
],
"env": {
"production": {
"vars": {
"NEXT_PUBLIC_SITE_URL": "https://your-domain.com",
"NEXT_PUBLIC_BASE_URL": "https://your-domain.com",
"ENABLE_ADMIN": "false"
},
"kv_namespaces": [
{
"binding": "NEXT_INC_CACHE_KV",
"id": "<your-kv-namespace-id>"
}
]
}
}
}5. Deploy
# One-command build + deploy
pnpm run deploy:cfBuild pipeline: aggregate → next build → opennextjs-cloudflare build → wrangler deploy
6. Verify
curl -sI https://your-domain.com | grep x-nextjs-cache
# Expected: x-nextjs-cache: HIT (served from cache)7. Custom Domain
Go to Cloudflare Dashboard → Workers & Pages → your Worker → Settings → Domains & Routes → Add Domain.
Worker Custom Domains bypass the CDN cache layer. Caching is handled entirely by the KV mechanism.
8. GitHub Actions Auto-Deploy
The project supports automatic deployment when pushing to the main branch. Configure in your GitHub repo:
| Secret Name | Description |
|---|---|
CLOUDFLARE_API_TOKEN | Cloudflare API Token |
CLOUDFLARE_ACCOUNT_ID | Cloudflare Account ID |
Create an environment named CLOUDFLARE-DocsBlog-Prod (matches deploy.yml), then push to main to trigger auto-deploy.
For detailed configuration, see docs/deploy-cloudflare.md.
Vercel
Vercel is the official hosting platform for Next.js — zero configuration required.
1. Import Project
- Log in to the Vercel Dashboard
- Click Add New → Project
- Select your Git repository
- Framework Preset: Next.js (usually auto-detected)
- Click Deploy
2. Configure Environment Variables
In Vercel Dashboard → Project → Settings → Environment Variables:
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_SITE_URL | Yes | Production domain |
NEXT_PUBLIC_BASE_URL | Yes | Usually same as SITE_URL |
ENABLE_ADMIN | No | Set to false for production |
NEXT_PUBLIC_variables are injected at build time. Changes require redeployment.
3. Auto-Deploy
Once connected to a Git repo, every push to main triggers automatic deployment:
git push → Vercel builds (next build) → Deploy → Done4. Caching
Vercel natively supports Next.js ISR with no extra configuration:
- Set
revalidatein pages to enable ISR - Static pages are automatically cached on the Vercel Edge Network
5. Custom Domain
Dashboard → Project → Settings → Domains → Add your domain. Vercel auto-provisions SSL certificates.
6. Verify
curl -sI https://your-domain.com/ | grep -i x-vercel-cacheNotes
wrangler.jsoncandopen-next.config.tsare Cloudflare-specific files — Vercel ignores them automatically- Vercel Hobby (free) limits: 100GB bandwidth/month, 6000 build minutes/month
For detailed configuration, see docs/deploy-vercel.md.
Node.js Self-Host
Run with a standard Node.js server — suitable for VPS, cloud servers, intranet deployments, etc.
1. Prerequisites
- Node.js 18+ (20 LTS recommended)
- pnpm package manager
2. Build & Start
pnpm install
pnpm build
pnpm start:node
# Specify a custom port
PORT=8080 pnpm start:node3. Process Management (PM2)
npm install -g pm2
pm2 start pnpm --name docsblog -- start:node
pm2 startup && pm2 save4. Reverse Proxy
Nginx
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:3005;
proxy_http_version 1.1;
proxy_set_header Upgrade {'$http_upgrade'};
proxy_set_header Connection 'upgrade';
proxy_set_header Host {'$host'};
proxy_set_header X-Real-IP {'$remote_addr'};
proxy_set_header X-Forwarded-For {'$proxy_add_x_forwarded_for'};
proxy_set_header X-Forwarded-Proto {'$scheme'};
proxy_cache_bypass {'$http_upgrade'};
}
}Caddy
your-domain.com {
reverse_proxy 127.0.0.1:3005
}Caddy automatically provisions and renews SSL certificates.
5. Caching
Node.js deployment uses Next.js default filesystem caching:
- ISR pages cached in
.next/cache/directory - No KV or Redis configuration needed
Notes
wrangler.jsoncandopen-next.config.tsare Cloudflare-specific files — just ignore them- For HTTPS, configure through the reverse proxy (Nginx/Caddy), not at the Next.js layer
For detailed configuration, see docs/deploy-node.md.
Troubleshooting
| Problem | Solution |
|---|---|
Build fails: NEXT_PUBLIC_SITE_URL not set | Configure in environment variables or wrangler.jsonc |
pnpm-lock.yaml out of sync | Run pnpm install locally and commit the lockfile |
| Cloudflare KV cache not working | Verify KV ID in wrangler.jsonc is correct; first visit returning MISS is normal |
| Wrangler login fails | Run npx wrangler login to re-authorize |
| Vercel env vars not taking effect | NEXT_PUBLIC_ variables require redeployment after changes |
Platform Comparison
| Cloudflare Workers | Vercel | Node.js Self-Host | |
|---|---|---|---|
| Free Tier | 100K requests/day | 100GB bandwidth/month | Depends on server |
| Paid Starting | 5 USD/month | 20 USD/month/seat | Depends on server |
| Cold Start | Very fast (under 5ms) | Slower (hundreds of ms) | None (persistent process) |
| ISR Cache | KV + Regional Cache | Native support | Filesystem |
| Config Complexity | Medium | Very low | Medium |
| China Access | Has edge nodes | No edge nodes | Depends on server location |