Skip to content

Backend for FE Intel (Fuel Efficiency Intelligence App)

License

Notifications You must be signed in to change notification settings

yaa-ai/feintel-backend

Repository files navigation

FARM-docker backend API

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

Requirements

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

Install

The project uses poetry to manage dependencies. You can use your own environment, or use poetry to manage the virtuel env and the project depencencies.

If using poetry, for convenience, run poetry config virtualenvs.in-project true before installing depencies. This will install the dependencies in the project directory and make it easier to manage in vscode.

You can then install the dependencies with poetry install --with dev.

To activate the virtual env, use poetry shell.

Running the server

Run this command to start a development server :

uvicorn app.main:app --reload

This will start a server running on http:https://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:https://localhost:8000/api/v1/ to access the root API path. Navigate to http:https://localhost:8000/docs to access the API's documentation. Navigate to http:https://localhost:8000/redoc to access the API's alternative doc built with ReDoc.

Running the tests

Run

pytest

to run the unit test 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, there types, and default values. The Config class specifies where these properties are from, i.e. the .env.dev file. Modify the values in the .env.dev file to change the configuration.

Note that when the backend application is run with Docker, the values in the .env.dev are overriden with environment variables set in the Docker configuration.

About

Backend for FE Intel (Fuel Efficiency Intelligence App)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published