To run the frontend of INJECT, you have two options, each with its own set of requirements. The first method utilizes [yarn](#running-with-yarn), while the second employs [Docker](#docker-deployment).
## Running with yarn
To run the frontend application using yarn, ensure you have the following prerequisites:
*[Node 20 LTS](https://nodejs.org/en)
*[Yarn](https://yarnpkg.com/)
Further make sure that backend server is running and on a known address. Make sure to set the appropriate address in src/config.ts and also in Backend KNOWN_HOSTS.
Once you have these installed and everything configured, follow these steps:
First run the following command to install project dependencies:
```
yarn
```
Then run the frontend development server:
```
yarn dev
```
If you're on Windows, ensure that Git is installed and run the command on GitBash:
```
GIT_ENABLED=1 yarn dev
```
If you want to build the frontend, then follow these steps:
Compile the graphql and shared library:
```
yarn prebuild
```
Then biuld the `dist/` artifact from the frontend repository:
```
yarn build
```
## Docker deployment
Repository has a prepared Dockerfile which can be compiled accordingly.
```
docker build . -t inject-fe
```
To deploy the docker container, you only need to execute:
```
docker run -p 80:80 inject-fe
```
During runtime of the container it's required to bind the container to a given `backend` instance. This can be done accordingly
```
docker run -p 80:80 -e VITE_HTTP_HOST=secure-be.inject.muni.cz -e VITE_HTTP_WS=wss://secure-be.inject.muni.cz/ttxbackend/v1/graphql inject-fe
```
Please mind, that changing environment variables requires restart of the container if done during the runtime.
# run backend server on a known address, set it appopriately in src/config.ts and also in Backend KNOWN_HOSTS
# first run backend in different pane
poetry run python manage.py runserver
# then after running backend, run frontend dev
yarn dev
# if on windows, make sure that Git is installed and run on GitBash
GIT_ENABLED=1 yarn dev
# if building
# this step is mandatory, it compiles `graphql` and `shared` library
yarn prebuild
# this builds the `dist/` artifact from `frontend` repo.
yarn build
```
## Docker deployment
Repository has a prepared Dockerfile which can be compiled accordingly.
```
docker build . -t inject-fe
```
To deploy the docker container, you only need to execute:
```
docker run -p 80:80 inject-fe
```
During runtime of the container it's required to bind the container to a given `backend` instance. This can be done accordingly
```
docker run -p 80:80 -e VITE_HTTP_HOST=secure-be.inject.muni.cz -e VITE_HTTP_WS=wss://secure-be.inject.muni.cz/ttxbackend/v1/graphql inject-fe
```
Please mind, that changing environment variables requires restart of the container if done during the runtime.
After ensuring that the backend is properly configured and running, proceed with the installation steps for frontend outlined in [INSTALATION.md](INSTALATION.md).