What BookStack Does
- Book-Like Organization: Shelves → Books → Chapters → Pages hierarchy
- WYSIWYG Editor: Rich text editor with drag-and-drop images and formatting
- Markdown Editor: Full Markdown support as an alternative editor
- Full-Text Search: Search across all content with highlighted results
- Diagrams: Built-in drawing tool (diagrams.net) for creating diagrams inline
- LDAP/SAML/OIDC: Enterprise authentication support
- Roles & Permissions: Granular role-based access at shelf, book, chapter, and page level
- Comments: Page-level comments for discussions
- Revision History: Full page history with diff view and restore
- API: Complete REST API for integration and automation
- Multi-Language: Interface available in 30+ languages
- Export: PDF, HTML, and Markdown export per page, chapter, or book
Content Hierarchy
📚 Shelf: Engineering Documentation
├── 📕 Book: Backend Services
│ ├── 📑 Chapter: API Design
│ │ ├── 📄 Page: REST Conventions
│ │ ├── 📄 Page: Authentication
│ │ └── 📄 Page: Error Handling
│ ├── 📑 Chapter: Database
│ │ ├── 📄 Page: Schema Design
│ │ └── 📄 Page: Migration Guide
│ └── 📄 Page: Architecture Overview (direct page)
│
├── 📗 Book: Frontend Guide
│ ├── 📑 Chapter: Components
│ └── 📑 Chapter: State Management
│
└── 📘 Book: DevOps Runbooks
├── 📑 Chapter: Deployment
└── 📑 Chapter: Incident ResponseSelf-Hosting
Docker Compose
services:
bookstack:
image: lscr.io/linuxserver/bookstack:latest
ports:
- "6875:80"
environment:
APP_URL: http://localhost:6875
DB_HOST: db
DB_PORT: 3306
DB_DATABASE: bookstack
DB_USERNAME: bookstack
DB_PASSWORD: bookstack
PUID: 1000
PGID: 1000
TZ: Asia/Shanghai
volumes:
- bookstack-config:/config
depends_on:
- db
db:
image: mariadb:11
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: bookstack
MYSQL_USER: bookstack
MYSQL_PASSWORD: bookstack
volumes:
- db-data:/var/lib/mysql
volumes:
bookstack-config:
db-data:Key Features
WYSIWYG Editor
Rich text editor with:
- Text formatting (bold, italic, strikethrough, headings)
- Tables with merge and resize
- Code blocks with syntax highlighting (50+ languages)
- Image upload with drag-and-drop
- File attachments
- Callout blocks (info, warning, danger)
- Drawing tool (diagrams.net integration)
- Include tags (embed content from other pages)
Permissions System
Roles:
├── Admin — Full access to everything
├── Editor — Create, edit, delete content
├── Viewer — Read-only access
└── Custom — Per-entity permissions
Per-entity permissions (override role defaults):
├── Shelf: Engineering Docs → Only Engineering team
├── Book: HR Policies → Only HR + Management
└── Page: Salary Bands → Only HR AdminAPI
# List all books
curl http://localhost:6875/api/books
-H "Authorization: Token YOUR_TOKEN_ID:YOUR_TOKEN_SECRET"
# Create a page
curl -X POST http://localhost:6875/api/pages
-H "Authorization: Token YOUR_TOKEN_ID:YOUR_TOKEN_SECRET"
-H "Content-Type: application/json"
-d '{"book_id": 1, "name": "New Page", "html": "<p>Page content</p>"}'
# Search
curl "http://localhost:6875/api/search?query=deployment+guide"
-H "Authorization: Token YOUR_TOKEN_ID:YOUR_TOKEN_SECRET"Export Options
| Format | Scope |
|---|---|
| Page, Chapter, Book | |
| HTML | Page, Chapter, Book |
| Markdown | Page |
| Plain Text | Page |
BookStack vs Alternatives
| Feature | BookStack | Wiki.js | Outline | Confluence |
|---|---|---|---|---|
| Open Source | Yes (MIT) | Yes (AGPL) | BSL | No |
| Organization | Book hierarchy | Flat pages | Collections | Spaces |
| Editor | WYSIWYG + MD | MD + WYSIWYG + HTML | Slash commands | WYSIWYG |
| Auth | LDAP/SAML/OIDC | 20+ providers | SSO required | LDAP/SSO |
| Diagrams | Built-in (draw.io) | Mermaid + PlantUML | Mermaid | Draw.io |
| API | Full REST | GraphQL | Full REST | REST |
| Stack | PHP/Laravel | Node.js | Node.js | Java |
| Learning curve | Very low | Low | Low | Medium |
常见问题
Q: BookStack 和 Wiki.js 怎么选? A: BookStack 的书籍层级结构更适合有组织的技术文档(如产品手册、运维手册)。Wiki.js 更灵活,适合扁平化的知识库。BookStack 的 WYSIWYG 编辑器对非技术人员更友好,Wiki.js 的 Markdown 体验对开发者更好。
Q: 支持中文搜索吗? A: 支持。BookStack 使用 MySQL/MariaDB 的全文搜索,中文搜索可以正常工作。如果需要更好的中文分词,可以配置 MySQL 的中文全文索引插件。
Q: 可以公开分享文档吗? A: 可以。BookStack 支持设置公开访客角色,允许未登录用户查看指定内容。也可以通过共享链接公开特定页面。
来源与致谢
- GitHub: BookStackApp/BookStack — 18.6K+ ⭐ | MIT
- 官网: bookstackapp.com