Skip to content

open-byte/open-gym-backend

Repository files navigation

Open Gym Backend

Project to manage the backend of the Open Gym application

Structure

See Structure

Technologies

  • Python 3.12+ ✨
  • Uvicorn Lightning-fast ASGI server implementation, using uvloop and httptools 🦄
  • FastAPI Web Framework for building APIs 🚀
  • SQLModel SQLModel is a library for interacting with SQL databases from Python code 🗄️
  • Pydantic Data validation and settings management using python type annotations ✅
  • Poetry Python dependency management and packaging made easy 📦
  • Alembic A database migrations tool for SQLAlchemy 🐍
  • PostgreSQL Open Source Relational Database 🐘
  • Docker Containerization platform 🐳
  • Docker Compose Tool for defining and running multi-container Docker applications 🛠️

Format and Linting

  • Ruff is a code formatter and linter for Python 🐶
  • Pre-commit A framework for managing and maintaining multi-language pre-commit hooks 🎣
  • mypy Static type checker for Python 🏗️

Code Style

  • Comments: Google Style
  • Ruff is a code formatter and linter for Python 🐶
  • All code has to be formatted and linted before committing using pre-commit hooks

For checking static type checking run the following command

mypy src/**/*.py

Project setup

Prerequisites

  • Python 3.12+

  • Docker

  • Docker Compose

  • Poetry

  • Pre-commit

  • We are using pre-commit to enforce code style and formatting

## Install pre-commit
pip install pre-commit
## Install the pre-commit hooks
pre-commit install

Local development

  • Clone the repository
  • Install poetry
pip install poetry
  • Create a virtual environment
poetry env use python3.x # where x is the version of python you want to use (3.12+)
source .venv/bin/activate # activate the virtual environment

or

python3.x -m venv .venv # where x is the version of python you want to use (3.12+)
source .venv/bin/activate # activate the virtual environment
  • Install the dependencies
poetry install
  • Run the server (before running the server, you need to have the .env file with the configuration of the database)
uvicorn src.main:app --reload --port 8000

Local development with Docker

  • Clone the repository
  • Use docker-compose to build and run the server
docker-compose up --build

API Documentation

  • The API documentation is available at http://localhost:8000/docs

Apply migrations

See Migrations

About

Backend for Open Gym

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages