This project uses FastAPI with uv to manage dependencies and includes Ruff for linting. It also comes with a Dockerfile and a docker-compose.yml for containerizing the application.
- Python 3.13.2 (recommended)
- uv (to install dependencies and run commands)
- Ruff (for linting; installed via
uv sync
if defined inpyproject.toml
) - (Optional) Docker and Docker Compose (for containerization)
-
Install
uv
(if not already installed):pip install uv
Or check the uv official documentation for other install options.
-
Clone this repository:
git clone https://github.com/Afordin/beerdin-api cd beerdin-api
-
Sync dependencies:
uv sync
- This will create or update the
.venv
virtual environment and install all dependencies (including Ruff).
- This will create or update the
-
Run the application (using the FastAPI CLI, installed inside
.venv
):uv run fastapi dev
- Once running, the app will be available at:
http://localhost:8000
- The API docs are located at:
http://localhost:8000/docs
- Once running, the app will be available at:
To run Ruff via uv, simply execute:
uv run ruff check .
This will lint your code and display any style or syntax suggestions.
The included Dockerfile:
- Uses a slim Python base image.
- Copies the
uv
binary. - Copies the project into
/app
. - Runs
uv sync
to install dependencies. - Uses
fastapi
to start the app within the container.
You’ll also find a docker-compose.yml file for running the service. Use it like so:
docker-compose build
docker-compose up -d
This:
- Builds the image using the Dockerfile.
- Starts the container mapping the internal port (usually
80
) to8000
on your host. - Your application will be available at
http://localhost:8000
.
- app/main.py
Main entry point for the FastAPI application. - pyproject.toml
Project info and dependencies (used byuv
and Ruff). - Dockerfile
Instructions for building the Docker image. - docker-compose.yml
Optional file for starting containers with Docker Compose. - .gitignore
Lists files and folders to ignore (e.g.,.venv/
,.ruff_cache/
, etc.).