Skip to content

Local development

This project is intended to be run on Linux or macOS, and requires poetry and npm to be installed to install python and javascript dependencies.

We however provide a docker image to run the application if somehow installing these tools prove troublesome.

Running the project in docker

To run both the backend API and the frontend app in docker, you simply have to run

make dev

This will:

  • build the docker image for the backend app, with all dependencies installed
  • build the docker image for the frontend app, with all dependencies installed
  • run both images via docker compose
  • apply the SQL migrations
  • populate the database with items, spells and development fixtures

Running the project on your host

If you were confortable installing poetry and npm on your development machine, and managed to, then run

make init

This will:

  • install all backend dependencies in a virtualenv created and managed by poetry
  • install all frontend dependencies under dnd5esheets/front/node_modules
  • apply the SQL migrations
  • populate the database with items, spells and development fixtures

At that point, open 2 terminal tabs. Run the following command in the first tab to run the backend application:

make run

Run this command in the second terminal tab to run the frontend application:

make run-front-dev

Next steps

At that point, the backend API will run under http://localhost:8000 and the frontend will run under http://localhost:3000

Note

When using these make commands, any modification to the codebase will induce automatic reload of either the backend or frontend application.

Development commands

If you run the apps directly on your development host, you might find the following make commands useful:

make api-doc                    Open the 5esheets API documentation
make api-explorer               Open the 5esheets API explorer (with interactive requests)
make back-test                  Run the backend tests
make build                      Build the application
make check                      Run all checks on the codebase
make db-dev-fixtures            Populate the local database with development fixtures
make db-migrate                 Run the SQL migrations
make deps                       Install the development dependencies
make dev                        Run the dev stack in containers
make docker-build-front-dev     Build the dev docker image for the frontend
make docker-build               Build the docker image for the API
make docs                       Generate and serve documentation
make front-check                Run all frontend checks
make front-generate-api-client  Generate the API openapi.json file
make front-run-dev              Run the development frontend server
make front-storybook            Run the development frontend storybook server
make front-test                 Run the frontend unit tests
make help                       Display help
make init                       Setup the application for the first time
make run                        Run the app
make test                       Run the project tests
make trash-env                  Delete all js dependencies and the python virtualenv