Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perber/leafwiki

Repository files navigation

🌿 LeafWiki

A lightweight, tree-based wiki that keeps your content in plain Markdown - fast, clean, and self-hosted

Run your knowledge base in 5 minutes - no database, just a single Go binary.

LeafWiki is designed for teams and individuals who want a clean, fast, and self-hosted knowledge base - with full control over structure, content, and deployment.


LeafWiki


🌿 Growing with Purpose

LeafWiki has reached a stable and usable foundation, and it’s already being used by developers to organize and document their knowledge.

The project isn’t feature-complete yet.
Right now, the focus is on refining what’s there, improving stability, and evolving the platform carefully toward a truly developer-friendly knowledge base.

Current priorities:

  • Stability and reliability
  • UX/UI and usability improvements
  • Testing, CI, and quality assurance

The editor and admin features are already in place, but collaboration is still basic - currently following a “last-write-wins” approach. Team-ready features like versioning, ... are planned for future iterations.

LeafWiki and of course I are looking for contributors who want to help bring this vision to life - by refining existing features, fixing bugs, or experimenting with new ideas.

LeafWiki is stable, growing and open for collaboration 🌿

🧪 Live Demo

Test it yourself – no setup required!
A public demo of LeafWiki is available here:

🌐 demo.leafwiki.com

Login credentials are displayed on the demo site's login page.
⚙️ The demo instance resets automatically every hour,
so feel free to experiment - all changes are temporary.


✨ Features

  • 🧾 Markdown-first with live editor + preview
  • 🌲 True tree-structured pages (nested folders)
  • 🔒 Role-based access (admin / editor)
  • 🧠 No database required
  • 📂 Per-page assets with upload support
  • 🖼️ Embed images and files with Markdown
  • ⚙️ Single statically-linked Go binary (no dependencies)
  • 🚀 Easily self-hosted (Docker or standalone)
  • 🔁 Session auth with JWT tokens + refresh
  • 🔍 Search functionality for page titles and content
  • 📱 Mobile-friendly design
  • 🌐 Public pages (viewable without login)
  • 🖨️ Print view support
  • 🧩 Mermaid.js diagram support

Available Builds

LeafWiki now builds and runs natively on:

  • Linux (x86_64 and ARM64)
  • Windows (x86_64)
  • Raspberry Pi (tested with 64-bit OS)

💭 Why Another Wiki?

After trying out tools like Wiki.js, Confluence, and DokuWiki, I wanted something simpler: no database, easy to host, Markdown-based, and truly Git-friendly.

  • Why use a database just to store Markdown?
  • Why should setup be a weekend project?
  • Why can't a wiki just be file-based and fast?

LeafWiki was born out of that frustration - and the desire to have:

  • 🧾 Clean Markdown files, organized in folders
  • 🧠 A real tree structure, not a flat list
  • ⚙️ A single binary with no external dependencies
  • 🛠️ Something teams can actually self-host without DevOps pain

It’s not trying to be everything - just a solid, minimal wiki for people who want clarity over complexity.


💡 LeafWiki vs. Markdown Readers

LeafWiki is often compared to simple Markdown viewers or file browsers - but it’s built for a very different purpose.

Markdown Reader LeafWiki
Purpose Read static .md files Create, organize, and serve a structured wiki
Data source Reads directly from disk Stores pages as Markdown, but manages structure internally
Structure Flat folder view True tree of pages & subpages
Editing External text editor Built-in Markdown editor with live preview
Uploads Not supported Per-page assets (images, files)
Search File names only Indexed full-text search (titles + content)
Hosting Static / local Self-hosted Go web app
Access No authentication Role-based access (admin / editor)

LeafWiki doesn’t just display Markdown files - it organizes, edits, and serves them.
It’s not a viewer, but a small wiki engine that happens to store everything as Markdown.


🛠️ Installation (Production)

You can install LeafWiki in several environments.
Below are some examples to get you started.

Setup Examples

Quick install

curl -sL https://raw.githubusercontent.com/perber/leafwiki/main/install.sh -o install.sh && chmod +x ./install.sh && sudo ./install.sh --arch amd64

This command performs a quick installation of LeafWiki on the target machine.

⚙️ Flags

Flag Description Default
--arch Target architecture for the binary (e.g. amd64, arm64) -
--host Host/IP address the server binds to 0.0.0.0
--port Port the server listens on 8080

⚠️ Attention - Security

Sensitive information (JWT token, administrator password) appears in plain text in the systemd file /etc/systemd/system/leafwiki.service. Make sure that this file is accessible only to authorized users.

The installation script has been tested on Ubuntu. If you test the script on other distributions or architectures, please provide feedback by opening an issue on the GitHub repository - this will help us improve compatibility and documentation.


Docker installation

You can run LeafWiki in a Docker container:

docker run -p 8080:8080 ghcr.io/perber/leafwiki:latest --jwt-secret=yoursecret

By default, the container runs as root. You can specify a custom data directory using the --data-dir option.

If you want to avoid running as root, add -u 1000:1000:

docker run -p 8080:8080 -u 1000:1000 \
  ghcr.io/perber/leafwiki:latest --jwt-secret=yoursecret

By default the data directory inside the container will be app/data/


Manual installation

# Download the latest release from GitHub
chmod +x leafwiki
./leafwiki --jwt-secret=yoursecret

Default port is 8080, and the default data directory is ./data. You can change the data directory with the --data-dir flag.

✅ Native ARM64 builds are available in the Releases section.

Default admin user

The first time you run LeafWiki, it will create an admin user with the default password admin.

You can change this password later in the admin settings or by using the CLI:

