Documentation Deployment
How to deploy the Sprout documentation site.
Overview
The documentation is built with Docusaurus and can be deployed as a static site to Cloudflare Pages.
Prerequisites
- Cloudflare account
- Git repository access
- Cloudflare Pages access
Local Build
Before deploying, test the build locally:
cd /Users/stef/apps/sprout/sprout_docs
# Install dependencies
bun install
# Build the site
bun run build
# Preview the build
bun run serve
The build output will be in the build/ directory.
Cloudflare Pages Deployment
Quick Deploy
The easiest way to deploy:
# Build and deploy
bun run deploy
First time setup:
- Authenticate with Cloudflare:
bunx wrangler login - Create the Pages project (if it doesn't exist):
bunx wrangler pages project create sprout-docs - Deploy:
bun run deploy
Option 1: Automatic Deployment via Git
-
Connect Repository:
- Go to Cloudflare Dashboard → Pages
- Click "Create a project"
- Connect your Git repository
- Select the
sprout_docsdirectory
-
Build Settings:
- Framework preset: Docusaurus
- Build command:
bun install && bun run build - Build output directory:
build - Root directory:
/sprout_docs(if in monorepo)
-
Environment Variables (if needed):
- Add any required environment variables
- Most Docusaurus configs don't need env vars
-
Deploy:
- Cloudflare will automatically deploy on push to main/master
- Or trigger manual deployment from dashboard
Option 2: Manual Deployment via Wrangler
The project is configured with wrangler.toml.
Deploy command:
bun run deploy
This runs:
bun run build- Builds the Docusaurus sitebunx wrangler pages deploy build --project-name=sprout-docs- Deploys to Cloudflare Pages
Manual steps (if needed):
# Build
bun run build
# Deploy
bunx wrangler pages deploy build --project-name=sprout-docs
Authentication: First time, you'll need to login:
bunx wrangler login
Option 3: GitHub Actions
Create .github/workflows/deploy-docs.yml:
name: Deploy Docs
on:
push:
branches:
- main
paths:
- 'sprout_docs/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
working-directory: sprout_docs
run: bun install
- name: Build
working-directory: sprout_docs
run: bun run build
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: sprout-docs
directory: sprout_docs/build
Custom Domain
-
Add Custom Domain in Cloudflare:
- Go to Pages project settings
- Add custom domain (e.g.,
docs.sproutproperties.co) - Follow DNS setup instructions
-
Update Docusaurus Config: Update
docusaurus.config.ts:url: 'https://docs.sproutproperties.co',
baseUrl: '/',
Build Configuration
Build Settings
The build process:
- Installs dependencies with
bun install - Builds TypeScript and React with
bun run build - Outputs static files to
build/directory
Build Optimization
Docusaurus automatically:
- Optimizes images
- Minifies JavaScript and CSS
- Generates sitemap
- Creates search index
Continuous Deployment
Automatic Deployments
- On push to main: Automatic deployment
- On pull requests: Preview deployments (optional)
Preview Deployments
Cloudflare Pages creates preview deployments for PRs:
- Unique URL per PR
- Allows review before merge
- Automatically cleaned up after PR close
Troubleshooting
Build Fails
- Check build logs in Cloudflare dashboard
- Test locally first:
bun run build - Verify dependencies are installed correctly
Missing Files
- Check build output directory
- Verify static files are in
static/directory - Check file paths in documentation
Search Not Working
- Verify search plugin is configured
- Check build includes search index
- Wait for indexing (may take a few minutes)
Manual Updates
To update documentation:
- Make changes to markdown files
- Commit and push to repository
- Cloudflare automatically rebuilds and deploys
- Changes go live in 1-2 minutes
Backup
Documentation is version-controlled in Git, so:
- All changes are tracked
- Can rollback via Git
- No separate backup needed
Performance
Cloudflare Pages provides:
- Global CDN distribution
- Automatic HTTPS
- Fast page loads
- Free SSL certificates
Next Steps
- Getting Started - Documentation overview
- Development - Local development