Skip to content

๐Ÿš€ Quick Start: Deploy Docs to Subdomain โ€‹

Goal: Get documentation deployed to docs.ourlantern.app and docs.dev.ourlantern.app

Time: ~10 minutes

Method: Cloudflare Pages automatic Git integration (same as main app deployment)


Why No API Keys Needed? โ€‹

Just like how you set up ourlantern.app and dev.ourlantern.app, the docs use Cloudflare's automatic Git integration. You connect your repo once in the Cloudflare dashboard, and it automatically deploys on every push. No GitHub Actions, no API tokens, no secrets needed!


Step 1: Create Production Docs Project (3 min) โ€‹

  1. Go to Cloudflare Dashboard
  2. Click Workers & Pages โ†’ Pages โ†’ Create a project
  3. Click Connect to Git
  4. Select cattreedev/lantern_app (same repo as your main app)
  5. Fill in:
    Project name:         lantern-docs
    Production branch:    main
    Build command:        npm run docs:build
    Build output dir:     docs/.vitepress/dist
  6. Click Save and Deploy

โœ… Checkpoint: Project lantern-docs created


Step 2: Create Development Docs Project (3 min) โ€‹

  1. Click Create a project again
  2. Click Connect to Git
  3. Select same repo cattreedev/lantern_app
  4. Fill in:
    Project name:         lantern-docs-dev
    Production branch:    dev              โ† IMPORTANT: dev not main!
    Build command:        npm run docs:build
    Build output dir:     docs/.vitepress/dist
  5. Click Save and Deploy

โœ… Checkpoint: Project lantern-docs-dev created


Step 3: Add Custom Domains (4 min) โ€‹

For lantern-docs (production) โ€‹

  1. Open lantern-docs project in Cloudflare
  2. Go to Settings โ†’ Domains & accounts
  3. Click Set up a custom domain
  4. Enter: docs.ourlantern.app
  5. Click Continue
  6. Cloudflare auto-creates DNS records

For lantern-docs-dev (development) โ€‹

  1. Open lantern-docs-dev project
  2. Go to Settings โ†’ Domains & accounts
  3. Click Set up a custom domain
  4. Enter: docs.dev.ourlantern.app
  5. Click Continue
  6. Cloudflare auto-creates DNS records

โœ… Checkpoint: Both domains configured


Done! ๐ŸŽ‰ โ€‹

Your documentation is now set up for automatic deployment!

What Happens Now? โ€‹

Every time you push to dev:

  • Cloudflare automatically detects the push
  • Builds docs with npm run docs:build
  • Deploys to docs.dev.ourlantern.app in ~2-3 minutes

Every time you push to main:

  • Same automatic process
  • Deploys to docs.ourlantern.app in ~2-3 minutes

Every time you open a PR:

  • Cloudflare creates a preview deployment
  • Preview URL appears in the PR (like abc123.lantern-docs-dev.pages.dev)

It works exactly like your main app deployment! No manual steps, no API keys, completely automatic.


Verify It's Working โ€‹

  1. Make a small change to any doc file:

    bash
    echo "\nTest update" >> docs/README.md
    git add docs/README.md
    git commit -m "test: Trigger docs deployment"
    git push origin dev
  2. Go to Cloudflare Dashboard โ†’ Pages โ†’ lantern-docs-dev

  3. Watch the deployment in the Deployments tab (~2-3 min)

  4. Visit https://docs.dev.ourlantern.app

  5. Hard refresh (Ctrl+Shift+R) to see your changes

โœ… Success! Your docs are now auto-deploying.


Troubleshooting โ€‹

Build fails โ€‹

โ†’ Check Cloudflare Pages deployment logs in the dashboard
โ†’ Common issue: Node version (should auto-detect Node 20 from package.json)

Docs don't update โ€‹

โ†’ Hard refresh browser (Ctrl+Shift+R or Cmd+Shift+R)
โ†’ Check deployment succeeded in Cloudflare dashboard

Domain not resolving โ€‹

โ†’ Wait 5 minutes for DNS propagation
โ†’ Check DNS records in Cloudflare dashboard


Next Steps โ€‹

  1. Test it - Push a small change to dev and watch it deploy
  2. Verify - Visit docs.dev.ourlantern.app and see your changes
  3. Deploy to prod - Merge to main when ready

Questions? See CLOUDFLARE_DOCS_SETUP.md for detailed instructions.

Built with VitePress