Skip to content

Development

Fret is a Go program with a SvelteKit interface embedded in it. This page sets up a working copy and lists the rules of the repository. Read CONTRIBUTING.md before opening a pull request.

Tool Version For
Go 1.27 The program
Node.js 24 The interface
pnpm 12 (corepack enable installs the pinned version) JavaScript dependencies
sqlc 1.31 Database access code
golangci-lint 2 Go linting
Docker any recent Building the image and this documentation (optional)
Terminal window
git clone https://github.com/SOKTeam/fret.git
cd fret
make dev-api # terminal 1: the API on http://localhost:8080 (data in ./data, warehouse ./downloads)
make dev-web # terminal 2: the interface on http://localhost:5173, with hot reload

Open http://localhost:5173: the development server sends the API calls to the Go program.

make help lists them all.

Target Does
make dev-api Runs the API in development (debug logs)
make dev-web Runs the interface with hot reload on :5173
make test Runs the Go tests with the race detector
make lint golangci-lint, svelte-check, ESLint and Prettier
make fmt Formats the Go code and the interface
make sqlc Regenerates the database code from internal/store/queries
make build Builds the interface, then the full binary into bin/fret
make run Builds, then runs Fret
make docker Builds the local image fret:dev
make docs-dev Runs this documentation on :4321, with live reload (Docker)
make docs Builds this documentation into site/ (Docker)
make clean Deletes the build output
cmd/fret/ entry point: serve, add, status, healthcheck, version
internal/ the Go packages, described in Architecture
web/ the SvelteKit interface (built into web/build, embedded in the binary)
docs/ this documentation, its assets, the OpenAPI description and the brand
docs.yml configuration of the documentation site
.github/ CI, release, documentation, issue templates

See Architecture for the inside of internal/.

  • Everything in English: code, comments, logs, API errors, documentation, tests. The only exceptions are the dictionaries of the other interface languages, web/src/lib/i18n/*.ts except en.ts.
  • Technical words in the code and the API (Package, File, Hoster, Debrid, Queue); the Fret lexicon (shipment, parcel, carrier, dock…) only in displayed text, through web/src/lib/i18n/en.ts (the reference) and the seven other dictionaries. A new key goes into all eight files: TypeScript refuses a missing one.
  • English URLs, for the interface and for the API.
  • SQL lives in internal/store/queries/*.sql, in ASCII only (sqlc miscounts multi-byte characters), then make sqlc. Every schema change is a new numbered migration in internal/store/migrations/; a published migration is never edited.
  • Tests: every behaviour of the dock, the downloader or a plugin has its test. External services are imitated with httptest, never called.
  • API changes update docs/api/openapi.yaml and the TypeScript types of web/src/lib/api.ts, which are kept in sync by hand.
  • User-visible changes update this documentation and CHANGELOG.md.
  • Before sending: make test lint passes.
  • SvelteKit 3 and Svelte 5 (runes), TypeScript, built as static files (adapter-static) with a 200.html fallback that the Go program serves for every interface route.
  • Imports use the #lib/… alias; navigation goes through resolve() (an ESLint rule checks it).
  • The interface follows the SOKTeam art direction, shared with S.O.K: its colours, type and keys are CSS variables in web/src/app.css, and the identity is described in Brand.
  • Every screen has the same frame: a title in two tones (ScreenTitle), then its content, and a scene on the right filled with useScene() (lib/scene.svelte.ts). The parcel label and its stamps are ShippingLabel, ParcelScene and InkStamp; the settings lines are in lib/components/settings/.

This site is built with Kiln from the Markdown files of docs/ and the settings of docs.yml: navigation, header links, the Fret palette and fonts, and docs/assets/fret.css for what the colours cannot say: the 1px keys, the rows and the dotted sheet of the home page, the asides and the status stamps (the same rules as sok.css in the S.O.K docs). Kiln runs in Docker, so the documentation needs no Node in the repository.

Terminal window
make docs-dev # http://localhost:4321

The pages also read well on GitHub: links between pages are relative and point at .md files, notes are GitHub alerts (> [!NOTE]), and the title of a page is its # Heading. CHANGELOG.md is published as the changelog page.

The API reference is generated from docs/api/openapi.yaml: edit the description there, its introduction included (info.description).

Commit messages follow Conventional Commits: a type, an optional scope, then what the commit does (fix(queue): resume a parcel after a restart). The Lint commits check rejects any other form on every pull request (rules in .commitlintrc.json).

Accepted values
Type feat, fix, docs, style, refactor, perf, test, chore, revert, ci, build
Scope ui, api, queue, transfer, carriers, plugin, collect, unpack, warehouse, store, cli, config, i18n, brand, deps, docker, release, merge

No scope is fine when none fits (docs: …). Lines stay under 100 characters. The type decides the next version (feat a minor one, fix a patch), and the subject becomes a line of the release notes: write what users get.

  • develop receives the work. Each change has its own branch from develop (fix/resume-after-restart), merged by a pull request with a merge commit titled chore(merge): merge branch '<branch>' into develop.
  • main only moves to release: merging develop into it publishes a version when its commits call for one. See Releasing.
  • One pull request covers one topic; its description follows the template (Summary, Testing).
Built with Kiln