The backend of FAITH exposes a RESTful API that is developed using FastAPI, that is leveraged by the frontend for querying. It is advisable to use Docker for working with the backend, and if it's to be used along with the frontend, it's recommended to use Docker compose for easier development.
- Python: Used for development of backend with FastAPI. Installing Python usually ensures installation of
pip, which can be used for package management. - Docker: (optional) Supports containerization of backend for easier deployment.
- Ensure you have Python, pip and Docker (optional) on your system:
python --version
pip --version
docker -v- Install the needed dependencies for the project after cloning the project and setting a virtual environment by the following command:
git clone https://github.com/KierthanaRS/FAITH
cd FAITH/backend
python -m venv .venv
# For Linux
source .venv/bin/activate
# For Windows
.venv\\Scripts\\Activate.ps1-
Configure the needed environment variables as per
.env.samplefile. Generate a secret for JWT to be stored underJWT_SECRETenvironment variable. -
Start the development server with the following command:
gunicorn -k uvicorn.workers.UvicornWorker -w 4 --certfile='../certs/faith.com+3.pem' --keyfile='../certs/faith.com+3-key.pem' -b localhost:8000 server:appThe backend should be accessible at https://localhost:8000
- Build a Docker image with the following command after configuring the necessary environment variables (assuming you're using
FAITH/backendas the working directory):
docker build -t faith-backend:latest .- Run the image with the following command:
docker run --network host faith-backend:latest The backend should be accessible at http://localhost:8000