Skip to content

beatMeDev/beatMeBackend

Repository files navigation

Beat Me

Tests Styles codecov MIT license Black

Beat Me is challenges platform for music producers.

TODO

  • Authentication - Facebook, Google, Spotify, VK
  • Challenges
  • Playlists
  • Import playlists from spotify
  • Tracks
  • Participants
  • Submissions
  • Voting
  • Populate recommended playlists
  • Challenge statistics/scoreboard
  • Search track on youtube

Installation

Use the package manager poetry to prepare backend running.

  • Install poetry: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python.
  • Install dependencies: poetry install.

Run server

  • Copy .env.example to .env and fill your data.
  • Check postgres and redis are working.
  • Run server: uvicorn app:application --host 0.0.0.0 --port 8000.

Docker

  • Copy .env.docker.example to .env.docker and fill your data.
  • Run docker-compose up -d to start services.

Application will be available on http://127.0.0.1:8000.

Tests

Tests are work by pytest and use sqlite(TORTOISE_TEST_DB in settings/base.py) instead of postgres.

  • To run tests exec pytest in project directory.
  • To calculate coverage pytest --cov=app --cov=tests --cov-report=term-missing.

Dev routes

  • /swagger/ - automatic interactive API documentation.
  • /redoc/ - alternative automatic documentation.

Manage commands

To run manage command: python manage/main.py {command}

  • populate_texts - populate texts for frontend loader from texts.json
  • populate_playlists - populate spotify playlists from playlists.json

Don't forget to set PYTHONPATH to the project

Project structure

app                         - app root directory
├── main.py                 - contains application factory
├── models                  - application models
│         ├── api                 - pydantic models
│         └── db                  - tortoise orm models
│         └── __init__.py   - contains __models__ for tortoise orm models exploring
├── routes                  - api endpoints
├── services                - services with application logic
│         └── auth                - authentication services
│             └── providers       - external OAuth providers
├── settings                - applicaitons settings
└── utils                   - other stuff
tests                       - tests root directory
manage                      - application management
└── fixtures                - json fixtures storage

Releases

No releases published

Packages

No packages published