# BookStack — Simple Self-Hosted Documentation & Wiki Platform > BookStack is a simple, self-hosted documentation platform organized by Shelves, Books, Chapters, and Pages. WYSIWYG/Markdown editor, LDAP, and powerful search. ## Install Save in your project root: ## Quick Use ```bash docker run -d --name bookstack -p 6875:80 -e APP_URL=http://localhost:6875 -e DB_HOST=bookstack-db -e DB_DATABASE=bookstack -e DB_USERNAME=bookstack -e DB_PASSWORD=bookstack --link bookstack-db lscr.io/linuxserver/bookstack:latest ``` Open `http://localhost:6875` — login with admin@admin.com / password. ## Intro **BookStack** is a simple, self-hosted platform for organizing and storing information. It uses an intuitive book-like hierarchy — Shelves contain Books, Books contain Chapters, Chapters contain Pages — making it natural to organize large amounts of documentation. With 18.6K+ GitHub stars and MIT license, BookStack is popular among teams, organizations, and individuals who need a straightforward, no-nonsense documentation platform without the complexity of enterprise wikis. ## 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 Response ``` ## Self-Hosting ### Docker Compose ```yaml 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 Admin ``` ### API ```bash # 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": "

Page content

"}' # Search curl "http://localhost:6875/api/search?query=deployment+guide" -H "Authorization: Token YOUR_TOKEN_ID:YOUR_TOKEN_SECRET" ``` ### Export Options | Format | Scope | |--------|-------| | PDF | 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](https://github.com/BookStackApp/BookStack) — 18.6K+ ⭐ | MIT - 官网: [bookstackapp.com](https://bookstackapp.com) --- Source: https://tokrepo.com/en/workflows/590e1c8e-34e1-11f1-9bc6-00163e2b0d79 Author: AI Open Source