Skip to content

Nest & Prisma backend for the new Konzisite, an app for students to organize and sign up for consultations.

Notifications You must be signed in to change notification settings

kir-dev/konzisite-api

Repository files navigation

Konzisite header

Description

Konzisite is a web application for the students of Budapest University of Technology and Economic Faculty of Electrical Engineering and Informatics to organise consultations, study sessions where students help each other. This repository contains the backend REST API for that application, built with Typescript TypeScript, NestJS NestJS and Prisma Prisma. See the frontend repository here. The application was developed by Kir-Dev Kir-Dev. For more information about the project, see our project page or our blogpost, both in Hungarian.

Preperation

First, start a PostgreSQL server locally on your machine.

Then create an OAuth client at AuthSCH with the following redirect address: http://localhost:3300/auth/callback

Finally, copy the contents of .env.example to a new file named .env. Replace the database credentials with the credentials required to connect to your local database and the AuthSCH credentials with ID and secret that AuthSCH generated for your client.

Installation

# Install the dependencies
npm install
# Then apply the migrations
npx prisma migrate dev
# Optionally seed the databse with mock data
npm run seed

Running the app

# development
npm run start

# watch mode
npm run dev

# production mode
npm run start:prod

# running prisma studio, easy way to explore and manipulate the db
npx prisma studio

Setting up a Postman collection

If you want to use Postman for testing the endpoints, you can import postman_collection.json from the root of the project into Postman. This will create a collection with some of the endpoints of the app already defined. To use it, create two new variables in the Environments -> Globals tab:

  • baseUrl: the value should be the URL where the backend is running, so most likely http://localhost:3300
  • token: the value should be your JWT token. You can get this by running both the backend and frontend apps. After logging in, you can copy the token from the JWT_TOKEN cookie.

If you add new endpoints to the collection that you think the others could use, please overwrite the postman_collection.json file with the export of the modified collection, and commit it.

Docker deployment

Edit the .env file accordingly, set the exposed port to your liking.

docker-compose up --build [-d]