Skip to content

Cloudflare Setup Checklist for Docs Subdomain โ€‹

Complete this checklist to set up the documentation subdomain deployment using Cloudflare's automatic Git integration (same method as your main app).

Prerequisites โ€‹

  • [ ] Cloudflare account with ourlantern.app domain
  • [ ] Admin access to cattreedev/lantern_app GitHub repository
  • [ ] 10 minutes of time

No API tokens or GitHub secrets needed! This uses the same automatic Git integration as your main app deployment.


Step 1: Create Production Docs Project โ€‹

  1. Go to Cloudflare Dashboard
  2. Navigate to Workers & Pages โ†’ Pages
  3. Click Create a project
  4. Click Connect to Git
  5. Select your GitHub account and repository: cattreedev/lantern_app
  6. Configure the project:
    • Project name: lantern-docs
    • Production branch: main
    • Build command: npm run docs:build
    • Build output directory: docs/.vitepress/dist
    • Root directory: (leave empty)
  7. Click Save and Deploy

Checkpoint: โœ… Production project created and connected to GitHub


Step 2: Create Development Docs Project โ€‹

  1. Go back to Workers & Pages โ†’ Pages
  2. Click Create a project again
  3. Click Connect to Git
  4. Select the same repository: cattreedev/lantern_app
  5. Configure the project:
    • Project name: lantern-docs-dev
    • Production branch: dev โš ๏ธ (NOT main!)
    • Build command: npm run docs:build
    • Build output directory: docs/.vitepress/dist
    • Root directory: (leave empty)
  6. Click Save and Deploy

Checkpoint: โœ… Development project created


Step 3: Add Custom Domains โ€‹

Production Domain โ€‹

  1. Open the lantern-docs project
  2. Go to Settings tab
  3. Click Domains & accounts in the sidebar
  4. Click Set up a custom domain
  5. Enter: docs.ourlantern.app
  6. Click Continue
  7. Cloudflare will automatically create DNS records

Checkpoint: โœ… docs.ourlantern.app domain configured

Development Domain โ€‹

  1. Open the lantern-docs-dev project
  2. Go to Settings tab
  3. Click Domains & accounts
  4. Click Set up a custom domain
  5. Enter: docs.dev.ourlantern.app
  6. Click Continue

Checkpoint: โœ… docs.dev.ourlantern.app domain configured


Step 4: Verify DNS Records โ€‹

  1. Go to Cloudflare Dashboard โ†’ Select your ourlantern.app zone
  2. Click DNS โ†’ Records
  3. Verify these CNAME records exist (Cloudflare created them automatically):
Type    Name      Target                         Proxy Status
CNAME   docs      lantern-docs.pages.dev         Proxied (orange)
CNAME   docs      lantern-docs-dev.pages.dev     Proxied (orange)  [Note: should be "docs.dev"]

Note: The second record should have name "docs.dev" not "docs-dev". The domain setup in Step 3 handles this correctly.

Checkpoint: โœ… DNS records verified


Step 5: Test the Deployment โ€‹

Test Dev Deployment โ€‹

  1. Make a small change to any file in docs/ (e.g., add a space to a markdown file)
  2. Commit and push to dev branch:
    bash
    git add docs/
    git commit -m "test: Trigger docs deployment"
    git push origin dev
  3. Go to Cloudflare Dashboard โ†’ Pages โ†’ lantern-docs-dev
  4. Watch the Deployments tab (should start building within seconds)
  5. After ~2-3 minutes, visit https://docs.dev.ourlantern.app

Expected result: Docs site loads successfully

Checkpoint: โœ… Dev deployment working

Test Production Deployment โ€‹

  1. Merge your changes to main:
    bash
    git checkout main
    git merge dev
    git push origin main
  2. Watch Cloudflare Dashboard โ†’ Pages โ†’ lantern-docs
  3. Visit https://docs.ourlantern.app

Expected result: Production docs site loads

Checkpoint: โœ… Production deployment working


How It Works โ€‹

Automatic Deployment:

  • Cloudflare monitors your GitHub repository
  • When you push to main or dev, Cloudflare automatically:
    1. Detects the push
    2. Runs npm run docs:build
    3. Deploys the built files to the appropriate subdomain
    4. Updates the site in ~2-3 minutes

No manual steps needed! It works exactly like your main app deployment at ourlantern.app and dev.ourlantern.app.


Troubleshooting โ€‹

Build Fails โ€‹

Problem: Deployment fails in Cloudflare

Solution:

  1. Check Cloudflare Pages deployment logs
  2. Common issues:
    • Node version mismatch (should auto-detect from package.json)
    • Missing dependencies (should auto-install)
    • Build output directory incorrect (should be docs/.vitepress/dist)

DNS Not Resolving โ€‹

Problem: docs.ourlantern.app shows "This site can't be reached"

Solution:

  1. Check DNS records in Cloudflare dashboard
  2. Ensure CNAME is proxied (orange cloud)
  3. Wait 5 minutes for propagation
  4. Try nslookup docs.ourlantern.app

Changes Not Appearing โ€‹

Problem: Pushed changes but site looks the same

Solution:

  1. Hard refresh browser (Ctrl+Shift+R or Cmd+Shift+R)
  2. Check Cloudflare Pages to ensure deployment succeeded
  3. Verify you pushed to the correct branch (dev vs main)

Wrong Environment Deployed โ€‹

Problem: docs.dev.ourlantern.app shows production content

Solution:

  1. Verify lantern-docs-dev project is connected to dev branch
  2. Check Pages project settings in Cloudflare
  3. Ensure you pushed to dev branch, not main

Success Criteria โ€‹

You're done when all these are true:

  • โœ… lantern-docs Cloudflare Pages project exists
  • โœ… lantern-docs-dev Cloudflare Pages project exists
  • โœ… Both projects are connected to GitHub (automatic Git integration)
  • โœ… docs.ourlantern.app domain is configured and working
  • โœ… docs.dev.ourlantern.app domain is configured and working
  • โœ… Pushing to dev auto-deploys to dev subdomain
  • โœ… Pushing to main auto-deploys to production subdomain
  • โœ… Documentation site is accessible at both URLs

What Happens Now? โ€‹

On every push to dev:

  • Cloudflare automatically builds and deploys to docs.dev.ourlantern.app in ~2-3 min
  • No manual steps required

On every push to main:

  • Cloudflare automatically builds and deploys to docs.ourlantern.app in ~2-3 min
  • No manual steps required

On pull requests:

  • Cloudflare creates preview deployments automatically
  • Preview URL appears in the PR (e.g., abc123.lantern-docs-dev.pages.dev)
  • Test docs changes before merging

It's completely automatic, just like your main app!



Last updated: 2026-01-10

Built with VitePress