./leafwiki --admin-password=newpassword --jwt-secret=yoursecret

Note: --admin-password (or the LEAFWIKI_ADMIN_PASSWORD env var) is only used on first startup, when no admin user exists yet.

Reset Admin Password

If you need to reset the admin password, you can do so by running:

./leafwiki reset-admin-password

⚙️ CLI Flags

Flag Description Default
--jwt-secret Secret used for signing JWTs (required)
--host Host/IP address the server binds to 0.0.0.0
--port Port the server listens on 8080
--data-dir Directory where data is stored ./data
--admin-password Initial admin password (used only if no admin exists) admin
--public-access Allow public access to the wiki (no auth required) false

🌱 Environment Variables

Instead of CLI flags, you can also configure LeafWiki using environment variables:

Variable Description Default
LEAFWIKI_HOST Host/IP address the server binds to 0.0.0.0
LEAFWIKI_PORT Port the server listens on 8080
LEAFWIKI_DATA_DIR Path to the data storage directory ./data
LEAFWIKI_ADMIN_PASSWORD Initial admin password (used only if no admin exists yet) admin
LEAFWIKI_JWT_SECRET Secret used to sign JWT tokens (required)
LEAFWIKI_PUBLIC_ACCESS Allow public access to the wiki (no auth required) false

These environment variables override the default values and are especially useful in containerized or production environments.

Binding to localhost behind a reverse proxy

If you run a reverse proxy (nginx, Caddy, Traefik) in front of LeafWiki, you may want the Go server to only listen on the loopback interface. You can do that with the --host flag or the LEAFWIKI_HOST env var:

# bind to localhost only
LEAFWIKI_HOST=127.0.0.1 ./leafwiki --jwt-secret=yoursecret

# or with the CLI flag
./leafwiki --host 127.0.0.1 --jwt-secret=yoursecret

When bound to 127.0.0.1, the server will only listen on localhost and won't be directly reachable from the public internet; the reverse proxy can forward requests from the external interface.

🚀 Quick Start (Dev)

# 1. Clone the repo

git clone https://github.com/perber/leafwiki.git
cd leafwiki

# 2. Install frontend dependencies

cd ui/leafwiki-ui
npm install
npm run dev   # Starts Vite dev server on http://localhost:5173

# 3. In another terminal, start the backend

cd ../../cmd/leafwiki
go run main.go

🗺️ Roadmap

Planned

  • Improve release & test process (CI/CD)
  • Bug fixes and UX improvements based on user feedback

✅ v0.1.0 – MVP

  • Tree-based page structure
  • Markdown file creation
  • Slug + file path mapping
  • Move / rename / delete logic
  • Markdown editor with preview
  • File/image uploads per page
  • Simple page title search
  • Asset management (images, files)
  • Basic JWT auth (session-based)

✅ v0.2.0 – Improved Editor Experience

  • Use CodeMirror for Markdown editing
  • Add Toolbar with common actions like bold, italic, links, etc.
  • Allow Undo/Redo actions

✅ v0.3.4 – Improved Asset Handling

  • Allow uploading multiple files at once
  • Allow renaming of uploaded files
  • Fix caching issues with uploaded assets
  • Fix syntax highlighting in preview
  • Fix favicon not displayed
  • ARM64 support for Raspberry Pi and other ARM devices (thanks @nahaktarun)

✅ v0.4.6 – Ready for Dogfooding

  • Add Search functionality for page titles and content
  • Add Mobile optimizations for better usability
  • Allow Public Pages (viewable pages without login)
  • Add shortcuts in the editor (e.g. Ctrl+S to save, Ctrl+B for bold, Ctrl+Z for undo, ...)
  • Smaller improvements and bugfixes in the UI
  • Added "Create & Edit" option to dialog to allow creating structure before editing
  • Warn user about unsaved changes when navigating away (via beforeunload and react-router)
  • Updated the tree view design – it now has a more documentation-style look
  • Print view support for pages (print-friendly layout)

✅ v0.4.7 – Stabilize

  • Several dependencies updates
  • Allow to configure --host to bind to specific IP (e.g. --host 127.0.0.1) - thanks @magnus-madsen for the suggestion!

✅ v0.4.8 – UX Improvements

  • Several dependencies updates
  • Not Found page now suggests creating a new page - thanks @magnus-madsen for the suggestion!
  • links to non-existing pages now show a create page dialog - thanks @magnus-madsen for the suggestion!
  • smaller UI improvements and bugfixes (e.g. green save button, ...)

✅ v0.4.9 – Mermaid Support, UX Improvements & Easier Installation

A special thanks for this release goes out to @Hugo-Galley. He improved the documentation and the onboarding experience a lot!

  • Mermaid.js diagram support
  • Copy page functionality added
  • Installation script added for binary - thanks to @Hugo-Galley
  • Improved docker builds with multi-arch support (amd64 + arm64)
  • Several UI/UX improvements and bugfixes
  • Stability improvements and dependency updates

🧠 Philosophy

  • Simple to run: No container, no DB, just Go
  • Simple to host: You know where your data is
  • Simple to trust: Markdown is portable & future-proof

Your knowledge should live in files you own - not in a database you maintain.


🙋 Contributing

Contributions, discussions and feedback are very welcome.
This project is still early – feel free to open issues or ideas!

📬 Stay in the Loop

More updates coming soon.
Watch the repo or drop a star ⭐ if you’re curious!

About

A lightweight, self-hosted wiki built in Go — tree-based, fast, and storing content in plain Markdown.

Topics

Resources

License

Stars

Watchers

Forks

Packages