Skip to content

Setup

Installation for Development

  1. clone the repository:
bash
git clone https://github.com/Dino-Kupinic/Schulbuchaktion.git

Frontend

  1. go into the frontend directory
bash
cd frontend
  1. install packages
bash
pnpm i

TIP

If you don't have pnpm installed, checkout https://pnpm.io/installation to install for your operating system.

  1. define environment variables

Create a .env file and checkout the .env.example. Copy the content into your .env and replace the following fields with your own. You may edit some existing fields aswell.

FieldDescription
BACKEND_URLURL to the Symfony Backend server (e.g. http://localhost:8000/api/v1 in dev)

Make sure to include the /api/v1 suffix at the end of the URL. This environment variable is used for the Base URL for fetch requests.

  1. run dev server
bash
pnpm run dev
  1. Head to http://localhost:3000/

If it works, great!

WARNING

Following instruction is optional and may be skipped. If you have slow internet, it may take a while to install Chrome, Safari and Firefox (~150 MB)

  1. Install playwright browsers
npx playwright install

Backend

  1. go into the backend directory
bash
cd ../backend

or

bash
cd backend
  1. define environment variables

Create a .env file and checkout the .env.example. Copy the content into your .env and replace the following fields with your own. You may edit some existing fields aswell.

FieldDescription
APP_SECRETA secret key that's used to secure your application's services.
SECRET_PASSWORDDatabase password
USERNAMEDatabase user
BIND_PORTDatabase port
DATABASE_URLThe URL String to your database. It will use the env variables above.
LDAP_PORTThe port of your LDAP server.
LDAP_URLThe URL of your LDAP server.
LDAP_BASEThe base of your LDAP server. (dc=schulbuchaktion,dc=env)
ROLESString of all roles seperated with commas (default 'SBA_ADMIN,SBA_LEHRER,SBA_FV,SBA_AV')
SBA_ADMINGroup number of the admin group. (default 500)
SBA_LEHRERGroup number of the teacher group. (default 501)
SBA_FVGroup number of the subject responsible group. (default 502)
SBA_AVGroup number of the head of department group. (default 503)
TOKEN_TIMEOUTHow long a token is valid. (default 1800)
HOURS_AHEADTimezone (default 2)
JWT_SECRET_ABSOLUT_PATHThe absolute path to the private key for the JWT.
CORS_ALLOW_ORIGINThe origin that is allowed to access the API. (default localhost)
TOKEN_NAMEName of Cookie which contains bearer token (default bearer)
CADDY_MERCURE_JWT_SECRETUsed to securely sign JWTs for client authentication and authorization in a Caddy server setup with Mercure.
TRUSTED_PROXIESSpecifies the IP addresses or ranges of proxies that are trusted to correctly set client-related headers in a server configuration.
TRUSTED_HOSTSSpecifies a list of hostnames or patterns that are considered trusted and allowed to make requests.
CADDY_MERCURE_URLSpecifies the URL of the Mercure hub used by the Caddy server.
CADDY_MERCURE_PUBLIC_URLSpecifies the publicly accessible URL of the Mercure hub.
HTTP_PORTPort which will be open for http connections. (default 80)
HTTPS_PORTPort which will be open for https connections. (default 443)
SHELL_VERBOSITYVerbosity level of server and symfony. (default 0)

DANGER

For the APP_SECRET checkout https://symfony.com/doc/current/reference/configuration/framework.html#secret to see the latest requirements.

  1. start docker
bash
docker compose up -d

TIP

If you don't have docker installed, checkout https://www.docker.com/products/docker-desktop/ to install for your operating system.

  1. install dependencies
bash
composer update

DANGER

If you get errors, you might have to comment out modules like ldap or zip in your php.ini file. Composer will tell you what to do.

  1. start the dev server
bash
symfony server:start

WARNING

If you don't have symfony cli installed, checkout https://symfony.com/download#step-1-install-symfony-cli to install for your operating system.

  1. head to http://127.0.0.1:8000

Docs

  1. go into the docs directory
bash
cd ../docs

or

bash
cd docs
  1. install packages
bash
pnpm i

TIP

If you don't have pnpm installed, checkout https://pnpm.io/installation to install for your operating system.

  1. run dev server
bash
pnpm run docs:dev
  1. Head to http://localhost:5173/

Released under the MIT License.