# tzinchy/mosres architecture

> Architecture diagram of the GitHub repository tzinchy/mosres, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tzinchy/mosres
- Repository: https://github.com/tzinchy/mosres

## Overview

mosres collects and tracks versioned data for Moscow renovation housing, transport auctions, and property auctions, then exposes it through an authenticated API and a React client. Users sign in, browse dashboards and listings, inspect individual items and their histories, and use favorites, comments, notifications, and exports. Scheduled or manual refreshes fetch portal data for storage and analysis. The graph preserves the documented product branches; unsampled frontend-to-API calls and some backend internals are not asserted as direct edges.

Main entry points: [`src/service.py`](https://github.com/tzinchy/mosres/blob/main/src/service.py) (Housing refresh and queries), [`src/api.py`](https://github.com/tzinchy/mosres/blob/main/src/api.py) (HTTP endpoints), [`src/torgi.py`](https://github.com/tzinchy/mosres/blob/main/src/torgi.py) (Transport lots), [`src/torgi_objects.py`](https://github.com/tzinchy/mosres/blob/main/src/torgi_objects.py) (Property lots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_webapp["Authenticated app<br/>[App.tsx]"]
  node_housingui["Housing pages"]
  node_auctionui["Auction pages"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_fastapi["HTTP endpoints<br/>[api.py]"]
  node_identity["Token identity<br/>[auth.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
  node_schemas["Request and response models<br/>[schemas.py]"]
  node_dependencies["Service dependencies<br/>[depends.py]"]
end

subgraph group_housing["Renovation housing"]
  node_housing_service["Housing refresh and queries<br/>[service.py]"]
  node_housing_source{{"Moskvartaly portal"}}
  node_rates["Mortgage rates<br/>[rates.py]"]
end

subgraph group_auctions["Auction data"]
  node_transport_service["Transport lots<br/>[torgi.py]"]
  node_objects_service["Property lots<br/>[torgi_objects.py]"]
  node_auction_source{{"torgi.mos.ru"}}
  node_plates["Plate parsing<br/>[plates.py]"]
end

subgraph group_storage["Persistence and scheduling"]
  node_repository["Query and write layer<br/>[repository.py]"]
  node_models["Database models<br/>[models.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_scheduler["Refresh scheduler<br/>[scheduler.py]"]
  node_mixins["History mixins<br/>[mixins.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_housingui
node_webapp -->|"routes to"| node_auctionui
node_webapp -.->|"requests data"| node_api_client
node_user -->|"requests data"| node_fastapi
node_fastapi -->|"validates tokens"| node_identity
node_fastapi -->|"resolves services"| node_dependencies
node_dependencies -->|"provides"| node_housing_service
node_dependencies -->|"provides"| node_transport_service
node_dependencies -->|"provides"| node_objects_service
node_fastapi -->|"validates responses"| node_schemas
node_housing_service -->|"fetches"| node_housing_source
node_transport_service -->|"fetches"| node_auction_source
node_objects_service -->|"fetches"| node_auction_source
node_transport_service -->|"parses plates"| node_plates
node_housing_service -->|"queries and writes"| node_repository
node_transport_service -->|"queries and writes"| node_repository
node_objects_service -->|"queries and writes"| node_repository
node_housing_service -->|"opens sessions"| node_db_session
node_objects_service -->|"opens sessions"| node_db_session
node_repository -->|"queries models"| node_models
node_models -->|"uses base"| node_db_session
node_db_session -->|"connects"| node_postgres
node_scheduler -->|"schedules refresh"| node_housing_service
node_scheduler -->|"schedules refresh"| node_transport_service
node_scheduler -->|"schedules refresh"| node_objects_service
node_fastapi -->|"starts scheduler"| node_scheduler
node_identity -->|"reads secrets"| node_settings
node_housing_service -->|"reads settings"| node_settings
node_models -->|"inherits history"| node_mixins
node_housing_service -.->|"uses mortgage rates"| node_rates

click node_webapp "https://github.com/tzinchy/mosres/blob/main/frontend/src/App.tsx"
click node_housingui "https://github.com/tzinchy/mosres/tree/main/frontend/src/pages"
click node_auctionui "https://github.com/tzinchy/mosres/tree/main/frontend/src/pages"
click node_api_client "https://github.com/tzinchy/mosres/blob/main/frontend/src/lib/api.ts"
click node_fastapi "https://github.com/tzinchy/mosres/blob/main/src/api.py"
click node_identity "https://github.com/tzinchy/mosres/blob/main/src/auth.py"
click node_settings "https://github.com/tzinchy/mosres/blob/main/src/config.py"
click node_schemas "https://github.com/tzinchy/mosres/blob/main/src/schemas.py"
click node_dependencies "https://github.com/tzinchy/mosres/blob/main/src/depends.py"
click node_housing_service "https://github.com/tzinchy/mosres/blob/main/src/service.py"
click node_transport_service "https://github.com/tzinchy/mosres/blob/main/src/torgi.py"
click node_objects_service "https://github.com/tzinchy/mosres/blob/main/src/torgi_objects.py"
click node_plates "https://github.com/tzinchy/mosres/blob/main/src/plates.py"
click node_rates "https://github.com/tzinchy/mosres/blob/main/src/rates.py"
click node_repository "https://github.com/tzinchy/mosres/blob/main/src/repository.py"
click node_models "https://github.com/tzinchy/mosres/blob/main/src/models.py"
click node_db_session "https://github.com/tzinchy/mosres/blob/main/src/database.py"
click node_scheduler "https://github.com/tzinchy/mosres/blob/main/src/scheduler.py"
click node_mixins "https://github.com/tzinchy/mosres/blob/main/src/mixins.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_housingui,node_auctionui,node_api_client,node_user toneBlue
class node_fastapi,node_identity,node_settings,node_schemas,node_dependencies toneAmber
class node_housing_service,node_housing_source,node_rates toneMint
class node_transport_service,node_objects_service,node_auction_source,node_plates toneRose
class node_repository,node_models,node_db_session,node_postgres,node_scheduler,node_mixins toneIndigo
```

## Components

### Web client

- [Authenticated app](https://github.com/tzinchy/mosres/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Housing pages](https://github.com/tzinchy/mosres/tree/main/frontend/src/pages): `frontend/src/pages`
- [Auction pages](https://github.com/tzinchy/mosres/tree/main/frontend/src/pages): `frontend/src/pages`
- [API client](https://github.com/tzinchy/mosres/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and identity

- [HTTP endpoints](https://github.com/tzinchy/mosres/blob/main/src/api.py): `src/api.py`
- [Token identity](https://github.com/tzinchy/mosres/blob/main/src/auth.py): `src/auth.py`
- [Runtime settings](https://github.com/tzinchy/mosres/blob/main/src/config.py): `src/config.py`
- [Request and response models](https://github.com/tzinchy/mosres/blob/main/src/schemas.py): `src/schemas.py`
- [Service dependencies](https://github.com/tzinchy/mosres/blob/main/src/depends.py): `src/depends.py`

### Renovation housing

- [Housing refresh and queries](https://github.com/tzinchy/mosres/blob/main/src/service.py): `src/service.py`
- **Moskvartaly portal**
- [Mortgage rates](https://github.com/tzinchy/mosres/blob/main/src/rates.py): `src/rates.py`

### Auction data

- [Transport lots](https://github.com/tzinchy/mosres/blob/main/src/torgi.py): `src/torgi.py`
- [Property lots](https://github.com/tzinchy/mosres/blob/main/src/torgi_objects.py): `src/torgi_objects.py`
- **torgi.mos.ru**
- [Plate parsing](https://github.com/tzinchy/mosres/blob/main/src/plates.py): `src/plates.py`

### Persistence and scheduling

- [Query and write layer](https://github.com/tzinchy/mosres/blob/main/src/repository.py): `src/repository.py`
- [Database models](https://github.com/tzinchy/mosres/blob/main/src/models.py): `src/models.py`
- [Database sessions](https://github.com/tzinchy/mosres/blob/main/src/database.py): `src/database.py`
- **PostgreSQL**
- [Refresh scheduler](https://github.com/tzinchy/mosres/blob/main/src/scheduler.py): `src/scheduler.py`
- [History mixins](https://github.com/tzinchy/mosres/blob/main/src/mixins.py): `src/mixins.py`

### Other components

- **User**

## Connections

- User → Authenticated app: uses (evidence: `frontend/src/App.tsx`)
- Authenticated app → Housing pages: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → Auction pages: routes to (evidence: `frontend/src/App.tsx`)
- Authenticated app → API client: requests data
- User → HTTP endpoints: requests data (evidence: `README.md`)
- HTTP endpoints → Token identity: validates tokens (evidence: `src/api.py`)
- HTTP endpoints → Service dependencies: resolves services (evidence: `src/api.py`)
- Service dependencies → Housing refresh and queries: provides (evidence: `src/depends.py`)
- Service dependencies → Transport lots: provides (evidence: `src/depends.py`)
- Service dependencies → Property lots: provides (evidence: `src/depends.py`)
- HTTP endpoints → Request and response models: validates responses (evidence: `src/api.py`)
- Housing refresh and queries → Moskvartaly portal: fetches (evidence: `src/service.py`)
- Transport lots → torgi.mos.ru: fetches (evidence: `src/torgi.py`)
- Property lots → torgi.mos.ru: fetches (evidence: `src/torgi_objects.py`)
- Transport lots → Plate parsing: parses plates (evidence: `src/torgi.py`)
- Housing refresh and queries → Query and write layer: queries and writes (evidence: `src/service.py`)
- Transport lots → Query and write layer: queries and writes (evidence: `src/torgi.py`)
- Property lots → Query and write layer: queries and writes (evidence: `src/torgi_objects.py`)
- Housing refresh and queries → Database sessions: opens sessions (evidence: `src/service.py`)
- Property lots → Database sessions: opens sessions (evidence: `src/torgi_objects.py`)
- Query and write layer → Database models: queries models (evidence: `src/repository.py`)
- Database models → Database sessions: uses base (evidence: `src/models.py`)
- Database sessions → PostgreSQL: connects (evidence: `src/database.py`)
- Refresh scheduler → Housing refresh and queries: schedules refresh (evidence: `src/scheduler.py`)
- Refresh scheduler → Transport lots: schedules refresh (evidence: `src/scheduler.py`)
- Refresh scheduler → Property lots: schedules refresh (evidence: `src/scheduler.py`)
- HTTP endpoints → Refresh scheduler: starts scheduler (evidence: `src/api.py`)
- Token identity → Runtime settings: reads secrets (evidence: `src/auth.py`)
- Housing refresh and queries → Runtime settings: reads settings (evidence: `src/service.py`)
- Database models → History mixins: inherits history (evidence: `src/models.py`)
- Housing refresh and queries → Mortgage rates: uses mortgage rates
