You should stay in the ZITADEL root directory to execute the statements in the following chapters.
## Prerequisite
- Buildkit compatible docker installation
### env variables
You can use the default vars provided in [this .env-file](../build/local/local.env) or create your own and update the paths in the [docker compose file](../build/local/docker-compose-local.yml).
## Generate required files
This part is relevant if you start the backend or console without docker compose.
### Console
This command generates the grpc stub for console into the folder console/src/app/proto/generated for local development.
You can stop as soon as db-migrations AND backend-setup returned with exit code 0.
### Initialise frontend
Used to set the client id of the console. This step is for local development. If you don't work with a local backend you have to set the client id manually.
You must [initialise the data](###-Initialise-data)) first.
The command exists as soon as the client id is set.
### Run database
Used if you want to run the backend/console locally and only need the database. It's recommended to [initialise the data](###-Initialise-data) first.
```bash
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f ./build/local/docker-compose-local.yml --profile database -p zitadel up
```
**On apple silicon:**
Restart the command (second terminal `docker restart zitadel_<SERVICE_NAME>_1`) if `db` logs `qemu: uncaught target signal 11 (Segmentation fault) - core dumped` or no logs are written from `db-migrations`.
### Run Console
The console service is configured for hot reloading. You can also use docker compose for local development.
If you don't use the backend from local you have to configure [the environment.json](../build/local/environment.json) manually.
If you use the local backend ensure that you have [set the correct client id](###-Initialise-frontend).
#### Run console in docker compose
```bash
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f ./build/local/docker-compose-local.yml --profile frontend -p zitadel up
```
### Run backend
Used if you want to run the backend locally. It's recommended to [initialise the data](###-Initialise-data) first.
go run cmd/zitadel/main.go -console=false -localDevMode=true -config-files=cmd/zitadel/startup.yaml -config-files=cmd/zitadel/system-defaults.yaml -config-files=cmd/zitadel/authz.yaml start
```
If you want to run your backend locally and the frontend by docker compose you have to replace the following variables: