2020-11-30 12:12:56 +00:00
---
2021-06-21 19:25:56 +00:00
title: Full development environment
2020-11-30 12:12:56 +00:00
---
2022-06-05 21:26:08 +00:00
## Requirements
2021-10-04 15:54:06 +00:00
2022-11-13 13:20:55 +00:00
- Python 3.11
2022-05-09 19:22:41 +00:00
- poetry, which is used to manage dependencies, and can be installed with `pip install poetry`
- Go 1.18
- PostgreSQL (any recent version will do)
- Redis (any recent version will do)
2022-06-05 21:26:08 +00:00
- Node 16 (or later)
2020-11-30 12:12:56 +00:00
2022-06-05 21:26:08 +00:00
## Services Setup
2020-11-30 12:12:56 +00:00
2022-08-01 21:05:58 +00:00
For PostgreSQL and Redis, you can use the docker-compose file in `scripts/` .
2022-06-05 21:26:08 +00:00
You can also use a native install, if you prefer.
## Backend Setup
2021-10-04 15:54:06 +00:00
```shell
2021-12-24 22:25:38 +00:00
poetry shell # Creates a python virtualenv, and activates it in a new shell
poetry install # Install all required dependencies, including development dependencies
2021-10-04 15:54:06 +00:00
```
2022-08-01 21:05:58 +00:00
To configure authentik to use the local databases, we need a local config file. This file can be generated by running `make gen-dev-config` .
2020-11-30 12:12:56 +00:00
2021-10-11 20:33:31 +00:00
To apply database migrations, run `make migrate` . This is needed after the initial setup, and whenever you fetch new source from upstream.
2021-07-26 20:52:58 +00:00
Generally speaking, authentik is a Django application, ran by gunicorn, proxied by a Go application. The Go application serves static files.
2020-11-30 12:12:56 +00:00
Most functions and classes have type-hints and docstrings, so it is recommended to install a Python Type-checking Extension in your IDE to navigate around the code.
2022-09-06 22:23:25 +00:00
Before committing code, run `make lint` to ensure your code is formatted well. This also requires `pyright` , which is installed in the `web/` folder to make dependency management easier.
2021-04-18 15:25:03 +00:00
2021-05-16 21:24:52 +00:00
Run `make gen` to generate an updated OpenAPI document for any changes you made.
2021-04-18 15:25:03 +00:00
2022-06-05 21:26:08 +00:00
## Frontend Setup
2020-11-30 12:12:56 +00:00
2022-06-05 21:26:08 +00:00
By default, no compiled bundle of the frontend is included so this step is required even if you're not developing for the UI.
2021-03-18 21:02:04 +00:00
2022-11-03 09:15:28 +00:00
To build the UI once, run `make web-build` .
2020-11-30 12:12:56 +00:00
2022-08-01 21:05:58 +00:00
Alternatively, if you want to live-edit the UI, you can run `make web-watch` instead.
2022-06-05 21:26:08 +00:00
This will immediately update the UI with any changes you make so you can see the results in real time without needing to rebuild.
To format the frontend code, run `make web` .
2020-11-30 12:12:56 +00:00
2022-06-05 21:26:08 +00:00
## Running
2021-04-18 15:25:03 +00:00
2022-06-05 21:26:08 +00:00
Now that the backend and frontend have been setup and built, you can start authentik by running `make run` . authentik should now be accessible at `http://localhost:9000` .