Deployment Guide
DocsForge builds static HTML that can be deployed to any static hosting platform. This guide covers the most popular options.
Quick Comparison
| Platform | Cost | Custom Domain | HTTPS | CI/CD | Best For |
|---|---|---|---|---|---|
| GitHub Pages | Free | ✅ | ✅ | GitHub Actions | Open source projects |
| Netlify | Free tier | ✅ | ✅ | Git push | Prototyping, JAMstack |
| Vercel | Free tier | ✅ | ✅ | Git push | Next.js, fast deploys |
| Cloudflare Pages | Free | ✅ | ✅ | Git push | Speed, CDN |
| GitLab Pages | Free | ✅ | ✅ | GitLab CI | GitLab users |
| AWS S3 + CloudFront | Pay per use | ✅ | ✅ | GitHub Actions | Enterprise, scale |
| Firebase Hosting | Free tier | ✅ | ✅ | GitHub Actions | Google ecosystem |
| Surge.sh | Free | ✅ | ✅ | CLI | Quick deploys |
| Docker + Nginx | Server cost | ✅ | ✅ | Any | Self-hosted |
| Caddy | Server cost | ✅ | Auto | Any | Self-hosted, easy TLS |
GitHub Pages
The simplest option for open-source projects. Free, reliable, integrated with GitHub.
GitHub Actions (Recommended)
Create .github/workflows/docs.yml:
name: Deploy Docs
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install DocsForge
run: pip install docsforge
- name: Build docs
run: docsforge build
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
Settings
- Go to Settings → Pages
- Source: GitHub Actions
- Push the workflow file — your site deploys automatically
Custom Domain
- Add
CNAMEfile todocs/(orsite/after build):
docs.example.com - In repository settings: Pages → Custom domain
- Add DNS records:
docs.example.com→CNAME→yourusername.github.io
Netlify
Great for prototyping and JAMstack sites. Drag-and-drop or git-based deploys.
Method 1: Git-based (Recommended)
- Push your repo to GitHub/GitLab/Bitbucket
- Log in to Netlify
- Add new site → Import from Git
- Select your repository
- Build settings:
- Build command:
pip install docsforge && docsforge build - Publish directory:
site
- Deploy!
Method 2: CLI
# Install Netlify CLI
npm install -g netlify-cli
# Build your docs
docsforge build
# Deploy
netlify deploy --dir=site --prod
netlify.toml
[build]
command = "pip install docsforge && docsforge build"
publish = "site"
[[redirects]]
from = "/*"
to = "/404.html"
status = 404
Vercel
Fast deploys, great for frontend projects. Similar to Netlify.
Git-based
- Push to GitHub
- Log in to Vercel
- Add New Project → Import
- Framework preset: Other
- Build command:
pip install docsforge && docsforge build - Output directory:
site
vercel.json
{
"builds": [
{
"src": "docsforge.yml",
"use": "@vercel/static-build",
"config": {
"distDir": "site"
}
}
]
}
Cloudflare Pages
Fastest CDN, generous free tier. Great for global performance.
Git-based
- Push to GitHub/GitLab
- Log in to Cloudflare Dashboard
- Pages → Create a project
- Connect your git repository
- Build settings:
- Build command:
pip install docsforge && docsforge build - Build output directory:
site
- Deploy
Cloudflare Pages Functions
For custom headers or redirects, add _headers or _redirects to docs/:
# docs/_headers
/*.html
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
GitLab Pages
Integrated with GitLab CI. Great for GitLab users.
.gitlab-ci.yml
image: python:3.11
pages:
script:
- pip install docsforge
- docsforge build
artifacts:
paths:
- site
only:
- main
Your site will be at https://username.gitlab.io/projectname.
AWS S3 + CloudFront
Enterprise-grade hosting. Scales to any traffic level.
S3 Bucket Setup
- Create S3 bucket (e.g.,
docs.example.com) - Enable Static website hosting
- Upload your
site/directory:
aws s3 sync site/ s3://docs.example.com --delete - Set bucket policy to allow public read:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::docs.example.com/*" } ] }
CloudFront CDN
- Create CloudFront distribution
- Origin: Your S3 bucket
- Viewer protocol policy: Redirect HTTP to HTTPS
- Add custom domain in Alternate domain names
- Use AWS Certificate Manager for SSL
GitHub Actions + S3
- name: Deploy to S3
run: aws s3 sync site/ s3://docs.example.com --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Firebase Hosting
Part of Google Firebase. Good if you're already in the Google ecosystem.
Setup
# Install Firebase CLI
npm install -g firebase-tools
# Login
firebase login
# Init project
firebase init hosting
# Select "Configure as a single-page app?" → No
# Set public directory → site
# Build and deploy
docsforge build
firebase deploy
firebase.json
{
"hosting": {
"public": "site",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/404.html"
}
]
}
}
Surge.sh
Simplest possible deployment. Perfect for quick previews.
# Install Surge
npm install -g surge
# Build and deploy
docsforge build
surge site/ docs-example.surge.sh
# Custom domain
surge site/ docs.example.com
Docker + Nginx
Self-hosted option. Full control over the server.
Dockerfile
FROM python:3.11-slim AS builder
WORKDIR /app
COPY . /app
RUN pip install docsforge && docsforge build
FROM nginx:alpine
COPY --from=builder /app/site /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
nginx.conf
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
}
Build and Run
docker build -t my-docs .
docker run -p 8080:80 my-docs
Caddy
Modern, easy-to-configure web server with automatic HTTPS.
Caddyfile
docs.example.com {
root * /var/www/docs
file_server
try_files {path} {path}/ /404.html
}
Deploy
# Build docs
docsforge build
# Copy to server
rsync -avz site/ user@server:/var/www/docs/
# Start Caddy
caddy run --config Caddyfile
Caddy automatically provisions Let's Encrypt certificates. No manual SSL setup.
Platform-Specific Tips
GitHub Pages
- Use
site_url: https://username.github.io/repo-namein config - For user/org sites (
username.github.io), setsite_urlaccordingly - Enable "Enforce HTTPS" in repository settings
Netlify
- Add
_redirectsfile for SPA routing:
/* /404.html 404 - Use branch deploys for previewing PRs
Vercel
- Set
site_urlto your Vercel domain - Use
vercel --prodfor production deploys
Cloudflare Pages
- Enable "Always Use HTTPS"
- Use Cloudflare's caching for static assets
AWS S3
- Enable versioning if you want rollback capability
- Use
aws s3 sync --deleteto remove old files - Consider S3 Transfer Acceleration for global audiences
Continuous Deployment
Trigger Deploys on Every Push
All platforms support automatic deploys when you push to git. The general pattern:
- Build: Install DocsForge, build the site
- Deploy: Upload
site/to your host - Invalidate: Clear CDN cache (if using CDN)
Example: GitHub Actions + Any Platform
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install docsforge
- run: docsforge build
# Add your deploy step here
Troubleshooting
| Issue | Platform | Solution |
|---|---|---|
| 404 on refresh | SPA hosts | Configure fallback to index.html |
| CSS not loading | All | Check site_url matches actual domain |
| Search not working | All | Ensure search plugin is enabled |
| Build fails | CI/CD | Pin Python version, use pip install docsforge |
| Slow deploys | All | Use .gitignore to exclude large files |
| Cache issues | CDN | Add cache-busting query strings or purge CDN |
Next Steps
- Usage Guide — Day-to-day DocsForge usage
- Migration Guide — Moving from MkDocs/Material
- Changelog — What's new