Deploying Docs to Cloudflare Pages
Why Cloudflare Pages?
- ✅ Free deployment
- ✅ Free authentication (Cloudflare Access)
- ✅ Fast global CDN
- ✅ Auto-deploy on git push
Setup Instructions
1. Push Your Code to GitHub
git push origin master
2. Sign Up / Log In to Cloudflare
- Go to dash.cloudflare.com
- Sign up or log in
- Go to Workers & Pages in the sidebar
3. Create a New Pages Project
- Click "Create application" → "Pages" → "Connect to Git"
- Connect your GitHub account (jophillips90)
- Select the
sanctumrepository - Click "Begin setup"
4. Configure Build Settings
Production branch: master
Build settings:
- Framework preset: None (we'll configure manually)
- Build command:
cd docs && pnpm build - Build output directory:
docs/build - Root directory:
/(leave empty or set to root)
Environment variables:
NODE_VERSION:20
5. Deploy
Click "Save and Deploy"
Cloudflare will:
- Install dependencies
- Build the docs
- Deploy to
sanctum-docs.pages.dev
⏱️ Takes about 2-3 minutes
🔐 Add Authentication (Free!)
Enable Cloudflare Access
- Go to Zero Trust in Cloudflare dashboard
- Navigate to Access → Applications
- Click "Add an application" → "Self-hosted"
Configuration:
- Application name: Sanctum Docs
- Session duration: 24 hours (or your preference)
- Application domain:
sanctum-docs.pages.dev
Add Access Policy
Policy name: Email verification
Action: Allow
Configure rules:
- Selector: Emails
- Value: Your email addresses (comma-separated)
Example: you@example.com, collaborator@example.com
Or use email domain:
- Selector: Emails ending in
- Value:
@yourdomain.com
Save and Test
- Click "Add application"
- Visit your docs site
- You'll be prompted to verify your email
- Check your email for the login code
- Enter code → Access granted!
🔄 Auto-Deploy
Every push to master automatically deploys:
git add docs/
git commit -m "docs: update API reference"
git push
# → Cloudflare auto-deploys in ~2 minutes
📧 Managing Access
Add More Users
Go to Zero Trust → Access → Your application → Edit
Add more emails to the policy.
Revoke Access
Remove emails from the policy or disable the application.
Access Logs
View who accessed your docs: Zero Trust → Logs → Access
💰 Cost
100% FREE for:
- Up to 50 users
- Unlimited deployments
- Email authentication
- Global CDN
🎯 Result
Your documentation will be:
- ✅ Deployed globally
- ✅ Protected by email authentication
- ✅ Auto-updated on every push
- ✅ Completely free
Only people with verified emails can access it!