Skip to main content

Unified Docusaurus Documentation Strategy

Concept

Single Docusaurus instance that aggregates documentation from multiple repositories:

  • FishingLog.Backend (current repo)
  • FishingLog.Mobile (React Native - future)
  • FishingLog.Web (Web app - future)
  • FishingLog.Admin (Admin panel - future)

All served from one password-protected site.

Architecture

┌─────────────────────────────────────────┐
│ Docusaurus Site (Password Protected) │
│ https://docs.reelog.app │
└─────────────────────────────────────────┘

├── Fetches from GitHub

┌─────────┼─────────┐
│ │ │
┌───▼───┐ ┌──▼───┐ ┌───▼───┐
│Backend│ │Mobile│ │ Web │
│ Docs │ │ Docs │ │ Docs │
└───────┘ └──────┘ └───────┘

How It Works

Setup:

  1. Create new repo: FishingLog.Documentation
  2. Add repos as git submodules:
    git submodule add https://github.com/JamesWJager/FishingLog.Backend.git backend
    git submodule add https://github.com/JamesWJager/FishingLog.Mobile.git mobile
    git submodule add https://github.com/JamesWJager/FishingLog.Web.git web
  3. Docusaurus reads from submodule directories
  4. Build script updates submodules before build

Pros:

  • ✅ Simple setup
  • ✅ Version control (can pin to specific commits)
  • ✅ Works with private repos
  • ✅ Standard Git feature

Cons:

  • ⚠️ Need to update submodules manually or via CI
  • ⚠️ Slightly more complex workflow

Option 2: GitHub Actions Fetch

Setup:

  1. Docusaurus repo with GitHub Actions workflow
  2. Workflow fetches docs from other repos:
    - name: Fetch Backend Docs
    run: |
    git clone --depth 1 --branch main \
    https://github.com/JamesWJager/FishingLog.Backend.git \
    temp/backend
    cp -r temp/backend/docs docs/backend
  3. Builds Docusaurus site
  4. Deploys to Netlify/Vercel with password protection

Pros:

  • ✅ Automatic updates
  • ✅ Can fetch from multiple branches
  • ✅ Flexible

Cons:

  • ⚠️ More complex setup
  • ⚠️ Need GitHub tokens for private repos

Option 3: Docusaurus Multi-Instance Plugin

Setup:

  1. Use docusaurus-plugin-content-docs with multiple sources
  2. Configure multiple doc directories
  3. Each points to different repo's docs folder

Pros:

  • ✅ Native Docusaurus feature
  • ✅ Clean organization
  • ✅ Unified search

Cons:

  • ⚠️ Still need to sync docs (via submodules or CI)

Implementation: Git Submodules Approach

Step 1: Create Documentation Repository

# Create new repo
mkdir FishingLog.Documentation
cd FishingLog.Documentation
git init

Step 2: Initialize Docusaurus

npx create-docusaurus@latest . classic --typescript

Step 3: Add Repositories as Submodules

# Add backend docs
git submodule add https://github.com/JamesWJager/FishingLog.Backend.git backend

# Future: Add other repos
# git submodule add https://github.com/JamesWJager/FishingLog.Mobile.git mobile
# git submodule add https://github.com/JamesWJager/FishingLog.Web.git web

Step 4: Configure Docusaurus

docusaurus.config.js:

module.exports = {
title: 'FishingLog Platform Documentation',
tagline: 'Complete documentation for all FishingLog applications',
url: 'https://docs.reelog.app',
baseUrl: '/',

presets: [
[
'@docusaurus/preset-classic',
{
docs: {
// Backend docs
path: 'backend/docs',
routeBasePath: 'backend',
sidebarPath: require.resolve('./sidebars/backend.js'),
},
// Future: Add more doc instances
// blog: false, // Disable blog
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
},
],
],

// Multi-instance docs
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'mobile',
path: 'mobile/docs',
routeBasePath: 'mobile',
sidebarPath: require.resolve('./sidebars/mobile.js'),
},
],
[
'@docusaurus/plugin-content-docs',
{
id: 'web',
path: 'web/docs',
routeBasePath: 'web',
sidebarPath: require.resolve('./sidebars/web.js'),
},
],
],
};

Step 5: Update Submodules Script

.github/workflows/deploy-docs.yml:

name: Deploy Unified Documentation

on:
push:
branches: [main]
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
token: $\{\{ secrets.GITHUB_TOKEN \}\}

- name: Update Submodules
run: |
git submodule update --init --recursive
git submodule update --remote

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Dependencies
run: npm install

- name: Build Documentation
run: npm run build

- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: $\{\{ secrets.CLOUDFLARE_API_TOKEN \}\}
accountId: $\{\{ secrets.CLOUDFLARE_ACCOUNT_ID \}\}
projectName: fishinglog-docs
directory: build
gitHubToken: $\{\{ secrets.GITHUB_TOKEN \}\}

