Tau is the debatecore debate tournament planner project's response cannon - also known as a backend.
Set environment variables via .env or your shell. The following example .env file is geared for both production and development:
DATABASE_URL=postgres://tau:tau@localhost:5432/tau
SECRET=CENTRUMRWLYSONOSTARPOZNANCDNSBCD4L52SPM
DOCKER_DB_ROOT_PASSWORD=superdoopersecretpasswordthatcannotbeleaked
DOCKER_DB_PASSWORD=wedoingsecurityinhere
FRONTEND_ORIGIN=https://example.com
PORT=2023DOCKER_DB_ROOT_PASSWORDwill be used as the password for the database root user.DATABASE_URLis used for db connection. During development, this ispostgres://tau:tau@localhost:5432/tau.FRONTEND_ORIGINwill be used as an allowed origin for the purpose of CORS. Must be a valid URL.
SECRETwill be used as additional high entropy data used for generating tokens. By default, tau uses system entropy and the current UNIX timestamp.PORTwill be used as the port the server listens on. The default is 2023.
In this scenario it is assumed, that you run the project on your local machine and use a database container for compile-time queries validation.
Note: sqlx validates queries at compile time, so being connected to a database is required to compile the crate.
architecture-beta
group your_machine(server)[Your machine]
service backend_container(server)[Backend] in your_machine
group docker[Docker] in your_machine
service db_container(database)[Database] in docker
backend_container:R -- L:db_container
service env(disk)[env file or shell variables] in your_machine
env:T -- B:backend_container
env:T -- B:db_container
Prerequisites: docker, cargo (Rust), uv (Python).
Once you configure your environment, you can run (in your project directory):
docker compose --profile dev up -d # To start the database container
cargo install sqlx-cli && sqlx migrate run # To perform sqlx migrations (recommended way)
cargo run # To run the crateIt is advisable to run git config --local core.hooksPath .githooks/ to configure commit hooks included in this repository.
Note: the hooks require you to be connected to the database when committing.
In this scenario, you run fully functional backend split into two containers: first with a database and second with a server.
architecture-beta
group your_machine(server)[Your machine]
group docker[Docker] in your_machine
service backend_container(server)[Backend] in docker
service db_container(database)[Database] in docker
backend_container:R -- L:db_container
service env(disk)[env file or shell variables] in your_machine
env:T -- B:backend_container
env:T -- B:db_container
Prerequisites: docker.
Once you configure your environment, you can simply run:
docker compose --profile prod
- API documentation: Once the project is built, you can access the API documentation at /swagger-ui.
- ER diagram: a database ER diagram can be found in
docs/er_diagram.pdf. If you have your commit hooks configured, it will be automatically updated.