It's highly recommended to use PyCharm Professional Edition as the IDE.
The IDE is free for students by signing up for a GitHub Student Developer Pack.
- Install PostgreSQL locally
brew install postgresql - Install Python 3.12
- Initiate virtual environment Mac, Windows
- Install dependencies
pip install -r requirements.txt - Create a
.envfile in the root directory and add following lines with your own credentials:DB_USER=<postgresql username> DB_PASSWORD=<postgresql password> DB_DB=postgres SECRET_KEY=<secret key for JWT> ATTACHMENT_BUCKET_NAME=<GCP Storage bucket name> GCP_KEY_FILE_PATH=<GCP key file path> - Run the
init-db.sqlscript in the local postgresql DB - Run
uvicorn app.main:app --reloadto start the server
app- Main application packagemodels- SQLAlchemy database models (ORM)schemas- Pydantic schemas. All request/response body should be defined hereservices- Business logicrouters- API endpointscore- Common logic
- All endpoints except signup and sign in require authentication.
- Requests can authenticate themselves in one of the two ways:
- API Key: Add
Api-Tokenheader with the application's API key - Session Token: Add
Authorizationheader with the session token returned by the sign in endpoint - In case both methods are used, API key will be used for authentication
- API Key: Add