Installing the server
Through a Cloudflare tunnel
A tunnel makes Memex reachable from the internet without opening any port and without a public IP address: Memex starts cloudflared, which connects out to Cloudflare, and people reach the instance through Cloudflare over HTTPS. The installer offers two kinds, quick and permanent.
Quick or permanent
| Quick tunnel | Permanent tunnel | |
|---|---|---|
| Installer wording | Quick: no account needed, but the address changes at every restart | Permanent: stable address on your own domain (needs a free Cloudflare account) |
--mode | tunnel-quick | tunnel-named |
| Address | A random https://<words>.trycloudflare.com | A hostname on your domain |
| Account | None | A free Cloudflare account with the domain on it |
| Good for | Trying Memex | Lasting use |
This is the only mode in which cloudflared is downloaded: the official release binary, to /usr/local/bin/cloudflared, unless it is already installed.
Quick tunnel
Choose "Through a tunnel", then the quick kind, or run:
sudo memex install --mode tunnel-quick --yes- The address changes every time Memex restarts (reboot, update, crash). Links you shared stop working, and AI assistants connected over MCP must be reconnected with the new address.
memex statusalways shows the current address. If the summary says the address is not known yet, run it again a moment later.- Quick tunnels have no uptime guarantee.
- Prefer the
notifyormanualupdate mode with a quick tunnel, since an automatic update restarts the server and so changes the address.
Permanent tunnel
- Create the tunnel in CloudflareIn the Cloudflare dashboard, under Zero Trust → Networks → Tunnels, create a tunnel and copy its token.
- Add a public hostnameIn the same tunnel, add a public hostname (for example
brain.example.com) pointing to the servicehttp://localhost:8787. - Run the installerChoose "Through a tunnel", then the permanent kind. The assistant asks for the tunnel token (typed masked) and the public hostname.
- Confirm the planThe token is stored in
/etc/memex/config.toml(mode 0640) and handed tocloudflaredthrough its environment, never on a command line.
The same without questions; the token can also come from the MEMEX_TUNNEL_TOKEN environment variable:
sudo memex install --mode tunnel-named --domain brain.example.com --tunnel-token "$TOKEN" --yesCheck that it worked
sudo memex statusThe status shows the public address. Open it in a browser from another network, for example from a phone on mobile data. If a permanent tunnel answers with a Cloudflare error, check in the dashboard that the public hostname points to the service http://localhost:8787 (or the port you chose).
With a tunnel, the traffic passes through Cloudflare, which terminates HTTPS. Backups contain the tunnel token: treat them as secrets.