Skip to content

Development

marekbeckmann edited this page Nov 1, 2026 · 1 revision

Development

torq is a Go backend (net/http, SQLite via modernc.org/sqlite, queries generated with sqlc) with a React + TypeScript frontend (Vite, Tailwind CSS, TanStack Query), embedded into a single binary.

Requirements

  • Go 1.26+
  • Node.js 22
  • golangci-lint v2
  • sqlc, only after editing internal/store/queries

Commands

make setup     # go mod download + npm ci
make dev       # Go API on :8080 (data in ./.data) + Vite on :5173 (proxies /api)
make check     # go vet, golangci-lint, sqlc diff, tsc, eslint, i18n key and error-code check
make test      # go test + vitest
make e2e       # builds bin/torq and runs the Playwright suite against it
make build     # bin/torq with the frontend embedded
make docker    # production image
make generate  # sqlc generate

Local settings for make dev, such as the auto-fill keys, go into a .env file in the repository root; copy .env.example.

Demo data

make build
TORQ_ENABLE_SEED=true TORQ_DATA_DIR=./.data ./bin/torq seed-demo

This creates the user demo / torq-demo-password and one vehicle with a year of history, as long as the instance has no users yet. --vehicles 10 --years 5 adds bulk data.

Layout

Path Contents
cmd/torq Server entry point, healthcheck and seed-demo commands
cmd/catalog-sync Maintainer tool that builds the bundled vehicle catalog
internal/httpapi HTTP handlers, routing, middleware
internal/store sqlc-generated queries (queries/*.sql is the source)
internal/db/migrations Forward-only SQL migrations, applied at startup
internal/catalog Vehicle catalog import and lookups; catalogsync builds it, chassis.txt maps chassis codes
internal/specfill Spec sheet auto-fill (Tavily + Gemini)
internal/notify Webhooks, presets and digests
web/src Frontend; translations in web/src/i18n/locales/{en,de}
web/e2e Playwright end-to-end tests

Conventions

  • Every user-facing string goes through i18n, in English and German. make check fails on missing keys.
  • Schema changes need a new migration; migrations never change after release.
  • Units are metric; the only display option is kW or PS for engine power.

Updating the bundled catalog

Maintainers rebuild internal/catalog/data/catalog_seed.json.gz from downloaded source files:

make catalog FZ6=fz6_2024.xlsx GOR3A=all.json GOR3A_SHA=<commit> RETRIEVED=YYYY-MM-DD

The report lists how many generations got a chassis code per make. Update NOTICE.md with the new retrieval date and commit.

Clone this wiki locally