Fueler API is a RESTful API designed to give optimal fuel stops for a route with given start and endpoints. It also calculates the total fuel spent.
- Getting route path points
- Total fuel cost calculation
- Generating map of the route and stops
- Django
- Django Ninja for API routing and schema validation
- folium for rendering HTML maps
- geopy distance calculation functions
- openrouteservice accessing OpenRouteServiceAPI
- polyline decoding polyline number to extract route points
- python-dotenv for loading environment variables where necessary
To install and run the Fueler API locally, follow these steps:
-
Clone the repository:
git clone https://github.com/erdurano/fueler_API.git cd fueler_API
-
(If not used) Install uv Please refer to https://github.com/astral-sh/uv
-
Install dependencies:
uv sync
-
Set up environment variables: Create a
.env
file in the root directory and add the following variables:MAPQUEST_KEY=your mapquest key OPENROUTE_KEY=your openrouteservice key
[!IMPORTANT] MAPQUEST API is used for a migration that automatically populating database with longitude and latitude values of fuel stations. If not applied migration fails.
-
Activate environment:
source .venv/bin/activate
-
Migrate the database:
python manage.py migrate
-
Run server:
python manage.py runserver
Once the server is running, you can access the API at http://localhost:8000
. Use tools like Postman or cURL to interact with the endpoints.
GET /api/docs/
For inspecting documentation. Documentation auto generated by django-ninjaPOST /api/route/
- Get route and fuel stop info with providing start and end points through jsonGET /api/route/
- Get route and fuel stop info with providing start and end points through query parameters.
For any questions or inquiries, please contact [email protected].