All contributions to this project are welcome and will be greatly appreciated. This file includes what you need to do in order to be able to contribute code to strate.gg.
BE
is the back-end API build with Flask, FE
is the web UI built with react.
You'll need git
, Docker
, and python
(>=3.7), and make
installed on your machine.
make deps
installs all dependencies. Specifically, it:
- Sets up a python3 venv under
venv
- Downloads
requirements.txt
andrequirements-dev.txt
- Sets up
pre-commit
by attaching it to your git pre-commit hooks. - Downloads all
fe/
dependencies usingnpm ci
(exact versions frompackage-lock.json
)
The development environment is fully reproducible using docker. The
Docker configuration files live in docker/
, though you don't need
to touch that if you are not doing anything docker-specific. Use the
below commands:
make dev
composes up a development container. Both the BE and FE are
hot-reloaded with their respective servers. The website is available at
port 80 (default for HTTP), therefore, going to localhost
should bring
up the app after all services are up.
By default, make dev
runs docker compose up without the -d
flag,
meaning that the output will be streamed to your terminal. If you want
the detached mode (container runs in the background, you get your
terminal), use make devd
.
Use make devdown
from any terminal to shut down the development server.
Use make dev-build
for a forced dev rebuild, make dev-build-nocache
to re-build without the cache.
make prod
runs a production container and exposes it at port 80.
Use make prodd
for detached mode, make prod-build
for a forced
rebuild, make prod-build-nocache
to re-build without the cache.
make proddown
shuts the production container down.
The goal of testing within this project is to allow code to be refactored without fear. Therefore, tests should protect all user facing functionality, and other developers working on the repo are also users of your code.
make test
runs the entire test suite. (BE and FE).
make best
runs tests on the BE.
make fest
runs tests on the FE.
make jest
runs jest
on the FE with watcher, automatically re-running relevant
tests on file changes.
make cover
runs coverage on both BE and FE.
make bover
runs coverage on the BE.
make fover
runs coverage on the FE.
make boverage
runs coverage on BE and opens up a HTML report.
make foverw
runs jest and coverage in watch mode.
It is required that all code changes pass the checks defined in the pre-commit configuration file. These checks include linting and auto-formatting for both the FE and BE codebases, among other utilities.
All PRs will automatically be checked to see if they pass all hooks. The best way to make sure that this will happen is to run pre-commit yourself.
Pre-commit should already be installed if you ran make deps
(see installing above). Use make install-commit-hooks
to automatically run all checks
before each commit.
make check
will run a check as if you tried to commit (only staged files). make check-all
will run pre-commit on all files.
HACKING.md describes recommended code editor setup for a more enjoyable development experience. These include setting up linting and auto-formatting on save so that you can resolve commit blockers faster.
Be kind.