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
Option 1: Git Submodules (Recommended)
Setup:
- Create new repo:
FishingLog.Documentation - 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 - Docusaurus reads from submodule directories
- 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:
- Docusaurus repo with GitHub Actions workflow
- 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 - Builds Docusaurus site
- 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:
- Use
docusaurus-plugin-content-docswith multiple sources - Configure multiple doc directories
- 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:
- Deploy to Cloudflare Pages
- Settings → Access → Password Protection
- Set password
- Done!
Pros:
- ✅ One-click setup
- ✅ Free
- ✅ Works immediately
Cons:
- ⚠️ Single password (no user management)
Option 2: Cloudflare Access (Free Tier)
Setup:
- Deploy to Cloudflare Pages
- Enable Cloudflare Access
- Configure access policies
- 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:
- Install
@docusaurus/plugin-google-analyticsor custom auth - Add authentication middleware
- Protect routes
Pros:
- ✅ Full control
- ✅ Customizable
Cons:
- ⚠️ More complex
- ⚠️ Need to maintain auth
Benefits of Unified Approach
✅ Advantages
-
Single Source of Truth
- One place for all documentation
- Consistent navigation
- Unified search
-
Better Organization
- Clear separation by project
- Cross-references between projects
- Shared components/themes
-
Easier Maintenance
- One deployment pipeline
- One password to share
- One site to maintain
-
Professional
- Looks more polished
- Better for team onboarding
- Easier to share with stakeholders
-
Future-Proof
- Easy to add new projects
- Scales well
- Standard pattern
⚠️ Considerations
-
Complexity
- More moving parts
- Submodule management
- CI/CD complexity
-
Update Workflow
- Need to update submodules
- CI needs to handle multiple repos
- More potential failure points
-
Initial Setup
- More time to set up
- Need to migrate existing docs
- Learning curve
Comparison: Docusaurus vs MkDocs
| Feature | Docusaurus | MkDocs |
|---|---|---|
| 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:
- Better for multi-repo - Native support for multiple doc sources
- More professional - Better UI/UX than MkDocs
- Cloudflare Pages - Fast CDN, free, password protection
- Future-proof - Easy to add mobile/web/admin docs
- Password protection - Netlify makes it easy
- Better organization - Unified navigation, search, themes
Implementation Plan
-
Phase 1: Setup (1-2 hours)
- Create
FishingLog.Documentationrepo - Initialize Docusaurus
- Add backend as submodule
- Configure basic structure
- Create
-
Phase 2: Migration (2-3 hours)
- Migrate existing docs structure
- Set up navigation
- Configure search
- Test locally
-
Phase 3: Deployment (1 hour)
- Set up Netlify
- Configure password protection
- Set up CI/CD
- Deploy
-
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:
- Set up the Docusaurus structure - Create config, add submodules
- Migrate existing docs - Convert MkDocs structure to Docusaurus
- Set up deployment - Cloudflare Pages with password protection
- Create migration guide - Step-by-step instructions
This is a solid approach that will scale well as you add more projects!