Building the project - QEDK/clarity GitHub Wiki

The following steps will let you build the project locally:

First of all clone the repository using the following the command:

$ git clone [email protected]:QEDK/clarity.git
$ cd clarity

Once you have cloned the repository, ensure you have python3 and node installed in your local machine:

$ python3 --version
$ Python 3.8.5 # or similar
$ node --version
$ v13.6.0      # or similar
$ npm --version
$ 6.13.4       # or similar

If you are not getting similar output, you can follow the official Python and Node documentation.

Now we will run the frontend and backend of the project as separate entitites.

Running the frontend

First, move into the frontend directory then install all dependencies to start the React server.

$ cd clarity/frontend
$ npm install
$ npm start

The server will start running at http://localhost:3000

Running the backend

Setup the database locally

Install postgresql and create a database named fastapidbname with the user name postgres and give your desired password

You can change the following line in backend/main.py with your password.

db_password = urllib.parse.quote_plus(str(os.environ.get("db_password", "<enter your password here>")))

If you want to create the database with your own creadentials, edit the following line in backend/main.py

db_name = os.environ.get("db_name", "<enter your database name>")
db_username = urllib.parse.quote_plus(str(os.environ.get("db_username", "<enter your database username>")))
db_password = urllib.parse.quote_plus(str(os.environ.get("db_password", "<enter your database password>")))

In a new terminal we will run the fastAPI server. Before that create a virtual environment and install all the requirements.

$ cd clarity
$ python3 -m venv env
$ source env/bin/activate
$ cd backend
$ pip install -r requirements.txt
$ uvicorn main:app --reload

The server will start running at http://localhost:8000 For testing the REST API with swagger UI open http://localhost:8000/docs in your browser