# Self-host HedgeDoc

> A web editor for real-time collaborative Markdown notes (the 1.x line, a fork of CodiMD and HackMD), with accounts or anonymous use. Run your own HedgeDoc on an always-on EnvHaven workspace by asking its coding agent: one request installs it, puts it on an HTTPS address and locks it down. What the agent takes care of, and the manual route.

_Updated November 23, 2026_

Running your own HedgeDoc usually means a list of server chores: a machine that stays on, Docker or a runtime, a reverse proxy with certificates, a domain, and the settings that make HedgeDoc behave behind all of it. On an EnvHaven workspace you skip the list. You ask the coding agent, and it does the work while you watch.

## Just ask your agent

Open a Plus workspace (HedgeDoc runs in Docker, which Plus and Pro include), tap **Launch** to start any coding agent (Claude Code, Codex, OpenCode or another), and ask it:

```text
Set up HedgeDoc on this workspace and give me the link. Follow https://envhaven.com/self-host/hedgedoc.md
```

Then open the link it sends and create your HedgeDoc account straight away, before anyone else finds the address. That is the whole request: the address in it is this page's Markdown copy, and the agent follows the instructions for it further down, with every setting HedgeDoc's docs require.

## Or keep it private with Tailscale

The preview URL puts HedgeDoc on the public internet, which suits something other people need to reach. For an app only you and your household use, your tailnet is the better home: Tailscale gives HedgeDoc an HTTPS address that only your own devices, signed in to your Tailscale account, can open. Save a Tailscale auth key in the workspace's **Vars** pane as `TS_AUTHKEY`, and ask the agent:

```text
Set up HedgeDoc on my tailnet instead of the preview URL. Follow https://envhaven.com/self-host/hedgedoc.md and https://envhaven.com/guides/self-host-privately-with-tailscale.md
```