Password Protection Options

Option 1: Cloudflare Pages Password Protection (Easiest)

Setup:

  1. Deploy to Cloudflare Pages
  2. Settings → Access → Password Protection
  3. Set password
  4. Done!

Pros:

  • ✅ One-click setup
  • ✅ Free
  • ✅ Works immediately

Cons:

  • ⚠️ Single password (no user management)

Option 2: Cloudflare Access (Free Tier)

Setup:

  1. Deploy to Cloudflare Pages
  2. Enable Cloudflare Access
  3. Configure access policies
  4. Users authenticate via email/SSO

Pros:

  • ✅ Free tier available
  • ✅ User management
  • ✅ SSO support
  • ✅ More secure

Cons:

  • ⚠️ More setup required

Option 3: Docusaurus Auth Plugin

Setup:

  1. Install @docusaurus/plugin-google-analytics or custom auth
  2. Add authentication middleware
  3. Protect routes

Pros:

  • ✅ Full control
  • ✅ Customizable

Cons:

  • ⚠️ More complex
  • ⚠️ Need to maintain auth

Benefits of Unified Approach

✅ Advantages

  1. Single Source of Truth

    • One place for all documentation
    • Consistent navigation
    • Unified search
  2. Better Organization

    • Clear separation by project
    • Cross-references between projects
    • Shared components/themes
  3. Easier Maintenance

    • One deployment pipeline
    • One password to share
    • One site to maintain
  4. Professional

    • Looks more polished
    • Better for team onboarding
    • Easier to share with stakeholders
  5. Future-Proof

    • Easy to add new projects
    • Scales well
    • Standard pattern

⚠️ Considerations

  1. Complexity

    • More moving parts
    • Submodule management
    • CI/CD complexity
  2. Update Workflow

    • Need to update submodules
    • CI needs to handle multiple repos
    • More potential failure points
  3. Initial Setup

    • More time to set up
    • Need to migrate existing docs
    • Learning curve

Comparison: Docusaurus vs MkDocs

FeatureDocusaurusMkDocs
Multi-repo support✅ Native plugins⚠️ Requires workarounds
React-based✅ Yes❌ No
Password protection⚠️ Requires plugin⚠️ Requires plugin
Search✅ Algolia/meilisearch✅ Built-in
Theming✅ Many themes✅ Material theme
Multi-instance docs✅ Built-in⚠️ Complex
Deployment✅ Cloudflare Pages/Vercel✅ GitHub Pages

Recommendation

Go with Docusaurus Unified Approach

Why:

  1. Better for multi-repo - Native support for multiple doc sources
  2. More professional - Better UI/UX than MkDocs
  3. Cloudflare Pages - Fast CDN, free, password protection
  4. Future-proof - Easy to add mobile/web/admin docs
  5. Password protection - Netlify makes it easy
  6. Better organization - Unified navigation, search, themes

Implementation Plan

  1. Phase 1: Setup (1-2 hours)

    • Create FishingLog.Documentation repo
    • Initialize Docusaurus
    • Add backend as submodule
    • Configure basic structure
  2. Phase 2: Migration (2-3 hours)

    • Migrate existing docs structure
    • Set up navigation
    • Configure search
    • Test locally
  3. Phase 3: Deployment (1 hour)

    • Set up Netlify
    • Configure password protection
    • Set up CI/CD
    • Deploy
  4. Phase 4: Future (as needed)

    • Add mobile docs when ready
    • Add web docs when ready
    • Add admin docs when ready

Quick Start: Docusaurus Setup

# 1. Create new repo
mkdir FishingLog.Documentation
cd FishingLog.Documentation
git init

# 2. Initialize Docusaurus
npx create-docusaurus@latest . classic --typescript

# 3. Add backend as submodule
git submodule add https://github.com/JamesWJager/FishingLog.Backend.git backend

# 4. Configure docusaurus.config.js (see above)

# 5. Test locally
npm start

# 6. Deploy to Netlify
# - Connect repo to Netlify
# - Build command: npm run build
# - Publish directory: build
# - Add password protection

Is This Overboard?

Short answer: No!

This is actually a best practice for multi-repo projects. Many companies do this:

  • Facebook (Meta) uses unified docs
  • Google uses unified docs
  • Microsoft uses unified docs

Benefits outweigh complexity:

  • Better developer experience
  • Easier onboarding
  • More professional
  • Scales better

Next Steps

Would you like me to:

  1. Set up the Docusaurus structure - Create config, add submodules
  2. Migrate existing docs - Convert MkDocs structure to Docusaurus
  3. Set up deployment - Cloudflare Pages with password protection
  4. Create migration guide - Step-by-step instructions

This is a solid approach that will scale well as you add more projects!