An open API service indexing awesome lists of open source software.

https://github.com/steven-ld/powerwiki

PowerWiki โ€“ A modern Git-based Markdown wiki with auto-sync
https://github.com/steven-ld/powerwiki

expressjs feishu-style git-based-wiki knowledge-base lightweight-wiki markdown markdown-wiki nodejs notion-alternative obsidian-alternative open-source-wiki personal-wiki self-hosted self-hosted-wiki wiki-software

Last synced: about 2 months ago
JSON representation

PowerWiki โ€“ A modern Git-based Markdown wiki with auto-sync

Awesome Lists containing this project

README

          

# PowerWiki

![PowerWiki](https://img.shields.io/badge/PowerWiki-Git--Based%20Wiki-3370ff?style=for-the-badge)
![License](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)
![Node](https://img.shields.io/badge/Node.js->=14-339933?style=for-the-badge&logo=node.js&logoColor=white)

A modern Git-based Markdown wiki system with auto-sync, syntax highlighting, and Feishu-style UI.

**๐Ÿ”— Live Demo: [https://powerwiki.ga666666.cn](https://powerwiki.ga666666.cn)**

[English](README.md) โ€ข [ไธญๆ–‡](README_ZH.md) โ€ข [ๆ—ฅๆœฌ่ชž](docs/README_JA.md) โ€ข [ํ•œ๊ตญ์–ด](docs/README_KO.md) โ€ข [Espaรฑol](docs/README_ES.md) โ€ข [Franรงais](docs/README_FR.md) โ€ข [Deutsch](docs/README_DE.md) โ€ข [ะ ัƒััะบะธะน](docs/README_RU.md)

---

## ๐Ÿ’ก Design Philosophy

PowerWiki was born from deep reflection on "knowledge management" and "technical writing". We believe in:

### 1. Simplicity is Power

No over-engineering, no complex wheels. Markdown + Git is the simplest knowledge management solution proven over a decade. No database, back to file systems, keeping knowledge pure.

### 2. Geeks First

Tailor-made for developers. Syntax highlighting, local image support, Git workflow โ€” every feature comes from real development scenarios.

### 3. Out of the Box

Zero learning cost to get started. Clone and use, push and update. No complex configuration, no dedicated CMS required.

### 4. Persistence & Portability

Your data always belongs to you. Plain text storage, version control built-in, migrate to any platform anytime.

### 5. Privacy & Security

No registration, no cloud. All data stored in an environment you control.

---

## โœจ Features

- **Auto Sync** - Automatically sync from Git repositories
- **Syntax Highlighting** - Code highlighting powered by highlight.js
- **Responsive Design** - Works on all devices
- **Auto TOC** - Automatic table of contents generation
- **Modern UI** - Clean and intuitive interface
- **PDF Support** - Render PDF files as images
- **View Statistics** - Track article views
- **Lightweight** - No database required
- **SEO Optimized** - Full SEO optimization
- **Frontmatter Support** - Parse YAML metadata
- **Local Images** - Support for local images in Markdown
- **Multi-language** - Chinese and English support
- **Docker Ready** - Full Docker support

## ๐Ÿš€ Quick Start

### Prerequisites

- Node.js >= 14.0.0
- Git

### Option 1: Docker (Recommended)

```bash
# Clone the repository
git clone https://github.com/steven-ld/PowerWiki.git
cd PowerWiki

# Create config file
cp config.example.json config.json
# Edit config.json with your Git repository URL

# Start with Docker Compose
docker-compose up -d
```

### Option 2: Node.js

```bash
# Clone the repository
git clone https://github.com/steven-ld/PowerWiki.git
cd PowerWiki

# Install dependencies
npm install

# Create config file
cp config.example.json config.json
# Edit config.json with your Git repository URL

# Start the server
npm start
```

Visit `http://localhost:3150` in your browser.

## โš™๏ธ Configuration

Edit `config.json`:

```json
{
"gitRepo": "https://github.com/your-username/your-wiki-repo.git",
"repoBranch": "main",
"port": 3150,
"siteTitle": "My Wiki",
"siteDescription": "Knowledge Base",
"autoSyncInterval": 180000,
"pages": {
"home": "README.md",
"about": "ABOUT.md"
}
}
```

| Option | Description | Default |
|--------|-------------|---------|
| `gitRepo` | Git repository URL | - |
| `repoBranch` | Branch name | `main` |
| `mdPath` | Markdown files subdirectory | `""` |
| `port` | Server port | `3150` |
| `siteTitle` | Site title | `PowerWiki` |
| `siteDescription` | Site description | `Wiki` |
| `autoSyncInterval` | Auto sync interval (ms) | `180000` |
| `sortOrder` | Sort order (`modified` or `name`) | `modified` |
| `pages.home` | Home page file | `""` |
| `pages.about` | About page file | `""` |

## ๐ŸŒ Environment Variables

PowerWiki supports environment variables for flexible deployment:

```bash
# Configuration file path
CONFIG_PATH=/path/to/your/config.json

# Data storage directory (for stats and logs)
DATA_DIR=/path/to/data/directory

# Git repository cache directory
GIT_CACHE_DIR=/path/to/git/cache

# Language setting (zh-CN or en)
LANG=zh-CN
```

Copy `.env.example` to `.env` and customize as needed.

## ๐Ÿณ Docker Deployment

### Docker Image

**[@sayunchuan](https://github.com/sayunchuan)** provides a Docker image for PowerWiki.

- **Image**: `sayunchuan/powerwiki`
- **Docker Hub**: [sayunchuan/powerwiki](https://hub.docker.com/r/sayunchuan/powerwiki)
- **Tags**: `latest`, `1.4.5`, `20260207`

### Quick Start

```bash
# Simplest way
docker run -d -p 3150:3150 sayunchuan/powerwiki

# With custom config
docker run -d \
--name powerwiki \
-p 3150:3150 \
-v $(pwd)/config.json:/app/config.json:ro \
-v powerwiki_data:/app/data \
-v powerwiki_cache:/app/cache \
sayunchuan/powerwiki
```

### Docker Compose

```yaml
version: '3.8'
services:
powerwiki:
image: sayunchuan/powerwiki:latest
ports:
- "3150:3150"
environment:
- NODE_ENV=production
- LANG=zh-CN
volumes:
- ./config.json:/app/config.json:ro
- powerwiki_data:/app/data
- powerwiki_cache:/app/cache
restart: unless-stopped

volumes:
powerwiki_data:
powerwiki_cache:
```

```bash
# Start services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down
```

**Acknowledgment**: Thanks to [@sayunchuan](https://github.com/sayunchuan) for providing the Docker image, making PowerWiki deployment more convenient.

## ๐Ÿ“‚ Article Organization

PowerWiki supports hierarchical folder structure for organizing articles:

```
your-wiki-repo/
โ”œโ”€โ”€ README.md # Home page
โ”œโ”€โ”€ ABOUT.md # About page
โ”œโ”€โ”€ images/ # Global images (optional)
โ”œโ”€โ”€ Architecture/ # Category folder
โ”‚ โ”œโ”€โ”€ images/ # Category images
โ”‚ โ”œโ”€โ”€ IoT-Device-Standards.md
โ”‚ โ”œโ”€โ”€ TLS-Encryption.md
โ”‚ โ””โ”€โ”€ README.md # Category index
โ”œโ”€โ”€ Projects/ # Another category
โ”‚ โ”œโ”€โ”€ images/
โ”‚ โ”œโ”€โ”€ URL-Shortener.md
โ”‚ โ””โ”€โ”€ README.md
โ””โ”€โ”€ Media/
โ”œโ”€โ”€ images/
โ”œโ”€โ”€ WebRTC-Signaling.md
โ””โ”€โ”€ README.md
```

### Article Frontmatter

Each article can include YAML frontmatter for metadata:

```yaml
---
title: Article Title
description: Article description for SEO
author: Author Name
date: 2026-01-10
updated: 2026-01-10
keywords: keyword1, keyword2, keyword3
tags: [tag1, tag2]
---
```

### Image References

PowerWiki supports referencing local images using relative paths in Markdown. The system automatically converts image paths to accessible API URLs:

```markdown
# Method 1: Using images folder in current directory (recommended)
![Image Description](./images/pic.png)

# Method 2: Using parent directory's images folder
![Image Description](../images/pic.png)

# Method 3: Using absolute path (relative to repo root)
![Image Description](/images/pic.png)

# Method 4: Direct reference (without ./ or ../ prefix)
![Image Description](images/pic.png)
```

Supported image formats: `PNG`, `JPG/JPEG`, `GIF`, `WEBP`, `SVG`, `ICO`

## ๐ŸŒ Multi-language Support

PowerWiki supports multiple languages for console output and allows users to customize language packs.

### Supported Languages
- **Chinese Simplified** (`zh-CN`) - Default
- **English** (`en`)

### Usage

```bash
# Start with English
LANG=en npm start

# Start with Chinese
LANG=zh-CN npm start

# Or use npm scripts
npm run start:en
npm run start:zh
```

### Custom Language Packs

PowerWiki uses JSON files for translations and supports adding custom languages.

#### 1. Create Language File

Create a new language file in the `locales/` directory with the format `.json`:

```bash
# Example: Create Japanese language file
cp locales/en.json locales/ja.json
```

#### 2. Edit Language File

Modify `locales/ja.json` and replace English translations with Japanese:

```json
{
"siteTitle": "PowerWiki",
"siteDescription": "Wiki ใ‚ทใ‚นใƒ†ใƒ ",
"nav": {
"home": "ใƒ›ใƒผใƒ ",
"about": "ๆฆ‚่ฆ"
},
"content": {
"readingTime": "่ชญใฟๅ–ใ‚Šๆ™‚้–“",
"words": "่ชž",
"toc": "็›ฎๆฌก"
},
"actions": {
"copy": "ใ‚ณใƒ”ใƒผ",
"copied": "ใ‚ณใƒ”ใƒผๅฎŒไบ†"
},
"stats": {
"views": "้–ฒ่ฆงๆ•ฐ"
},
"footer": {
"poweredBy": "Powered by"
}
}
```

#### 3. Update Console Language Options

Modify `src/config/i18n.js` and add your new language to the `SUPPORTED_LANGUAGES` array:

```javascript
const SUPPORTED_LANGUAGES = [
{ code: 'zh-CN', name: 'ไธญๆ–‡', file: 'zh-CN.json' },
{ code: 'en', name: 'English', file: 'en.json' },
{ code: 'ja', name: 'ๆ—ฅๆœฌ่ชž', file: 'ja.json' }, // Add Japanese
];
```

#### 4. Use Custom Language

```bash
# Start with Japanese
LANG=ja npm start
```

#### Language File Structure Reference

Language files support the following keys (all are optional, missing keys will fall back to English):

| Category | Key | Description |
|----------|-----|-------------|
| Site | `siteTitle` | Website title |
| Site | `siteDescription` | Website description |
| Nav | `nav.home` | Home link text |
| Nav | `nav.about` | About page link text |
| Content | `content.readingTime` | Reading time label |
| Content | `content.words` | Words unit |
| Content | `content.toc` | Table of contents title |
| Actions | `actions.copy` | Copy button |
| Actions | `actions.copied` | Copied success message |
| Stats | `stats.views` | View count label |
| Footer | `footer.poweredBy` | Powered by text |

## ๐Ÿ› ๏ธ Development

### Available Scripts

```bash
# Development
npm run dev # Start with nodemon
npm run test:env # Test environment variables

# Docker
npm run docker:build # Build Docker image
npm run docker:run # Run Docker container
npm run docker:stop # Stop and remove container
npm run docker:logs # View container logs

# Language variants
npm run start:en # Start with English
npm run start:zh # Start with Chinese
```

### Project Structure

```
PowerWiki/
โ”œโ”€โ”€ src/ # Source code
โ”‚ โ”œโ”€โ”€ index.js # Express server entry
โ”‚ โ”œโ”€โ”€ routes/ # Route modules
โ”‚ โ”‚ โ”œโ”€โ”€ api.js # API routes
โ”‚ โ”‚ โ”œโ”€โ”€ feeds.js # RSS/Sitemap routes
โ”‚ โ”‚ โ””โ”€โ”€ static.js # Static file routes
โ”‚ โ”œโ”€โ”€ config/ # Configuration
โ”‚ โ”‚ โ”œโ”€โ”€ env.js # Environment variables
โ”‚ โ”‚ โ””โ”€โ”€ i18n.js # Internationalization
โ”‚ โ””โ”€โ”€ utils/ # Utility modules
โ”‚ โ”œโ”€โ”€ cacheManager.js # Cache management
โ”‚ โ”œโ”€โ”€ gitManager.js # Git operations
โ”‚ โ””โ”€โ”€ markdownParser.js# Markdown parser
โ”œโ”€โ”€ locales/ # Translation files
โ”‚ โ”œโ”€โ”€ zh-CN.json # Chinese translations
โ”‚ โ””โ”€โ”€ en.json # English translations
โ”œโ”€โ”€ templates/ # HTML templates
โ”‚ โ”œโ”€โ”€ header.html # Header template
โ”‚ โ”œโ”€โ”€ footer.html # Footer template
โ”‚ โ””โ”€โ”€ home.html # Home template
โ”œโ”€โ”€ public/ # Static assets
โ”‚ โ”œโ”€โ”€ index.html # Frontend HTML
โ”‚ โ”œโ”€โ”€ app.js # Main entry (modular)
โ”‚ โ”œโ”€โ”€ js/ # JavaScript modules
โ”‚ โ”‚ โ”œโ”€โ”€ theme.js # Theme management
โ”‚ โ”‚ โ”œโ”€โ”€ i18n.js # Internationalization
โ”‚ โ”‚ โ”œโ”€โ”€ cache.js # Client caching
โ”‚ โ”‚ โ”œโ”€โ”€ utils.js # Utilities
โ”‚ โ”‚ โ”œโ”€โ”€ posts.js # Post list & tree
โ”‚ โ”‚ โ”œโ”€โ”€ article.js # Article rendering
โ”‚ โ”‚ โ”œโ”€โ”€ toc.js # Table of contents
โ”‚ โ”‚ โ””โ”€โ”€ media.js # Code copy, images, PDF
โ”‚ โ””โ”€โ”€ css/ # CSS modules
โ”‚ โ”œโ”€โ”€ base.css # Base styles & variables
โ”‚ โ”œโ”€โ”€ layout.css # Layout (sidebar, header)
โ”‚ โ”œโ”€โ”€ sidebar.css # Navigation menu
โ”‚ โ”œโ”€โ”€ article.css # Article & Markdown
โ”‚ โ”œโ”€โ”€ toc.css # Table of contents
โ”‚ โ”œโ”€โ”€ media.css # Responsive design
โ”‚ โ””โ”€โ”€ components.css # UI components
โ”œโ”€โ”€ config.example.json # Config template
โ”œโ”€โ”€ package.json # Dependencies
โ”œโ”€โ”€ Dockerfile # Docker configuration
โ””โ”€โ”€ docker-compose.yml # Docker Compose
```

## ๐Ÿ› ๏ธ Tech Stack

- **Backend**: Express.js
- **Frontend**: Vanilla JavaScript
- **Git**: simple-git
- **Markdown**: marked + highlight.js
- **PDF**: pdfjs-dist
- **Containerization**: Docker

## ๐Ÿ“„ License

MIT License - see [LICENSE](LICENSE) for details.

## ๐Ÿ‘ฅ Contributors

- [@sayunchuan](https://github.com/sayunchuan) - Add multi-language, Mermaid support, fix various issues

## ๐Ÿ™ Credits

- [Express.js](https://expressjs.com/)
- [marked](https://marked.js.org/)
- [highlight.js](https://highlightjs.org/)
- [simple-git](https://github.com/steveukx/git-js)
- [PDF.js](https://mozilla.github.io/pdf.js/)

---

**If this project helps you, please give it a โญ Star!**