docs: document scaffold status and make local doc checks reproducible

This commit is contained in:
shira committed 2026-10-05 21:03:19 +03:00
1 parent 70f96adf26
commit 0f206bfc29
7 files changed
+214 -7

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ The backend build context is `backend/`, so Docker applies `backend/.dockerignor
The current `postgres:alpine` volume mounts at `/var/lib/postgresql`; the image stores data in a subdirectory for its major version. When the tag advances to a new major version, migrate an existing database with `pg_upgrade` or backup/restore. Updating the image alone does not convert the data.
Open http://127.0.0.1:8080. The host port binds to loopback. Nginx handles /healthz, proxies /api/ to Go, and uses the SPA fallback for other paths. The Go health endpoint is /api/v1/healthz; the internal Go /readyz checks PostgreSQL with SELECT 1, Redis with PING, and the SeaweedFS bucket with HeadBucket; any dependency being unavailable produces 503. The internal backend port 9090 serves /metrics.
Open http://127.0.0.1:8080. The host port binds to loopback. Nginx handles /healthz, proxies /api/ to Go, and uses the SPA fallback for other paths. The public API health route is /api/v1/healthz through Nginx /api/. On the internal port 8080, Go also serves /healthz for the process and /readyz, which checks PostgreSQL with SELECT 1, Redis with PING, and the SeaweedFS bucket with HeadBucket; any dependency being unavailable produces 503. The internal backend port 9090 serves /metrics.
This Nginx configuration has no production TLS. The current bind does not expose the app directly to the public network. Remote access needs a selected TLS reverse proxy, firewall rules, and environment-specific configuration.
+43
View File
@@ -13,6 +13,49 @@ This guide describes the current technical scaffold and the commands declared in
Select current stable frontend dependency releases and keep pnpm-lock.yaml committed for repeatable installs. ML dependencies are locked in uv.lock; Go dependencies are in backend/go.mod. An update must change its lock/configuration and pass checks for that service. Container images use the requested moving `latest` or `alpine` tags; inspect their current Compose/Dockerfile references instead of treating the tag as a fixed version.
## Scaffold status
The repository contains a verifiable technical scaffold, not a product. Values below are read from the named files; when updating a dependency, change its source and lockfile and update this table in both languages.
| Component | Pinned version | Source |
| --- | --- | --- |
| Go | 1.26.8 (`go` directive; no separate `toolchain` line) | backend/go.mod; build image `golang:1.26.8-alpine` in backend/Dockerfile |
| Node.js | 26.10.0 | frontend/.node-version |
| pnpm | 12.9.1 | `packageManager` in frontend/package.json, frontend/pnpm-lock.yaml |
| React, React DOM | 19.3.0 | frontend/package.json, frontend/pnpm-lock.yaml |
| React Router (`react-router-dom`) | 7.18.4 | frontend/package.json, frontend/pnpm-lock.yaml |
| TanStack Query (`@tanstack/react-query`) | 5.104.1 | frontend/package.json, frontend/pnpm-lock.yaml |
| Zod | 4.6.5 | frontend/package.json, frontend/pnpm-lock.yaml |
| Vite | 8.3.2 | frontend/package.json, frontend/pnpm-lock.yaml |
| TypeScript | 7.0.2 (`@typescript/native`, `tsc`); 6.0.2 API (`typescript` alias of `@typescript/typescript6`) for ESLint | frontend/package.json, frontend/pnpm-lock.yaml |
| Vitest | 5.0.3 | frontend/package.json, frontend/pnpm-lock.yaml |
| Orval | 8.40.0 | frontend/package.json, frontend/pnpm-lock.yaml |
| Python | 3.14.8 (`requires-python >=3.14,<3.15`) | ml/.python-version, ml/pyproject.toml |
| uv | 0.12.22 | `[tool.uv] required-version` in ml/pyproject.toml; `setup-uv` in .github/workflows/ci.yml |
| FastAPI | 0.142.2 | ml/pyproject.toml, ml/uv.lock |
| Pydantic | 2.13.5 | ml/pyproject.toml, ml/uv.lock |
| uvicorn | 0.54.0 | ml/pyproject.toml, ml/uv.lock |
| ogen | v1.24.0 | backend/go.mod (`require` and `tool`) |
| sqlc | v1.31.1 | backend/go.mod (`tool`) |
| wire (`github.com/goforj/wire`) | v1.2.0 | backend/go.mod (`require` and `tool`) |
| mockery | v3.8.0 | backend/go.mod (`tool`) |
| golangci-lint | v2.14.0 | backend/go.mod (`tool`) |
| goose | v3.28.0 | backend/go.mod (`tool`) |
| chi | v5.3.2 | backend/go.mod |
| pgx | v5.11.0 | backend/go.mod |
| testcontainers-go | v0.44.0, including modules/postgres | backend/go.mod |
What exists now:
- Health and readiness routes. Nginx answers `GET /healthz` itself and proxies only `/api/` to Go (deploy/nginx/conf.d/app.conf). Go serves `GET /healthz` (`ok`) and `GET /readyz` (`ready` or 503 `not_ready` after checking PostgreSQL, Redis, and SeaweedFS) on its internal port 8080 outside the OpenAPI contract, plus `GET /api/v1/healthz` from api/core/routes/healthz.yml through the ogen handler (backend/internal/adapter/primary/http). The Go metrics listener uses port 9090 (`METRICS_ADDR`) and Prometheus scrapes `/metrics`. ML serves `GET /healthz`, `GET /readyz` (always 503 `not_ready` because no model is connected), and `/metrics` (ml/src/lincodex_ml, api/ml/routes). deploy/scripts/smoke.sh checks Nginx `/healthz`, `/api/v1/healthz`, Go `/readyz` from inside the Compose network, and a 404 for an unknown API route; it does not start ML.
- Adapters: PostgreSQL through pgxpool with a generated `SELECT 1` query, Redis through go-cachekit, and SeaweedFS through the S3 API. A generated Go client for the ML contract exists but is not wired into bootstrap.
- OpenAPI contracts api/core/ and api/ml/ with schema merge, bundles, lint, and generation for Go (ogen), TypeScript (Orval), and Python (datamodel-code-generator). The SPA has a home page, a generated API client, and MSW handlers.
- Compose projects: core (`deploy/docker/docker-compose.yml`: PostgreSQL, Redis, SeaweedFS, backend, frontend), ML (`docker-compose.ml.yml`), and monitoring (`docker-compose.monitoring.yml`).
- CI jobs in .github/workflows/ci.yml: `api`, `backend`, `integration` (matrix of two shards), `frontend`, `ml`, `codegen`, `infrastructure`, `security`, `security-images`, `smoke`, and the required `aggregate` result. See [TESTING.md](TESTING.md) for sharding.
- Observability: Prometheus, Loki, Alloy, Grafana with provisioned datasources and dashboards, and PostgreSQL, Redis, and node exporters. The React app does not send telemetry yet.
Not implemented yet: registration and login, consents, profiles, the questionnaire and assessment, the company cabinet, needs and matching, invitations and contacts, mail delivery, Kafka/outbox, notifications, support, and an end-to-end business suite. backend/db/migrations/ has no business schema, product usecase and adapter directories contain only placeholders, and `make -C deploy test-e2e` is a deferred placeholder that exits with an error. The target design is in [ARCHITECTURE.md](ARCHITECTURE.md).
## Install and work loop
The frontend uses TypeScript 7.0.2 (`tsc`) for type checking. The `@typescript/native` npm alias points to that compiler, while `typescript` points to the compatible `@typescript/typescript6` API for ESLint. This follows [Microsoft's side-by-side setup](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0): current typescript-eslint does not support the TS7 API yet. Type checking covers source files, Vite configuration, and `codegen/orval.config.ts`.
+1 -1
View File
@@ -17,7 +17,7 @@
Для текущего `postgres:alpine` volume монтируется в `/var/lib/postgresql`; образ размещает данные в подкаталоге своей major-версии. При переходе тега на новую major-версию существующую базу нужно мигрировать через `pg_upgrade` или backup/restore. Обновление образа само по себе не преобразует данные.
Откройте http://127.0.0.1:8080. Порт привязан к loopback. Nginx отвечает на /healthz, перенаправляет /api/ в Go и использует SPA fallback для остальных путей. Go health endpoint находится на /api/v1/healthz; внутренний Go /readyz проверяет PostgreSQL через SELECT 1, Redis через PING и bucket SeaweedFS через HeadBucket; недоступность любого из них дает 503. Служебный /metrics слушает на внутреннем порту backend 9090.
Откройте http://127.0.0.1:8080. Порт привязан к loopback. Nginx отвечает на /healthz, перенаправляет /api/ в Go и использует SPA fallback для остальных путей. Публичный health-маршрут API - /api/v1/healthz через Nginx /api/. На внутреннем порту 8080 Go также обслуживает /healthz для проверки процесса и /readyz, который проверяет PostgreSQL через SELECT 1, Redis через PING и bucket SeaweedFS через HeadBucket; недоступность любого из них дает 503. Служебный /metrics слушает на внутреннем порту backend 9090.
Этот Nginx конфиг не настраивает production TLS. Текущий bind не открывает приложение напрямую во внешнюю сеть. Для удаленного доступа требуется отдельно выбранный TLS reverse proxy, firewall и конфигурация целевого окружения.
+43
View File
@@ -13,6 +13,49 @@
Frontend зависимости выбираются из актуальных stable releases; сохраняйте pnpm-lock.yaml для повторяемой установки. ML зависимости фиксируются в uv.lock, Go dependencies - в backend/go.mod. При обновлении меняйте соответствующий lock/config и запускайте checks области. Образы используют заданные moving `latest` или `alpine` tags; сверяйте ссылки в Compose/Dockerfiles и не считайте их стабильными номерами версии.
## Состояние каркаса
В репозитории есть проверяемый технический каркас, а не готовый продукт. Значения ниже взяты из указанных файлов; при обновлении зависимости меняйте ее источник и lockfile, затем обновляйте эту таблицу на обоих языках.
| Компонент | Закрепленная версия | Источник |
| --- | --- | --- |
| Go | 1.26.8 (директива `go`; отдельной строки `toolchain` нет) | backend/go.mod; build image `golang:1.26.8-alpine` в backend/Dockerfile |
| Node.js | 26.10.0 | frontend/.node-version |
| pnpm | 12.9.1 | `packageManager` в frontend/package.json, frontend/pnpm-lock.yaml |
| React, React DOM | 19.3.0 | frontend/package.json, frontend/pnpm-lock.yaml |
| React Router (`react-router-dom`) | 7.18.4 | frontend/package.json, frontend/pnpm-lock.yaml |
| TanStack Query (`@tanstack/react-query`) | 5.104.1 | frontend/package.json, frontend/pnpm-lock.yaml |
| Zod | 4.6.5 | frontend/package.json, frontend/pnpm-lock.yaml |
| Vite | 8.3.2 | frontend/package.json, frontend/pnpm-lock.yaml |
| TypeScript | 7.0.2 (`@typescript/native`, `tsc`); API 6.0.2 (`typescript` как alias `@typescript/typescript6`) для ESLint | frontend/package.json, frontend/pnpm-lock.yaml |
| Vitest | 5.0.3 | frontend/package.json, frontend/pnpm-lock.yaml |
| Orval | 8.40.0 | frontend/package.json, frontend/pnpm-lock.yaml |
| Python | 3.14.8 (`requires-python >=3.14,<3.15`) | ml/.python-version, ml/pyproject.toml |
| uv | 0.12.22 | `[tool.uv] required-version` в ml/pyproject.toml; `setup-uv` в .github/workflows/ci.yml |
| FastAPI | 0.142.2 | ml/pyproject.toml, ml/uv.lock |
| Pydantic | 2.13.5 | ml/pyproject.toml, ml/uv.lock |
| uvicorn | 0.54.0 | ml/pyproject.toml, ml/uv.lock |
| ogen | v1.24.0 | backend/go.mod (`require` и `tool`) |
| sqlc | v1.31.1 | backend/go.mod (`tool`) |
| wire (`github.com/goforj/wire`) | v1.2.0 | backend/go.mod (`require` и `tool`) |
| mockery | v3.8.0 | backend/go.mod (`tool`) |
| golangci-lint | v2.14.0 | backend/go.mod (`tool`) |
| goose | v3.28.0 | backend/go.mod (`tool`) |
| chi | v5.3.2 | backend/go.mod |
| pgx | v5.11.0 | backend/go.mod |
| testcontainers-go | v0.44.0, включая modules/postgres | backend/go.mod |
Что есть сейчас:
- Маршруты health и readiness. Nginx сам отвечает на `GET /healthz` и проксирует в Go только `/api/` (deploy/nginx/conf.d/app.conf). Go обслуживает `GET /healthz` (`ok`) и `GET /readyz` (`ready` или 503 `not_ready` после проверки PostgreSQL, Redis и SeaweedFS) на внутреннем порту 8080 вне OpenAPI контракта, а также `GET /api/v1/healthz` из api/core/routes/healthz.yml через ogen handler (backend/internal/adapter/primary/http). Метрики Go отдаются на порту 9090 (`METRICS_ADDR`), Prometheus читает `/metrics`. ML обслуживает `GET /healthz`, `GET /readyz` (всегда 503 `not_ready`, потому что модель не подключена) и `/metrics` (ml/src/lincodex_ml, api/ml/routes). deploy/scripts/smoke.sh проверяет `/healthz` Nginx, `/api/v1/healthz`, `/readyz` Go изнутри сети Compose и 404 для неизвестного API маршрута; ML он не запускает.
- Адаптеры: PostgreSQL через pgxpool и generated запрос `SELECT 1`, Redis через go-cachekit, SeaweedFS через S3 API. Generated Go client для ML контракта есть, но в bootstrap не подключен.
- OpenAPI контракты api/core/ и api/ml/ с объединением схем, bundles, lint и генерацией для Go (ogen), TypeScript (Orval) и Python (datamodel-code-generator). В SPA есть домашняя страница, generated API client и MSW handlers.
- Compose проекты: core (`deploy/docker/docker-compose.yml`: PostgreSQL, Redis, SeaweedFS, backend, frontend), ML (`docker-compose.ml.yml`) и monitoring (`docker-compose.monitoring.yml`).
- CI jobs в .github/workflows/ci.yml: `api`, `backend`, `integration` (matrix из двух шардов), `frontend`, `ml`, `codegen`, `infrastructure`, `security`, `security-images`, `smoke` и обязательный итог `aggregate`. Шардирование описано в [TESTING.md](TESTING.md).
- Observability: Prometheus, Loki, Alloy, Grafana с provisioned datasources и dashboards, exporters для PostgreSQL, Redis и node. React-приложение пока не отправляет телеметрию.
Еще не реализованы: регистрация и вход, согласия, профили, анкета и тестирование, кабинет компании, потребности и подбор, приглашения и контакты, отправка почты, Kafka/outbox, уведомления, поддержка и бизнес-E2E suite. В backend/db/migrations/ нет бизнес-схемы, каталоги продуктовых usecase и адаптеров содержат только заглушки, а `make -C deploy test-e2e` остается отложенной заглушкой и завершается ошибкой. Целевая архитектура описана в [ARCHITECTURE.md](ARCHITECTURE.md).
## Установка и цикл работы
Frontend проверяется компилятором TypeScript 7.0.2 (`tsc`). Пакет `@typescript/native` ссылается на него через npm alias, а `typescript` ссылается на совместимый API `@typescript/typescript6` для ESLint. Это [рекомендованная Microsoft схема совместного использования](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0): текущий typescript-eslint еще не работает с API TS7. В проверку типов входят исходники, Vite config и `codegen/orval.config.ts`.