Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 2.64 KB

File metadata and controls

80 lines (60 loc) · 2.64 KB

BathLARP Backend

This is the API backend for the BathLARP website.

Getting started

VS Code devcontainers

The easiest (and recommended!) way to get started with this application is using VS Code devcontainers.

Prerequisites:

  • Docker (other container runtimes may also work, but haven't been tried)
  • VS Code

Steps:

  • Clone the repository to a location of your choice.
  • Copy example.env to .env.
  • Open the project in VS Code.
  • When prompted, choose to reopen in container.

This may take a while the first time while the necessary images are downloaded, but eventually you should have a development environment up and running, complete with a database server.

Without devcontainers

If you want to go it alone, you'll need something along the following lines:

Prerequisites:

  • Elixir 1.19.x
  • A Postgres database server
    • The development and test configuration assumes that the database server is available on a host called database and that there's an account called postgres with a password of postgres. If yours isn't, you can set the following environment variables to suitable values:
      • BATHLARP_DATABASE_HOST: The hostname of your database server.
      • BATHLARP_DATABASE_USER: The username of a user on your database server. (Must have sufficient privileges to create and drop databases.)
      • BATHLARP_DATABASE_PASS: The password of the database user.

First run

  • Make sure that code quality checks are run on each commit:
    • pre-commit install
  • Get dependencies, and create, migrate and seed the database:
    • mix setup

Handy commands

  • Run the tests:
    • mix test
  • Run the application:
  • Run the application inside an interactive console (handy for debugging):
    • iex -S mix phx.server
  • Tear down the database and start afresh (DANGER: This will delete any data you already had in it!):
    • mix ecto.reset

Code quality

Various checks will be run as part of any PR before it can be merged. To make life easier for everyone, you can run these locally too:

  • Check for code quality issues:
    • mix credo
  • Fix formatting:
    • mix format