- A Tailscale container runs beside HedgeDoc, so it keeps its private address through workspace restarts and updates, and every app you set up this way gets an address of its own.
- Anything other services have to reach, such as a webhook, still needs a public address. [Keep self-hosted apps private with Tailscale](https://envhaven.com/guides/self-host-privately-with-tailscale) covers both, and what Tailscale's free plan includes.

| At a glance |  |
| --- | --- |
| What it is | Notes, wikis and knowledge bases |
| License | AGPL-3.0 |
| Runs as | Docker (`quay.io/hedgedoc/hedgedoc`) |
| Memory | at least 2 GB only for building the frontend yourself; no runtime figure documented ([docs](https://docs.hedgedoc.org/setup/manual-setup/)) |
| Plan that fits | Plus or larger |
| Web port | 3000 |
| Documentation | [docs.hedgedoc.org/setup/getting-started/](https://docs.hedgedoc.org/setup/getting-started/) |

## What your agent takes care of

- **Installing it.** HedgeDoc runs from the official image, `quay.io/hedgedoc/hedgedoc`, with its data in folders under `~/apps/hedgedoc`.
- **Putting it on an HTTPS address.** The workspace's preview URL serves it, and your own domain can too.
- **Locking it down first.** What HedgeDoc's docs say to set before it faces the internet, below.
- **Telling you what to back up**: the database (PostgreSQL, MySQL, MariaDB or the SQLite file), the uploads directory (/hedgedoc/public/uploads in the Docker image, a named volume in the sample) and configuration (config.json or CMD_* environment) ([docs](https://docs.hedgedoc.org/guides/production-ready/)).

### The settings it needs behind a proxy

- `CMD_DOMAIN` (config domain): The public domain name used to build links and asset URLs. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- `CMD_PROTOCOL_USESSL`=true: Use https in generated links when the public URL is https, even though the proxy talks plain HTTP to HedgeDoc. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- `CMD_URL_ADDPORT`=false: Do not append the port to generated URLs when using the default HTTPS port. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- X-Forwarded-Proto header: The proxy must pass the client's scheme; a wrong header breaks TLS handling. ([docs](https://docs.hedgedoc.org/setup/getting-started/))
- WebSocket upgrades on the socket.io path: The generic rule on the page says /sockets.io/, but the page's own nginx example proxies /socket.io/ (and the Apache example matches ^/socket.io); use /socket.io/. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- Cloudflare Rocket Loader: Must be disabled when Cloudflare fronts the site. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- `CMD_RATE_LIMIT_USING_CLOUDFLARE`=true: Special client-IP handling for rate limits when Cloudflare is in front. ([docs](https://docs.hedgedoc.org/configuration/))
- `CMD_HOST` and `CMD_PORT`: Interface and port to listen on (0.0.0.0 and 3000 by default), kept private to the proxy. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))

### Before it faces the internet

- Anonymous use is on by default; turn it off for a public instance. ([docs](https://docs.hedgedoc.org/configuration/))
- The production guide says to set CMD_ALLOW_ANONYMOUS to false. ([docs](https://docs.hedgedoc.org/guides/production-ready/))
- Open email registration is on by default; set CMD_ALLOW_EMAIL_REGISTER=false and create accounts with bin/manage_users if you want it closed. ([docs](https://docs.hedgedoc.org/configuration/))
- Set CMD_SESSION_SECRET or every restart logs everyone out. ([docs](https://docs.hedgedoc.org/configuration/))
- The /status and /metrics endpoints are exposed by default. ([docs](https://docs.hedgedoc.org/guides/production-ready/))
- The sample compose uses a placeholder database password. ([docs](https://docs.hedgedoc.org/setup/docker/))

## Things to ask next

Everything after the install is one more sentence to the agent. Some that come up:

- "Import this folder of Markdown notes, keeping the folder structure."
- "Turn off public sign-ups now that my account exists."
- "Move HedgeDoc to app.example.com." Add the domain on the dashboard's Domains page with a CNAME to `domains.envhaven.app`, and the agent changes HedgeDoc's address settings to match.
- "Update HedgeDoc to the latest release." It pulls the new image and recreates the container, data kept.

## Instructions for the agent

The agent reads these from the page's Markdown copy. They also work pasted on their own, if you would rather give them in your own words.

```text
Set up HedgeDoc on this workspace and serve it at my preview URL.
- Use Docker Compose with the official image, quay.io/hedgedoc/hedgedoc, starting from the docs' compose file: https://docs.hedgedoc.org/setup/docker/. If `docker compose` is missing, install the Compose plugin into ~/.docker/cli-plugins first.
- The docs' setup includes: a database: PostgreSQL in the sample (postgres:18.6-alpine); MySQL, MariaDB and SQLite are also supported.
- Keep the compose file in ~/apps/hedgedoc and all of its data in folders there (bind mounts, not named volumes), with restart: unless-stopped on every service.
- This server has no firewall, so publish no port on its public IP, and drop host networking and privileged mode from the docs' compose file. Docker runs on the host: connect this workspace to the compose network and relay my preview URL's port to HedgeDoc's port 3000.
- The preview URL terminates HTTPS in front of HedgeDoc: serve plain HTTP on its port, and trust the forwarded headers the relay passes on.
- Set what "The settings it needs behind a proxy" lists on https://envhaven.com/self-host/hedgedoc.md for the preview URL, as HedgeDoc's docs describe for running behind a proxy; skip any that apply only when HedgeDoc serves HTTPS itself.
- Before the preview URL serves it, apply what "Before it faces the internet" lists on https://envhaven.com/self-host/hedgedoc.md.
- When it answers at the preview URL, send me the link and tell me what to back up.
- If I asked for my tailnet instead of the preview URL, set HedgeDoc up the same way but follow https://envhaven.com/guides/self-host-privately-with-tailscale.md for the network: no preview URL, no relay.
```

## What to know

- In Docker, HedgeDoc's containers keep running when the workspace restarts or updates. The relay from the preview URL is a process in the workspace, so after a restart or an update, ask the agent to restore it.
- Cloudflare Rocket Loader can break the app and must be off. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- Real-time editing needs WebSocket upgrades on the socket.io path; the page's generic sentence says /sockets.io/ but its nginx example uses /socket.io/. ([docs](https://docs.hedgedoc.org/guides/reverse-proxy/))
- Uploaded images go to the local filesystem by default, which must be a persistent volume; S3, MinIO, Azure, Imgur or lutim are alternatives. No upload size setting is documented. ([docs](https://docs.hedgedoc.org/configuration/))
- Notes are limited to 100000 characters by default. ([docs](https://docs.hedgedoc.org/configuration/))
- Built-in accounts have no self-service password reset or two-factor authentication, and no email setup is documented, so nothing needs outbound mail. ([docs](https://docs.hedgedoc.org/guides/production-ready/))
- SQLite is fine for one user; the docs advise a database server for production. ([docs](https://docs.hedgedoc.org/guides/production-ready/))
- The 1.x line is maintenance-only; HedgeDoc 2 is an unfinished rewrite in alpha. ([docs](https://github.com/hedgedoc/hedgedoc/blob/develop/README.md))
- A workspace has one preview URL and one custom domain, both serving the same port, so it puts one app on a public address at a time.

## Without a workspace

The manual route, on a server you run:

1. Rent a Linux VPS, secure SSH, and create a user for the app.
2. Install Docker and write a compose file from the official image.
3. Put a reverse proxy in front (Caddy, nginx or Traefik), get certificates, and point a domain at the server.
4. Set the proxy settings listed above for that domain, and pass WebSocket upgrades through the proxy if the app uses them.
5. Keep the firewall closed except for the proxy, and schedule backups and updates.

HedgeDoc's own [documentation](https://docs.hedgedoc.org/setup/getting-started/) covers each step for its install methods.

## Sources

Facts about HedgeDoc come from its own documentation, checked on 2026-11-23:

- [docs.hedgedoc.org/setup/getting-started](https://docs.hedgedoc.org/setup/getting-started/)
- [docs.hedgedoc.org/setup/docker](https://docs.hedgedoc.org/setup/docker/)
- [docs.hedgedoc.org/setup/manual-setup](https://docs.hedgedoc.org/setup/manual-setup/)
- [docs.hedgedoc.org/guides/reverse-proxy](https://docs.hedgedoc.org/guides/reverse-proxy/)
- [docs.hedgedoc.org/configuration](https://docs.hedgedoc.org/configuration/)
- [docs.hedgedoc.org/guides/production-ready](https://docs.hedgedoc.org/guides/production-ready/)
- [github.com/hedgedoc/hedgedoc/blob/develop/README.md](https://github.com/hedgedoc/hedgedoc/blob/develop/README.md)

## Keep reading

- [Self-host any app with your agent](https://envhaven.com/self-host)
- [Self-host AFFiNE](https://envhaven.com/self-host/affine)
- [Self-host Memos](https://envhaven.com/self-host/memos)
- [Self-host SiYuan](https://envhaven.com/self-host/siyuan)
- [Self-host Trilium Notes](https://envhaven.com/self-host/trilium)
- [AI agent hosting](https://envhaven.com/guides/ai-agent-hosting)

Source: https://envhaven.com/self-host/hedgedoc
