Skip to content

Development

Requirements:

Install dependencies with Brew

brew bundle install --file ./hack/Brewfile

Write an environment file

Write the credientials for the database into .env

APP_DB_USERNAME=flattrack
APP_DB_PASSWORD=flattrack
APP_DB_DATABASE=flattrack
APP_DB_HOST=localhost

see the example.env file in the root of the repo for more.

Launch a workspace with Zellij

launch the workspace

./hack/start-dev.sh

Set up Postgres

Docker/Podman:

docker run -d \
       --name flattrack-postgres \
       -p 5432:5432 \
       -e POSTGRES_DB=flattrack \
       -e POSTGRES_USER=flattrack \
       -e POSTGRES_PASSWORD=flattrack \
       postgres:16.1-alpine3.19

Manually connecting to the Postgres database:

psql -U flattrack -d flattrack -w -h localhost

(entering the password as FlatTrack)

Frontend build

Navigate to the web folder.

Install Frontend dependencies

npm i

Build the frontend

npm run build

Backend build

Navigate to the root of the repo.

Build the backend

./hack/verify-build-smoketest.sh

Start the backend

go run .

Remove migrations

gomigrate -source "file://$(pwd)/migrations" -database postgres://flattrack:flattrack@localhost/flattrack?sslmode=disable down

Project structure and details

API

Written in golang, the API is located in pkg/routes.

The features and areas are separated into packages.

  1. Testing

    Tests are located in test/backend/e2e. So far there are only e2e tests for FlatTrack’s API.

Frontend

Written in Vue.js + JavaScript, the frontend is located in web.

The frontend makes requests to the backend to perform actions.

Database

The migrations and database structuring is located in migrations. Each table is created with golang-migrate.

Assets

Images are located in web/assets, these are used throughout the project (such as in the frontend, and readme).

Docs

To run the docs in development, use:

mkdocs serve

Making a release checklist

Things to do before making a release:

  • ensure docs represent the latest changes
  • ensure linting passes