Backend
Русский | English
The core Go service handles accounts, profiles, skill assessments, organization needs, search, invitations, and notifications. chi and the generated ogen server serve HTTP. Background handlers run within the application process.
Structure
| Directory | Purpose |
|---|---|
cmd/app/ |
Entry point calling bootstrap.Run |
config/ |
Environment loading and validation |
internal/bootstrap/ |
Dependency assembly, startup, and shutdown |
internal/domain/ |
Domain types and rules |
internal/usecase/ |
Application workflows |
internal/port/ |
Inbound and outbound interfaces |
internal/adapter/primary/http/ |
Router, middleware, v1/ handlers, ogen output in api/ |
internal/adapter/secondary/ |
PostgreSQL, Redis, SeaweedFS, Kafka, mail, and external services |
internal/worker/ |
Outbox, events, jobs, and mail delivery |
db/ |
Migrations and SQL queries |
codegen/ |
ogen, sqlc, wire, and mockery |
pkg/ |
Reusable libraries |
integration_test/ |
Tests against real infrastructure |
Development
go.mod declares the Go version. From the repository root:
make -C backend deps
make -C backend build
make -C backend test-fast
make -C backend check
Use make generate to regenerate all dependent components. Backend targets include gen-openapi, gen-ml, gen-code-runner, gen-lab-provisioner, gen-sqlc, gen-wire, and mocks. Do not edit generated files by hand.
make -C backend run reads process environment variables and does not load .env automatically. Use Compose to run with its dependencies. Migrations run before HTTP starts by default; separate commands are migrate-status, migrate-up, and migrate-down-one.
Operational routes
GET /healthz: the process is alive.GET /readyz: PostgreSQL, Redis, and SeaweedFS are available; Kafka is not checked here.GET /api/v1/healthz: health through the public API.GET /metrics: a separateMETRICS_ADDRlistener, default:9090.
Mail supports disabled and resend. SMTP configuration exists, but selecting smtp currently stops startup because its transport is not implemented. ML and runner require separately configured services. The labd client is generated but not yet wired into bootstrap.
Checks
make -C backend test runs unit tests with the race detector. test-int uses Testcontainers and requires Docker; test-int-compile only compiles integration tests. TESTING.md covers shards and the shared bootstrap.
List commands with make -C backend help. See DEVELOPMENT.md and ARCHITECTURE.md for layer boundaries and change rules.
Report planned assessment bank coverage with make -C backend bank-coverage. The command matches valid families from JSON bundles against the manifest and checks for Go/Python paths for Backend families. Report mode shows incomplete coverage without failing; make -C backend bank-coverage-check enables strict checks. File presence does not confirm implementation equivalence, reviewer independence, or calibration; those remain separate external checks.