Files
lincodex/.agents/standards/backend.md
T
2026-10-05 14:23:31 +03:00

1.8 KiB

Backend standard

The backend is a Go HTTP service. Keep transport and storage details out of domain rules.

Keep domain types in one flat package at backend/internal/domain/. Add files such as user.go and candidate.go directly in that directory when their types are defined. Do not create domain subdirectories per entity or feature.

Use the existing separation between domain, usecase, port, adapter, and bootstrap code. Primary adapters receive external calls and translate them to application operations. Secondary adapters implement ports owned by their consumers. Bootstrap wires concrete adapters and controls process lifecycle.

Keep shared runtime configuration under backend/config/. Do not hide deployment settings in business packages. Do not add empty architectural packages ahead of a real use.

The generated ogen HTTP handler is mounted by the chi router. Keep handwritten HTTP concerns in the existing HTTP adapter and keep decisions that affect product rules in usecases or domain code. Health method names follow the healthz and readyz naming convention. The public API prefix is /api/v1; the standard metrics endpoint is internal and is not part of that prefix.

Use PostgreSQL through the repository's pgx and sqlc boundary. Schema changes are versioned migrations. Do not place SQL in HTTP handlers or domain packages.

Prefer the selected wahrwelt-kit packages only where they provide a useful technical boundary and have a pinned, verified version. Libraries such as logging, HTTP, metrics, and PostgreSQL helpers do not own product behavior. Do not add unused JWT, cache, WebSocket, or other framework dependencies.

Current code is an operational scaffold. Do not describe the health handler, database ping, or wiring as account, assessment, matching, or invitation behavior.