Skip to content

Development

Backend

Prerequisites

  • Poetry
  • Python 3.11
  • Pyenv (optional)
  • MongoDB 7

Steps

Start Redis docker container.

docker run -d --name redis -p 6379:6379 redis
Create .env file based on env.example, which can be found in the backend folder:
INITRY_API_EXTERNAL_PORT=8000
INITRY_GRPC_EXTERNAL_PORT=50051
INITRY_FRONTEND_EXTERNAL_PORT=3000
MONGO_URI=mongodb://localhost:27017/ (1)
DATABASE_NAME=database (2)
BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0

  1. Configure your MongoDB host
  2. Configure your MongoDB database name

Skip this step, if you already have Python 3.11 installed.
In this tutorial we are using Pyenv for Python version management.
Go to the backend folder and configure Pyenv.

pyenv local 3.11
In the backend folder configure and install the Poetry environment
poetry use 3.11
poetry install
Activate the Poetry environment:
poetry shell
Run the backend:
python -m uvicorn main:app --reload
Run the Celery worker:
celery -A tasks.tasks worker -l INFO

Check http://localhost:8000/docs for OpenAPI docs.

Additional

gRPC

.proto files can be found in the proto folder.
To build the protofiles, execute:

cd backend/proto
./run.sh
Move generated files to the backend/protobufs folder.

Please note

Ensure that you have copied the newly generated file for pytest-initry as well. Changes in protocols should be reflected on both the client and server sides.

OpenAPI

After making any changes to the backend API, you must rebuild the frontend client.:

cd backend/openapi-codegen
./run.sh
Move the generated client folder inside the frontend folder.

Requirements.txt

If you add new dependencies to Poetry, please generate a requirements.txt file for the Docker environment.:

poetry export --without-hashes --format=requirements.txt > requirements.txt

Frontend

Install npm modules: Run the following command to install the necessary npm modules:

npm install
This will install all dependencies required for the frontend.

Copy the env.example file to create your .env file:

cp env.example .env
You can then configure the .env file according to your specific settings. Open the .env file and set appropriate values for the environment variables.

Start the frontend in development mode:

npm run dev
This will launch the development server and you can access the frontend application in your browser.