To run HedgeDoc 2.0 you need three components: the backend, the frontend and the reverse proxy.
Backend and Frontend are included in the [HedgeDoc repo](https://github.com/hedgedoc/hedgedoc). The reverse proxy can be chosen by preference. For development, we
recommend caddy and the provided configuration.
## Quick guide for development setup
This describes the easiest way to start a local development environment. For other deployments follow the description
below.
To run HedgeDoc 2.0 you need three components: the backend, the frontend and the reverse proxy.
Backend and Frontend are included in the [HegdeDoc repo](https://github.com/hedgedoc/hedgedoc). The reverse proxy can be chosen by preference. For development, we
recommend caddy and the provided configuration.
1. Install Node.js (at least Node 14, we recommend Node 18) and [Yarn](https://yarnpkg.com/getting-started/install)
2. Install Caddy (select one of the two options)
- [Download](https://caddyserver.com/) and place the `caddy` binary in `hedgedoc/dev-reverse-proxy`. Ensure it is executable with `chmod +x caddy`. Users of macOS may need to run `xattr -d com.apple.quarantine ./caddy` to lift the quarantine for executables from the internet.
- Install Caddy using your package manager
3. Clone [our repository](https://github.com/hedgedoc/hedgedoc.git) and go into its directory
4. Install the dependencies in repo root directory with `yarn install`
5. Go to `hedgedoc/commons` directory with `cd ../commons`
6. Build the commons package with `yarn build`
7. Goto `hedgedoc/backend` directory with `cd ../backend`
8. Create the `.env` config file by copying the example: `cp .env.example .env`
9. Add a value to `HD_SESSION_SECRET` in the .env file. This can be any string, which has to be a secure password for production but can be set to simple string for debug purpose.
10. Execute the following lines
```shell
echo "HD_AUTH_LOCAL_ENABLE_LOGIN=true" >> .env
echo "HD_AUTH_LOCAL_ENABLE_REGISTER=true" >> .env
```
11. Start the backend using `yarn start:dev`
12. Go to `hedgedoc/frontend` directory with `cd ../frontend`
13. Start the frontend using `yarn run dev:with-local-backend`
14. Go to `hedgedoc/dev-reverse-proxy` with `cd ../dev-reverse-proxy`
15. Start Caddy using `./caddy run` (if you've downloaded the binary manually) or `caddy run` (if you've installed Caddy using a package manager)
16. Use your browser to go to <http://localhost:8080>
## Preconditions
If you want to run HedgeDoc in dev mode some preconditions have to be met.
**Note:** The backend can be mocked instead of starting it for real. This is useful, if you just want to work on the frontend. See the "Mocked backend" section below.
1. Download the latest version of Caddy from [the Caddy website](https://caddyserver.com/) or alternatively install it
using your package manager. You don't need any plugin. Place the downloaded binary in the
directory `dev-reverse-proxy`. Don't forget to mark the file as executable using `chmod +x caddy`. Users of macOS may need to run `xattr -d com.apple.quarantine ./caddy` to lift the quarantine for executables from the internet.
2. Start Caddy using `./caddy run` (if you downloaded the binary manually) or `caddy run` (if you installed Caddy via a package manager).