You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add hub-worker binary and refactor config to cleanenv (#50)
* chore: split into api and worker
* chore: lint fix
* chore: renamed property
* chore: river fix
* chore: expose additional river config
* chore: improvements
* chore: align run-worker with run (allow env vars without .env)
Made-with: Cursor
* chore: rename
* chore: fix stale comment in backfill-embeddings referencing workers in API
* docs: fix AGENTS.md run-worker to reflect .env is optional
* chore: fixes
---------
Co-authored-by: Bhagya Amarasinghe <b.sithumini@yahoo.com>
-`cmd/api/` holds the API server (hub-api): HTTP API, ingestion, record retrieval, tenant/auth; enqueues jobs to River (insert-only). Build/run: `go run ./cmd/api` or `make run`.
5
+
-`cmd/worker/` holds the worker (hub-worker): runs River job workers (webhook delivery, embeddings). No HTTP. Build/run: `go run ./cmd/worker` or `make run-worker`.
-`make dev-setup`: start Postgres via Docker, install Go deps/tools, and initialize database schema.
12
-
-`make run`: create a default `.env` if missing and run the API server.
13
-
-`make build`: build the API binary to `bin/api`.
13
+
-`make run`: run hub-api (config from `.env` if present and environment variables; copy `.env.example` to `.env` or set env vars).
14
+
-`make run-worker`: run hub-worker (requires DATABASE_URL from `.env` or environment variables).
15
+
-`make build`: build both `bin/hub-api` and `bin/hub-worker`. Use `make build-api` or `make build-worker` for a single binary.
14
16
-`make tests`: run integration tests in `tests/`.
15
17
-`make tests-coverage`: generate `coverage.html`.
16
-
-`make check-coverage`: run all tests with coverage and fail if below COVERAGE_THRESHOLD (excludes cmd/api: app.go, main.go).
18
+
-`make check-coverage`: run all tests with coverage and fail if below COVERAGE_THRESHOLD (excludes cmd/api and cmd/worker main packages).
17
19
-`make init-db`: run goose migrations up using `DATABASE_URL`. `make migrate-status` and `make migrate-validate` for status and validation. New migrations go in `migrations/` with goose annotations (`-- +goose up` / `-- +goose down`). Name files with a sequential number and short description (e.g. `002_add_webhooks_table.sql`); goose orders by the numeric prefix. For webhook delivery, run `make river-migrate` after `init-db` to apply River job queue migrations.
18
20
-`make fmt`: format code (runs `golangci-lint run --fix`; uses gofumpt/gci from config).
19
21
-`make lint`: run `golangci-lint` (includes format checks; requires `make install-tools`).
0 commit comments