A powerful, customizable wiki framework built with React and powered by GitHub. Create beautiful documentation sites with markdown, GitHub authentication, and automatic deployment.
- 📝 Markdown-Powered - Write content in GitHub Flavored Markdown with frontmatter
- 🎨 Modern UI - Clean, responsive design with dark mode support
- 🔍 Full-Text Search - Fast client-side search powered by Fuse.js (Phase 2)
- 🔐 GitHub Authentication - Secure OAuth login with GitHub (Phase 3)
- ✏️ Collaborative Editing - Edit pages via pull requests (Phase 4)
- 📜 Version History - Track changes with Git commit history (Phase 3)
- 🚀 Easy Deployment - Deploy to GitHub Pages with GitHub Actions
- ⚙️ Configuration-Driven - Customize via JSON configuration
- 🌙 Dark Mode - Built-in dark mode with system preference detection
- 📱 Responsive - Works great on mobile, tablet, and desktop
- Node.js 18+ and npm
- Git
- A GitHub account
- Clone the repository
git clone https://github.com/yourusername/wiki.git
cd wiki- Install dependencies
npm install- Configure your wiki
Edit public/wiki-config.json to customize your wiki:
{
"wiki": {
"title": "My Wiki",
"description": "My awesome documentation",
"repository": {
"owner": "yourusername",
"repo": "wiki",
"branch": "main"
}
},
"sections": [
{
"id": "getting-started",
"title": "Getting Started",
"path": "getting-started",
"showInHeader": true,
"allowContributions": true,
"order": 1
}
]
}- Start development server
npm run devVisit http://localhost:5173 to see your wiki!
wiki/
├── .github/
│ └── workflows/
│ └── deploy.yml # GitHub Actions deployment
├── public/
│ ├── wiki-config.json # Wiki configuration
│ └── content/ # Markdown content files
│ ├── getting-started/
│ ├── guides/
│ └── reference/
├── src/
│ ├── components/
│ │ ├── layout/ # Header, Sidebar, Footer, Layout
│ │ ├── wiki/ # PageViewer, PageEditor, etc.
│ │ ├── search/ # Search components
│ │ ├── auth/ # Authentication components
│ │ └── common/ # Reusable components
│ ├── hooks/ # Custom React hooks
│ │ ├── useWikiConfig.js # Configuration loader
│ │ ├── useAuth.js # Authentication
│ │ └── useSearch.js # Search functionality
│ ├── pages/ # Route pages
│ │ ├── HomePage.jsx
│ │ ├── PageViewerPage.jsx
│ │ └── SectionPage.jsx
│ ├── services/ # External services
│ │ ├── github/ # GitHub API integration
│ │ ├── markdown/ # Markdown processing
│ │ └── search/ # Search indexing
│ ├── store/ # State management (Zustand)
│ │ ├── authStore.js
│ │ ├── wikiStore.js
│ │ └── uiStore.js
│ ├── utils/ # Utility functions
│ ├── App.jsx # Root component
│ └── main.jsx # Entry point
├── vite.config.js
├── tailwind.config.js
└── package.json
Create a new file in public/content/{section}/:
public/content/getting-started/my-page.md
Every page needs YAML frontmatter:
---
title: My Page
description: A brief description
tags: [tag1, tag2]
category: Documentation
date: 2025-12-12
---
# My Page
Your content here...Navigate to /#/getting-started/my-page to view your page.
After creating or updating content, rebuild the search index:
npm run build:searchThis creates a search index at public/search-index.json that powers the search functionality.
- Quick Search - Press
Ctrl+K(orCmd+Kon Mac) anywhere to open the search modal - Search Page - Visit
/searchfor the full search experience with filters
- Fuzzy Search - Finds results even with typos
- Tag Filtering - Browse content by tags
- Real-time Results - See results as you type
- Keyboard Navigation - Use arrow keys and Enter to navigate results
Every page automatically generates a table of contents from markdown headings:
- Active Section Highlighting - The current section is highlighted as you scroll
- Smooth Scrolling - Click headings to jump to that section
- Desktop Only - TOC appears on the right side on large screens
Every page shows a breadcrumb trail at the top showing:
Home > Section > Page
Click any breadcrumb to navigate back up the hierarchy.
Edit public/wiki-config.json:
{
"wiki": {
"title": "Wiki Title",
"description": "Wiki description",
"logo": "/logo.svg",
"repository": {
"owner": "username",
"repo": "repo-name",
"branch": "main",
"contentPath": "public/content"
}
},
"sections": [...],
"features": {
"search": true,
"tableOfContents": true,
"pageHistory": true,
"editPages": true,
"darkMode": true,
"tags": true
},
"theme": {
"primaryColor": "#3b82f6"
}
}Create .env.local:
VITE_GITHUB_CLIENT_ID=your_github_oauth_client_id
VITE_GITHUB_REDIRECT_URI=https://yourusername.github.io/wiki/auth/callback
VITE_WIKI_REPO_OWNER=yourusername
VITE_WIKI_REPO_NAME=wikiThe wiki uses GitHub Device Flow for secure authentication without requiring a client secret in the frontend. This is perfect for static sites hosted on GitHub Pages!
-
Create a GitHub OAuth App
- Go to GitHub Settings → Developer settings → OAuth Apps
- Click "New OAuth App"
- Fill in:
- Application name: Your Wiki Name
- Homepage URL:
https://yourusername.github.io/wiki - Authorization callback URL:
https://yourusername.github.io/wiki(not used by Device Flow, but required)
- Click "Register application"
- Copy your Client ID
-
Configure Environment Variable
Add to
.env.local:VITE_GITHUB_CLIENT_ID=your_client_id_here
-
How It Works
- User clicks "Sign in with GitHub"
- Wiki displays a code (e.g.,
ABCD-1234) - User opens GitHub in a new tab and enters the code
- Once authorized, user is automatically signed in
- Token is encrypted and stored in localStorage
- Session persists across page reloads
- View Page History: See all commits for any page with author, date, and message
- User Profile: Your GitHub avatar and profile in the top right
- Edit Pages: Make changes and submit pull requests directly from the browser
- Contribution Tracking: All your edits are tracked and attributed to you
- No client secret needed (Device Flow)
- Tokens encrypted before localStorage
- Automatic token validation on load
- Secure API requests through Octokit
The wiki supports collaborative editing through GitHub pull requests! Here's how it works:
- Sign in with GitHub (see authentication section above)
- Navigate to any page in a section that allows contributions
- Click the "✏️ Edit" button at the top of the page
- Make your changes in the markdown editor
- Preview in real-time to see how it looks
- Add an edit summary (optional but recommended)
- Click "Save Changes" to create a pull request
- A new branch is created automatically (e.g.,
wiki-edit/section/page-timestamp) - Your changes are committed to this branch
- A pull request is created with your changes
- Maintainers review and merge your PR
- Once merged, your changes appear on the wiki
- CodeMirror 6: Professional-grade markdown editor
- Live Preview: See your changes in real-time
- Syntax Highlighting: Markdown syntax highlighting
- Dark Mode: Editor respects your theme preference
- Split View: Edit and preview side-by-side
- Character Count: Track content length
- Edit Summary: Add context for reviewers
- Editing is controlled per section via
allowContributionsinwiki-config.json - Only authenticated users can edit
- All edits require review via pull requests
- No direct commits to main branch
- Wiki checks if the page changed since you started editing
- If conflicts detected, you'll be warned
- You can choose to overwrite or cancel
- Helps prevent accidental overwrites
This wiki includes a complete GitHub Actions workflow for automatic deployment to GitHub Pages.
- Configure your repository settings in
vite.config.jsandpublic/wiki-config.json - Set up GitHub OAuth and add your Client ID to GitHub Secrets
- Enable GitHub Pages in repository settings (Source: GitHub Actions)
- Push to GitHub - deployment happens automatically!
See DEPLOYMENT.md for complete step-by-step deployment instructions, including:
- Configuring repository settings
- Setting up GitHub OAuth for authentication
- Enabling GitHub Pages
- Troubleshooting common issues
- Custom domain setup
- Performance optimization
The wiki will be automatically deployed on every push to the main branch via the included GitHub Actions workflow.
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Build search index
npm run build:search
# Lint code
npm run lint
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverageThe framework includes comprehensive tests for all serverless infrastructure:
# Run all tests
npm test
# Run tests in watch mode (auto-rerun on changes)
npm run test:watch
# Run tests with interactive UI
npm run test:ui
# Generate coverage report
npm run test:coveragetests/
├── serverless/
│ └── adapters/ # Platform abstraction tests
│ ├── PlatformAdapter.test.js (32 tests)
│ ├── ConfigAdapter.test.js (17 tests)
│ └── CryptoAdapter.test.js (30 tests)
├── helpers/ # Test utilities
│ └── adapterHelpers.js
└── mocks/ # API mocks
├── externalApis.js
└── octokit.js
Current test coverage for serverless code:
- PlatformAdapter: 86.66%
- ConfigAdapter: 90.9%
- CryptoAdapter: 100%
- Overall Adapters: 91%+ ✅
Tests run automatically on:
- Every push to
mainordev - Every pull request
- Manual workflow trigger
See .github/CI.md for CI/CD documentation.
The wiki includes a powerful Developer Tools Panel for debugging:
Press Ctrl+Shift+D or click the "🛠️ Dev Tools" button in the bottom-right corner.
- Live Error Tracking: See all errors and warnings in real-time
- Console Logs: Captures all
console.log(),console.error(), etc. - Filter by Type: View All, Errors, Warnings, Info, or Success messages
- Export Logs: Download logs as a text file
- Persistent Logging: Logs are saved to
logs/debug.logfor easy access
All logs are automatically written to:
logs/debug.log
This allows AI assistants (like Claude) to read logs directly without you needing to copy/paste them.
Example usage:
User: "Read the logs"
Claude: *reads logs/debug.log and analyzes errors*
Ctrl+Shift+D- Toggle Developer Tools PanelCtrl+K- Open Search (Quick Search)
- Clear Panel: Removes logs from the UI panel
- Clear File: Erases
logs/debug.logon disk
See logs/README.md for more details about logging.
- Framework: React 18
- Build Tool: Vite 5
- Styling: Tailwind CSS 3
- Routing: React Router v6 (hash-based)
- State Management: Zustand
- Markdown: react-markdown with remark/rehype plugins
- Code Editor: CodeMirror 6
- Search: Fuse.js
- GitHub API: Octokit.js
- Project setup and configuration
- Basic layout and navigation
- Markdown rendering with syntax highlighting
- Dark mode support
- Full-text search with Fuse.js
- Table of contents generation with active section highlighting
- Tag filtering and browsing
- Breadcrumb navigation
- Keyboard shortcuts (Ctrl+K for search)
- Search page with filters
- GitHub OAuth Device Flow authentication (no client secret needed!)
- User profile with avatar dropdown menu
- Page commit history from Git
- GitHub API integration with Octokit
- Rate limiting and error handling
- Secure token storage with encryption
- CodeMirror 6 markdown editor with syntax highlighting
- Live preview pane with real-time rendering
- Automatic branch creation for each edit
- Pull request generation with details
- Edit permissions checking per section
- Conflict detection and warnings
- Edit summary support
- GitHub Actions workflow for automatic deployment
- Code splitting and bundle optimization
- Error boundaries for graceful error handling
- Toast notification system for user feedback
- Enhanced 404 page with navigation
- Comprehensive deployment documentation
- Performance optimization with lazy loading
- Template repository
- CLI tool for project creation
- Plugin architecture
- Edit
public/wiki-config.json:
{
"sections": [
{
"id": "my-section",
"title": "My Section",
"path": "my-section",
"showInHeader": true,
"allowContributions": true,
"order": 4
}
]
}- Create content directory:
mkdir public/content/my-section- Add an index page:
echo "# My Section" > public/content/my-section/index.mdEdit tailwind.config.js to customize colors, fonts, and more.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - feel free to use this project for your own wikis!
- Built with React
- Styled with Tailwind CSS
- Markdown powered by react-markdown
- Search by Fuse.js
- Hosted on GitHub Pages
Made with ❤️ using GitHub Wiki Framework