129 lines
4.8 KiB
Plaintext
129 lines
4.8 KiB
Plaintext
---
|
|
title: Getting started
|
|
tags:
|
|
- Developer
|
|
- Technical documentation
|
|
- Code
|
|
- Programming
|
|
sidebar_position: 1
|
|
---
|
|
|
|
## Set up your development environment
|
|
|
|
### Prerequisites
|
|
|
|
- **Node.js 24.18 or newer**: You can download it from the [official website](https://nodejs.org/).
|
|
- **Corepack**: Run `corepack enable` so the repository selects its pinned pnpm 11 version.
|
|
- **Git**: You can download it from the [official website](https://git-scm.com/).
|
|
- **Docker or Docker Desktop**: Required for the Redis service and the developer Docker CLI.
|
|
- **Go 1.25+**: Required only for the developer Docker CLI. You can download it from the [official website](https://go.dev/).
|
|
- **GitHub CLI**: Required only for pull-request image features. Install it from the [official website](https://cli.github.com/), then authenticate with `gh auth login`.
|
|
|
|
The versions in the root `package.json` are the supported baseline. Let Corepack select the repository version instead
|
|
of installing an unrelated global pnpm:
|
|
|
|
```sh
|
|
corepack enable
|
|
corepack install
|
|
pnpm install --frozen-lockfile
|
|
```
|
|
|
|
### Run the Homarr application
|
|
|
|
1. Copy `.env.example` to `.env`.
|
|
2. Set `DB_URL` to an absolute writable SQLite file path.
|
|
3. Keep Redis and the optional local databases running in one terminal.
|
|
4. Apply migrations and start Next.js in another terminal.
|
|
|
|
```sh
|
|
cp .env.example .env
|
|
```
|
|
|
|
Terminal 1:
|
|
|
|
```sh
|
|
pnpm docker:dev
|
|
```
|
|
|
|
Terminal 2:
|
|
|
|
```sh
|
|
pnpm db:migration:sqlite:run
|
|
pnpm dev
|
|
```
|
|
|
|
The infrastructure command remains in the foreground. Open `http://127.0.0.1:3000`; the first user created through
|
|
Homarr becomes the instance administrator.
|
|
Use `pnpm docker:dev:up` instead when you only need Redis in the background. Running the migration also seeds the
|
|
default data; use `pnpm db:seed` to seed it explicitly later.
|
|
|
|
### Run PocketBase and documentation
|
|
|
|
Start PocketBase in another terminal:
|
|
|
|
```sh
|
|
cp apps/workshop/.env.example apps/workshop/.env
|
|
docker compose --env-file apps/workshop/.env -f apps/workshop/docker-compose.yml up --build workshop
|
|
```
|
|
|
|
Then start Docusaurus in a third terminal:
|
|
|
|
```sh
|
|
WORKSHOP_API_URL=http://127.0.0.1:8090 pnpm dev:docs
|
|
```
|
|
|
|
PocketBase runs on port 8090 and Docusaurus on port 3003. Stopping the services preserves the PocketBase volume.
|
|
|
|
Open `http://127.0.0.1:8090/_/` and create the first PocketBase superuser. The Workshop UI is available at
|
|
`http://127.0.0.1:3003/workshop`.
|
|
|
|
Point Homarr at the local services with:
|
|
|
|
```dotenv
|
|
HOMARR_WEBSITE_URL=http://127.0.0.1:3003
|
|
WORKSHOP_API_URL=http://127.0.0.1:8090
|
|
WORKSHOP_WEB_URL=http://127.0.0.1:3003/workshop
|
|
```
|
|
|
|
Restart `pnpm dev` after changing `.env`. GitHub OAuth is optional locally. See
|
|
[`apps/workshop/README.md`](https://github.com/homarr-labs/homarr/blob/HEAD/apps/workshop/README.md) for OAuth,
|
|
Workshop moderator promotion, logs, tests, backup, restore, stopping, and intentional volume reset.
|
|
|
|
### URL testing
|
|
|
|
Docusaurus reads `HOMARR_WEBSITE_URL` and `WORKSHOP_API_URL` when it starts or builds. Homarr also reads
|
|
`WORKSHOP_WEB_URL` when its server starts, so these values do not rely on `NEXT_PUBLIC_*` build variables. Test a
|
|
separate API origin before release:
|
|
|
|
```sh
|
|
HOMARR_WEBSITE_URL=http://127.0.0.1:3003 \
|
|
WORKSHOP_API_URL=http://127.0.0.1:8090 \
|
|
WORKSHOP_WEB_URL=http://127.0.0.1:3003/workshop \
|
|
pnpm dev:docs
|
|
```
|
|
|
|
### Useful commands
|
|
|
|
- `pnpm dev` — Next.js on port 3000.
|
|
- `pnpm dev:benchmark` — authenticated-board benchmark; readiness-only `--smoke` runs are not performance claims.
|
|
- `pnpm dev:cli -- dev` — browse and run local images and remote pull-request images.
|
|
- `pnpm dev:cli -- build <name>` — build the current checkout as `homarr:<name>`.
|
|
- `pnpm dev:cli -- build --pr <number>` — build a pull request from a temporary checkout.
|
|
- `pnpm dev:cli -- rebuild <name>` — rebuild an image from its recorded checkout or pull request.
|
|
- `pnpm dev:cli:install` — optionally install the developer CLI as a `homarr` binary.
|
|
- `pnpm dev:docs` — Docusaurus only on port 3003.
|
|
- `pnpm docker:workshop` — local PocketBase through Docker Compose.
|
|
- `pnpm docker:dev:up` — Redis development service in the background.
|
|
- `pnpm cli` — Homarr operations CLI.
|
|
- `pnpm db:migration:sqlite:run` — create or update a SQLite database.
|
|
- `pnpm db:seed` — seed the default database data explicitly.
|
|
- `pnpm db:studio` — inspect the database.
|
|
- `pnpm format` / `pnpm format:fix` — check or apply oxfmt.
|
|
- `pnpm lint` / `pnpm lint:fix` — check or apply oxlint.
|
|
- `pnpm typecheck` — typecheck all workspaces.
|
|
- `pnpm test` — unit and contract suites.
|
|
- `pnpm test:workshop` — disposable Workshop integration suite.
|
|
- `pnpm build` — production monorepo build.
|
|
- `docker build -t homarr .` — build a production Docker image.
|
|
- `docker run -p 7575:7575 -e SECRET_ENCRYPTION_KEY='your_64_character_hex_string' homarr:<name>` — run it.
|