71 lines
3.2 KiB
Plaintext
71 lines
3.2 KiB
Plaintext
---
|
|
title: Getting started
|
|
tags:
|
|
- Developer
|
|
- Technical documentation
|
|
- Code
|
|
- Programming
|
|
sidebar_position: 1
|
|
---
|
|
|
|
## Setting up your development environment
|
|
|
|
This guide will help you set up your development environment to start contributing to homarr.
|
|
|
|
### Prerequisites
|
|
|
|
- **Node.js (lts)**: You can download it from the [official website](https://nodejs.org/).
|
|
- **pnpm (latest)**: You can install it by running `npm install -g pnpm`.
|
|
- **Go (latest)**: You can download it from the [official website](https://go.dev/).
|
|
- **Git**: You can download it from the [official website](https://git-scm.com/).
|
|
- **GitHub CLI**: You can download it from the [official website](https://cli.github.com/).
|
|
- **Docker or Docker Desktop**: You can download it from the [official website](https://www.docker.com/).
|
|
- **A GitHub account**: You can create one on the [official website](https://github.com/).
|
|
|
|
### Setting up the project
|
|
|
|
1. Fork the repository by clicking on the "Fork" button on the top right corner of the repository page.
|
|
|
|

|
|
|
|
2. Clone the repository to your local machine with `git clone`. You can find the url to use by clicking on the "Code" button on the top right corner of your forks repository page.
|
|
|
|

|
|
|
|
3. Change directory to the project folder with `cd homarr`.
|
|
|
|
4. Set up the project with `pnpm dev:setup`. This installs dependencies, starts Redis, creates and migrates a local SQLite database, and installs the `homarr` developer CLI.
|
|
|
|
5. Start the development server with `pnpm dev` and wait for a message that says `✓ Ready in 10.7s`
|
|
|
|
6. Open your browser and navigate to [http://localhost:3000](http://localhost:3000). (Loading the page might take up to 2 minutes the first time)
|
|
|
|
### Useful npm scripts
|
|
|
|
#### During development
|
|
|
|
- `pnpm dev`: Start the development server.
|
|
- `pnpm dev:setup`: Set up dependencies, services, database, and developer CLI.
|
|
- `homarr dev`: Browse and run local images and remote pull-request images.
|
|
- `homarr build <name>`: Build the current checkout as `homarr:<name>`.
|
|
- `homarr build --pr <number>`: Build a pull request locally from a temporary checkout.
|
|
- `homarr rebuild <name>`: Rebuild a local image from its recorded checkout or pull request.
|
|
- `pnpm cli`: Run cli commands.
|
|
- `pnpm db:migration:sqlite:run`: Run the migrations to create or update the sqlite db file.
|
|
- `pnpm db:migration:sqlite:generate`: Generate a new migration file for the sqlite db. Also works with `mysql`.
|
|
- `pnpm db:studio`: Open a visual studio for the database.
|
|
- `pnpm package:new`: Create a new package in the monorepo.
|
|
|
|
#### Checking code quality
|
|
|
|
- `pnpm lint`: Run the linter to check for code quality issues.
|
|
- `pnpm format:fix`: Run the formatter to fix code style issues.
|
|
- `pnpm test`: Run the tests. You can also use `pnpm test:ui` to get a UI for the tests.
|
|
- `pnpm typecheck`: Run the typescript type checker.
|
|
|
|
#### Building the project
|
|
|
|
- `pnpm build`: Build the project for production.
|
|
- `homarr build <name>`: Build a `homarr:<name>` image and record its checkout for later rebuilds.
|
|
- `docker run -p 7575:7575 -e SECRET_ENCRYPTION_KEY='your_64_character_hex_string' homarr:latest`: Run the created docker image.
|