Files
finance/infra/README.md
T
k1nq d582f15681 feat: add tests for import polling, login page, money utilities, and query keys
- Implemented tests for import polling functionality, ensuring correct behavior for active and terminal import statuses.
- Created tests for the login page, validating user interactions and error handling.
- Added unit tests for money utility functions, covering parsing, formatting, and summation of monetary values.
- Developed tests for query keys, ensuring proper scoping and invalidation roots.

chore: setup testing environment and configuration

- Added setup file for testing with Vitest and Testing Library.
- Configured TypeScript and Vite for the frontend project.
- Created Docker and Nginx configurations for local development and production environments.
- Established a PostgreSQL initialization script for setting up application roles.

docs: add README and environment configuration for infra

- Included README for the infra directory, detailing local development setup and service descriptions.
- Created an example environment configuration file for local development with placeholders for sensitive information.
2026-09-14 09:26:33 +05:00

3.1 KiB

infra/

Local development stack and provider-neutral production images. Root-owned dirs (backend/, frontend/) are owned by their respective workstreams; this directory owns only orchestration, images and proxy configuration.

infra/
├── docker-compose.yml        # dev stack: api, worker, frontend proxy, pg, redis, minio, mailpit
├── .env.example              # copy to infra/.env; placeholders only, no real secrets
├── docker/
│   ├── Dockerfile.backend    # provider-neutral API/worker image (context: backend/)
│   └── Dockerfile.frontend   # provider-neutral SPA+nginx image (context: frontend/)
└── nginx/
    └── nginx.conf            # same-origin /api/v1 reverse proxy + SPA static

Quickstart

cp infra/.env.example infra/.env    # fill placeholders (no real secrets locally)
docker compose -f infra/docker-compose.yml up -d --wait
Service URL / port Notes
Web app (nginx proxy) http://127.0.0.1:8080 serves SPA, proxies /api/v1 → api:8000
API (direct) http://127.0.0.1:8000 FastAPI; GET /healthz
Mailpit UI http://127.0.0.1:8025 test SMTP sink; SMTP on 127.0.0.1:1025
MinIO console http://127.0.0.1:9001 S3 API on 127.0.0.1:9000
PostgreSQL 127.0.0.1:5432 named volume postgres_data
Redis 127.0.0.1:6379 AOF persistence, named volume redis_data

Until backend/ and frontend/ exist, start infra services only:

docker compose -f infra/docker-compose.yml up -d --wait postgres redis minio mailpit

Contracts with backend/frontend workstreams

These entry points are referenced by the compose file and CI; coordinate changes through both sides:

Backend (backend/, build context of Dockerfile.backend):

  • uv-managed project with pyproject.toml + uv.lock; lint ruff, types mypy, tests pytest.
  • API: uvicorn app.main:app, health endpoint GET /healthz.
  • Worker: Celery app importable as app.worker.celery; tasks idempotent, acks_late, prefetch=1.
  • Statement parsing happens only in the worker; the local compose worker is attached only to the internal backend network, and production must enforce the equivalent no-egress policy.

Frontend (frontend/, build context of Dockerfile.frontend):

  • pnpm project with pnpm-lock.yaml; scripts: lint, typecheck, test (non-watch), build → dist/.
  • Calls the same-origin /api/v1; no secrets in VITE_* — none are required.

CI

.github/workflows/ci.yml runs backend lint/type/test/build and frontend lint/type/test/build once the workstreams provide the plan-required lockfiles (backend/uv.lock, frontend/pnpm-lock.yaml; auto-detected), and always validates the compose file, boots the infra services against their healthchecks, and nginx -t-checks the proxy config.

Production

Production runs the same images on a platform in the Russian Federation that supplies PostgreSQL, Redis, S3-compatible storage, SMTP and a secret manager. See docs/adr/0004-provider-neutral-encrypted-data-boundary.md and docs/operations/beta-release-runbook.md.