Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 1.69 KB

File metadata and controls

44 lines (26 loc) · 1.69 KB

FARM-docker backend API

This directory contains the backend API app. It is built with FastAPI.

Requirements

  • uv for Python package and environment management.
  • A MongoDB database for persistence.

Install

The project uses uv to manage dependencies and run the backend application. You can install the project and its dependencies with uv sync.

Running the server

To start a development server, run

uv run fastapi dev app/main.py

from the backend directory (remove the uv run prefix if using another dependency management tool).

This will start a server running on http://127.0.0.1:8000. The API will be available on the API's base prefix, which by default is /api/v1.

Navigate to http://localhost:8000/api/v1/ to access the root API path. Navigate to http://localhost:8000/docs to access the API's documentation. Navigate to http://localhost:8000/redoc to access the API's alternative doc built with ReDoc.

Running the tests

Run

uv run pytest

to run the unit tests for the backend app.

Configuration

The project uses Pydantic's settings management through FastAPI. Documentation on how the settings work is availabe here.

The configuration file is located in config/config.py. This file defines the setting properties, their types, and default values. The model_config attribute specifies where these properties are from, i.e. the .env file at the root of the project. Modify the values in the .env file to change the configuration.