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.
Requirements
Section titled “Requirements”| 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) |
Running Fret from the sources
Section titled “Running Fret from the sources”git clone https://github.com/SOKTeam/fret.gitcd fretmake 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 reloadOpen http://localhost:5173: the development server sends the API calls to the Go program.
Make targets
Section titled “Make targets”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 |
Repository layout
Section titled “Repository layout”cmd/fret/ entry point: serve, add, status, healthcheck, versioninternal/ the Go packages, described in Architectureweb/ the SvelteKit interface (built into web/build, embedded in the binary)docs/ this documentation, its assets, the OpenAPI description and the branddocs.yml configuration of the documentation site.github/ CI, release, documentation, issue templatesSee 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/*.tsexcepten.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, throughweb/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), thenmake sqlc. Every schema change is a new numbered migration ininternal/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.yamland the TypeScript types ofweb/src/lib/api.ts, which are kept in sync by hand. - User-visible changes update this documentation and
CHANGELOG.md. - Before sending:
make test lintpasses.
The interface
Section titled “The interface”- SvelteKit 3 and Svelte 5 (runes), TypeScript, built as static files (
adapter-static) with a200.htmlfallback that the Go program serves for every interface route. - Imports use the
#lib/…alias; navigation goes throughresolve()(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 withuseScene()(lib/scene.svelte.ts). The parcel label and its stamps areShippingLabel,ParcelSceneandInkStamp; the settings lines are inlib/components/settings/.
The documentation
Section titled “The documentation”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.
make docs-dev # http://localhost:4321The 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).
Commits
Section titled “Commits”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.
Branches and pull requests
Section titled “Branches and pull requests”developreceives the work. Each change has its own branch fromdevelop(fix/resume-after-restart), merged by a pull request with a merge commit titledchore(merge): merge branch '<branch>' into develop.mainonly moves to release: mergingdevelopinto 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).