BOB Docs
APITutorials

Local Development

Infrastructure

To work properly, BOB requires a connection to both a database and Redis. The fastest way to achieve this is by building the Docker infrastructure. I recommend using the boilerplate-deploy repository to set up the infrastructure locally.

git clone git@github.com:business-oriented-programming/boilerplate-deploy.git
cd boilerplate-deploy

You can use the infrastructure.yaml file to create the full infrastructure for running BOB locally:

docker compose -f infrastructure.yaml up -d

You can customize the .local.env file to adjust any infrastructure-specific settings. Just modify it to your needs and rename it to .env.

Docker Compose automatically loads the .env file from the run directory and incorporates its values into the Compose (YAML) file. You can reference these variables in the file using ${NAME_OF_VARIABLE_FROM_ENV}.

Environment

You need to create a separate environment with Python version 3.11 or higher. I recommend using pyenv:

pyenv virtualenv 3.11 bob

This command creates a new virtual environment in the specified pyenv location with the name bob. Clone the Git repository next to boilerplate-deploy:

git clone git@github.com:business-oriented-programming/boilerplate-api.git
cd boilerplate-api

Use your package manager to install all requirements:

pip install -r requirements.txt

Start App

Now, in your IDE, load the environment into the interpreter. You should use _envs/local.env from boilerplate-api. Add the following commands to your IDE run toolbar and test them:

  1. Running Tests
pytest -v _tests
  1. Running API in Uvicorn
uvicorn core.asgi:application --host=127.0.0.1 --port=10000
  1. Running Celery (Background Tasks)
celery -A core.celery worker --loglevel=info
  1. Running Celery Beat (Scheduled Tasks)
celery -A core.celery beat

On this page