Before proceeding, ensure that you have the following installed on your system:
- Python (>= 3.8) -> I am using Python 3.11.7
pip(Python package manager)venv(Python virtual environment module)- Firebase Admin SDK private key (detailed below)
To keep dependencies isolated, create a virtual environment:
python -m venv venvTo activate, run:
On Mac:
source venv/bin/activateOn Windows:
venv\Scripts\activateTo install all dependencies, run:
pip install -r requirements.txt && playwright install --with-depsCreate a GroqCloud account and generate an API key. Set up an .env file with GROQ_API_KEY={value here}.
In order for the service to access the BiteBook's Firebase project, you must include a private key.
To do this,
- Navigate to the Firebase console
- Go to the
Project Settings - Go to
Service Accounts - Click Generate new private key.
- Rename this
.jsonasbitebook-admin-credential.jsonand place it in./BiteBook-Backend/firebase-admin-sdk/.
In the root directory, run the following command to start up FastAPI
uvicorn main:app --reloadOnce the server starts, you can access the GraphQL endpoint at http://127.0.0.1:8000/graphql.
Accessing this URL on a browser will open up the GraphQL playground, where you can test the endpoint within a UI.
In the root directory, run the following command to run unit tests that validate the core features of BiteBook's GraphQL backend.
pytestTo run the unit tests without deprecation warnings, run the following:
pytest -W ignore::DeprecationWarning