main, titled as Conventional Commits (feat: …, fix: …, docs: …). CI enforces this, and the title decides the next version. See Releases.
Repository layout
app/go.work joins three Go modules: app/station, app/scout, and app/shared/go. Behavior specific to one app stays in that app’s directory. Both go.work and go.work.sum live in app/. Git hooks, tests, and release scripts stay at the root. Go and Docker lint configuration lives in app/. The root biome.jsonc checks TypeScript and JSON across the apps, tests, and scripts. Run npm commands inside app/, or use npm --prefix app from the root. Go also discovers the parent workspace when commands run inside an app directory.
Build locally
Use the Go version declared in the repository’sapp/go.work and module files, and Node.js 24 for the frontend build. From the repository root, install the build tools and generate both UIs:
scout in place of station to build Scout.
Run the tests
CI runs the Go and frontend tests on every PR, and the end-to-end test after each push tomain or prod, since it builds both Docker images. You can run all three locally from the repository root. Go unit tests mock database calls and use in-memory store mocks for service tests. They don’t open SQLite databases or connect to PostgreSQL. The Docker end-to-end test starts its own real database.
Go unit tests
-race, which needs a C compiler. On Windows, tests that need symlinks, POSIX permissions, or sh report SKIP, but CI still runs them.
Frontend and release tests
tests/**/*.test.cts file. Tests are grouped by area:
To run some tests without rebuilding every time, run
npm --prefix app run build once (again after TypeScript changes), then:
.test.cts, and put them in their area’s folder.
End-to-end test
tests/integration/e2e.sh runs PostgreSQL, Station, and Scout in Docker, takes a backup, and recovers it. Build the images it expects first:
16555 and 16556 and cleans up after itself. On Windows, run it from Git Bash or WSL.
Test reports
scripts/test-report.cts turns results into a single HTML page with pass, fail, and skip counts and each failure’s output. npm --prefix app test writes reports/frontend-tests.html. For Go tests, convert the go test -json output. The coverage page is optional:
Linting and formatting
The CI workflow runs these checks on PRs and pushes tomain and prod:
Run the TypeScript checks with
npm --prefix app run lint, and apply formatting and safe fixes with npm --prefix app run fix. Run golangci-lint from a module folder after npm --prefix app run build:
let globals in the UI folders. Those files share one global scope, so other files and inline onclick handlers use and reassign those names.
To run the same checks before each commit, install pre-commit and run pre-commit install once. The hooks in .pre-commit-config.yaml need npm --prefix app ci, Go, and golangci-lint locally. The hadolint hook needs Docker.
Repository maintenance
The CI workflow also checks Go formatting withgofmt, and runs these security checks:
The security checks also run once a week, to catch newly reported vulnerabilities even when the code hasn’t changed.
If gitleaks flags a fake value in a test, add it to the allowlist in
.gitleaks.toml. If it flags a real secret, revoke it. Removing it from the code doesn’t remove it from the git history.
Dependabot opens weekly update PRs for Go dependencies, npm tools, GitHub Actions, and Dockerfile base images. These PRs use Conventional Commit titles and go through the usual CI and review. Dependabot isn’t set up to merge them automatically. See Dependabot configuration and Go vulnerability management for details.
Report vulnerabilities using the repository’s security policy.
Frontend sources and generated files
Edit TypeScript inapp/station/static/ts, app/scout/static/ts, or app/shared/ts. Each app compiles the shared scripts along with its own. They’re classic scripts that share one global scope per app, so inline HTML handlers can call their functions. Don’t add import or export.
Go embeds the generated app/station/static/js and app/scout/static/js, so generate them before go build or go test with npm --prefix app run build at the root, or go generate ./... in an app folder. Station’s build also copies its pinned Zstandard decoder and ZIP library from npm into static/js/vendor, including their licenses; the file viewer serves them locally. They’re gitignored. Don’t edit or commit them or any other JavaScript (.js, .mjs, .cjs, .jsx, or source maps). CI rejects it.
For continuous compilation, use npm --prefix app run watch (Station) or npm --prefix app run watch:scout (Scout), then rebuild and restart the Go server to serve the new assets.
Names in code
The UI, docs, and messages say Scout key, Station token, and Station auth token or Scout auth token. The code uses older names for the same things:
Keep these code names. File names, API routes, JSON fields, database names, and the
3to1go_enc_* browser storage keys are used by existing installs, so renaming them breaks saved settings, stored data, or connections between Scout and Station. Use Scout key and Station token in anything people read: UI text, docs, and error and log messages.
Build with Docker Compose
app/station/docker-compose.yml and app/scout/docker-compose.yml build from this checkout, using app/ as build context so shared code is included. Copy the app’s .env.example to .env, configure it as in Station installation or Scout installation, then from that app’s folder:
deploy-example/ instead.