This is a simple page which is used to book TIHLDE's office!
git clone https://github.com/tihlde/kontresv2.git
cd kontresv2
# If this is your first time running the application:
pnpm install
# Thats it!From now on, it's enough to run pnpm run dev to start the application.
To run a local PostgreSQL database for development:
docker compose up -dThis starts Postgres 16 on localhost:5433 (port 5433 avoids conflict with a local Postgres on 5432). Credentials come from your .env (see .env.example). Apply migrations with:
pnpm prisma migrate deployStop the database with docker compose down.
The application requires configuration of some environment variables in order to run. These should be put in a .env file in the repository root. .env.example lists them all.
DATABASE_URL="postgresql://..."
AUTH_SECRET="..."
AUTH_URL="https://kontres.tihlde.org"
PHOTON_API_URL="https://photon.tihlde.org"
PHOTON_OAUTH_CLIENT_ID="<generert av Photon>"
PHOTON_OAUTH_CLIENT_SECRET="tihlde_cs_..."Innlogging går via Photon (tihlde.org) med OAuth2 og PKCE. KontRes lagrer ingen passord og snakker ikke med Lepton.
Appen må være registrert som OAuth-klient i Photon. Det gjøres i adminpanelet på
tihlde.org under Super admin → OAuth-klienter — ikke direkte i databasen:
klienthemmeligheten lagres hashet, og en rå verdi i basen blir avvist med
invalid client_secret. Klienten trenger:
- Redirect URI:
<AUTH_URL>/api/auth/callback/tihlde - Scopes:
openid,profile,emailogoffline_access
Photon genererer både client_id og client_secret, og viser dem én gang når
klienten er opprettet. client_id er en tilfeldig streng på 32 tegn — den kan
altså ikke settes til «kontres». Kopier begge ordrett inn i .env.
offline_access er ikke valgfritt. Uten det utsteder Photon ikke noe
refresh-token, og innloggingen varer bare én time.
Hemmeligheten inkluderer prefikset tihlde_cs_; det er en del av verdien og
skal med i PHOTON_OAUTH_CLIENT_SECRET.
AUTH_URL må være satt i miljøet appen faktisk kjører i. Uten den bygger
Auth.js absolutte URL-er fra containerens eget vertsnavn (https://<container-id>:3000),
og innloggingen sender brukeren til en adresse som ikke finnes.
- NextJS
- Typescript
- Tailwind
- Shadcn
KontRes is an open source project built on voluntary work. We are committed to a fully transparent development process and highly appreciate any contributions. Whether you are helping us fixing bugs, proposing new features, improving our documentation or spreading the word - we would love to have you as part of the community.
Feel free to file a new issue with a respective title and description on the the tihlde/kontresv2 repository. If you already found a solution to your problem, we would love to review your pull request! Please format your code with prettier. If you open the workspace-file in VSCode, the code will be formatted automatically on save.
Feel free to send us a message on our official slack channel. Of course you can always reach out to us directly at index@tihlde.org.
The code in this project is licensed under MIT license.