Skip to content

OSDG-IIITH/cwdb

Repository files navigation

cwdb

cwdb is a coursework discovery platform that helps students find useful course resources from previous years in one place.

Prerequisites

Docker, Rust, cargo, sqlx-cli and bun

Setup

Copy the env file:

cp .env.example .env

Start Postgres (port 5433) and Meilisearch (port 7700):

docker-compose up -d

Run database migrations:

cd backend && sqlx migrate run

Backend

First, copy the .env file:

cd backend && cp .env.example .env

The backend supports two auth methods, selected at compile time:

Feature Auth Command
ocas ocas cargo run
cas iiit cas cargo run --no-default-features --features cas

Add the mock feature to either to use mock authentication when no auth server is accessible.

See .env.example for relevant environment variables.

The backend runs on http://localhost:3000.

Frontend

Copy the frontend env file:

cp frontend/.env.example frontend/.env

If you're using mock auth, set a mock email in frontend/.env:

VITE_USE_MOCK_AUTH="true"
VITE_MOCK_EMAIL=you@students.iiit.ac.in

Then start the frontend:

cd frontend
bun install
bun dev

The frontend runs on http://localhost:5173.

Scripts

cwdb comes with scripts to seed and manage data.

courses.py merges monsoon.json, spring.json, and extra.json into SQL INSERT statements for seeding the courses table:

python3 backend/scripts/courses.py | psql $DATABASE_URL

sources.sql seeds the database with known sources:

psql $DATABASE_URL < backend/scripts/sources.sql

regclient.sh registers the app with an ocas instance and prints the client ID and secret to paste into your .env:

bash backend/scripts/regclient.sh

Nix ❄️

If you use Nix, enter the development shell with:

nix develop

If you use direnv:

direnv allow

About

courseworkdb

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors