Skip to content

KEY60228/cloudflare-mdbook-hono

Repository files navigation

cloudflare-mdbook-hono

A scaffold project for hosting mdBook on Cloudflare Workers with OIDC authentication. Only authenticated users can access your documentation.

Prerequisites

Setup

1. Clone the repository

git clone https://github.com/KEY60228/cloudflare-mdbook-hono.git
cd cloudflare-mdbook-hono
npm install

2. Configure wrangler.jsonc

Update the CALLBACK_URL in wrangler.jsonc to match your Worker URL:

{
  "vars": {
    "CALLBACK_URL": "https://your-worker-name.your-subdomain.workers.dev/auth/callback"
  }
}

3. Set Cloudflare Secrets

Configure your OIDC provider credentials:

npx wrangler secret put ISSUER
# Enter your OIDC issuer URL (e.g., https://accounts.google.com)

npx wrangler secret put CLIENT_ID
# Enter your OIDC client ID

4. Set GitHub Secrets (for CI/CD)

Add the following secrets to your GitHub repository (Settings > Secrets and variables > Actions):

Secret Description
CLOUDFLARE_API_TOKEN Cloudflare API token with Workers edit permission
CLOUDFLARE_ACCOUNT_ID Your Cloudflare account ID

5. Customize your content

Edit the mdBook source files in mdbook/src/:

  • SUMMARY.md - Table of contents
  • chapter_1.md - Your content (add more chapters as needed)

Refer to the mdBook documentation for more details.

Deploy

Manual deployment

cd mdbook && mdbook build && cd ..
npm run deploy

Automatic deployment

Push to the main branch to trigger automatic deployment via GitHub Actions.

About

mdBook with Hono hosted on Cloudflare

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published