lexicongovernance / pluraltools-backend

This repository contains the backend implementation for the plurality research project. The backend is responsible for handling various functionalities to support the plurality research platform.
GNU General Public License v3.0
3 stars 1 forks source link

Forum backend

Project structure

  1. db contains all the db models. A global overview can be found here
  2. routers contains all the api routers which map urls to the service.
  3. services contains all business logic for the routes.
  4. handlers contains all request and response management.
  5. middleware contains all the middleware that is used in the routers before the code reaches the service.
  6. modules contains all voting models implemented in the forum backend.
  7. types contains all the zod types that are needed for validation.

For developers

  1. install nodejs v20.14.0
    • On WSL (Windows Subsystems for Linux) install node.js v20 as follows:
      1. curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
      2. sudo apt install -y nodejs
  2. install pnpm
  3. update .env with custom values
  4. start services needed to run backend make docker-run
  5. pnpm install
  6. pnpm build only required on the first run
  7. pnpm dev

unit testing

database list of commands

db migrations

  1. create a file in the db with the new table schema
  2. run pnpm db:generate
  3. restart server and migrations should auto run