DEV Community

Cover image for Self-Hosting a lightweight Wiki on Raspberry PI with Cloudflare Tunnel
perber
perber

Posted on

Self-Hosting a lightweight Wiki on Raspberry PI with Cloudflare Tunnel

I’m the developer behind LeafWiki, a lightweight, Markdown-based Wiki that doesn’t require a database.
One of our users recently set it up on a Raspberry Pi, connected it to the Internet through Cloudflare Tunnel, and the setup was so clean that I decided to write a short guide about it.

He also published the documentation in the project repository:
Install LeafWiki on Raspberry PI

If you’re into self-hosted tools, this might be interesting to you.

Project Installation

To begin, you need to install LeafWiki.
Here is the quick install command:

curl -sL https://raw.githubusercontent.com/perber/leafwiki/main/install.sh -o install.sh && chmod +x ./install.sh && sudo ./install.sh --arch arm64
Enter fullscreen mode Exit fullscreen mode

During installation, you’ll be asked for an admin password and a JWT secret.

That’s it 🎉
LeafWiki should now be running locally at:

👉 http://localhost:8080/

You can open that in your browser to confirm the installation.

Exposing LeafWiki to the Internet with Cloudflare Tunnel

At this point, LeafWiki is only accessible within your local network.
You could open ports on your router — but that’s risky and not ideal for security.

Instead, we’ll use Cloudflare Tunnel, a secure, zero-trust connection that lets you expose your local service to the Internet without opening any ports.

How it works

Cloudflare acts as a CDN (Content Delivery Network) sitting between the user and your server.

Traffic goes through Cloudflare, which then routes it safely to your local machine.
This way your IP stays hidden, and your connection stays encrypted.

In our case, the Cloudflare tunnel forwards traffic to LeafWiki running on your Pi — and exposes it as a subdomain of your domain, for example:

wiki.mysite.com
Enter fullscreen mode Exit fullscreen mode

Domain Setup

You’ll need a domain name.
It can be managed through Cloudflare or any other registrar —
if your DNS is elsewhere, you’ll just need to point it to Cloudflare.

Sign up or log in to your Cloudflare dashboard before continuing.

Creating a tunnel

Once your domain is ready:

  1. Open the Cloudflare dashboard.
  2. Go to Zero Trust -> Network -> Tunnels
  3. Click Create a tunnel and choose Cloudflared
  4. Give your tunnel a name.

You'll then reach the configuration page:

Configure the server (your Raspberry Pi)

After creating the tunnel, Cloudflare shows setup instructions for your device.
Connect to your Raspberry Pi via SSH and copy/paste the provided commands.

This will install Cloudflared, authenticate it, and connect your Pi to your Cloudflare account.

Expose your LeafWiki instance

Now that the tunnel is live, register your local app — in our case, LeafWiki

  • Protocol: HTTP
  • URL: localhost:8080

Save the configurtion

Cloudflare will now route external traffic (e.g. wiki.mydomain.com) directly to your LeafWiki instance — securely and without exposing your local IP. 🎉

Wrapping up

You now have:

  • LeafWiki running on your Raspberry PI
  • A secure Cloudflare Tunnle exposing it to the internet
  • Your own self-hosted lightweight wiki - accessible anywhere

If you want to try ityourself or checkout the project:
👉 GitHub Repository
👉 Live Demo

If you like the project and the idea,
⭐ drop a star on GitHub

Top comments (0)