# laakmus/parking-warszawa architecture

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

- Interactive diagram: https://gitdiagram.com/laakmus/parking-warszawa
- Repository: https://github.com/laakmus/parking-warszawa
- Video tour (about a minute): https://gitdiagram.com/laakmus/parking-warszawa/video

## Overview

parking-warszawa is a FastAPI marketplace API where owners publish parking offers, renters search and book them, and both parties complete a contract confirmation flow. The main request path enters through the registered routers, which validate payloads, authorize users, and read or update PostgreSQL-backed domain records. Authentication also supports profile management and password resets; offer search adds geocoding and distance calculations. The graph reflects the README’s documented capabilities and sampled runtime source; unsampled route details are represented only where the README supports them.

Main entry points: [`src/routers/reservations.py`](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/reservations.py) (Reservation routes), [`src/routers/offers.py`](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/offers.py) (Offer routes and search), [`src/main.py`](https://github.com/laakmus/parking-warszawa/blob/main/src/main.py) (FastAPI app), [`src/routers/auth.py`](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/auth.py) (Account routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["FastAPI app<br/>[main.py]"]
  node_health["Health check<br/>[main.py]"]
end

subgraph group_identity["Accounts and access"]
  node_auth_routes["Account routes<br/>[auth.py]"]
  node_auth["Token and password auth<br/>[auth.py]"]
end

subgraph group_market["Parking marketplace"]
  node_offers_routes["Offer routes and search<br/>[offers.py]"]
  node_geocoding["Geocoding and distance<br/>[geocoding.py]"]
  node_reservation_routes["Reservation routes<br/>[reservations.py]"]
  node_contract_routes["Contract routes<br/>[contracts.py]"]
end

subgraph group_domain["Domain and persistence"]
  node_user_store["User records<br/>[models.py]"]
  node_offer_records["Offer records<br/>[models.py]"]
  node_reservation_records["Reservation records<br/>[models.py]"]
  node_contract_records["Contract records<br/>[models.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
end

node_client(("API client"))
node_nominatim["OpenStreetMap Nominatim"]
node_postgres[("PostgreSQL")]

node_client -->|"sends requests"| node_app
node_app -->|"registers router"| node_auth_routes
node_app -->|"registers router"| node_offers_routes
node_app -->|"registers router"| node_reservation_routes
node_app -->|"registers router"| node_contract_routes
node_client -->|"checks uptime"| node_health
node_auth_routes -->|"uses auth helpers"| node_auth
node_auth_routes -->|"requests session"| node_db_session
node_auth_routes -->|"queries and updates"| node_user_store
node_auth_routes -->|"validates and returns"| node_schemas
node_offers_routes -->|"authorizes owner actions"| node_auth
node_offers_routes -->|"requests session"| node_db_session
node_offers_routes -->|"queries and updates"| node_offer_records
node_offers_routes -->|"geocodes and measures"| node_geocoding
node_geocoding -.->|"requests coordinates"| node_nominatim
node_offers_routes -->|"validates and returns"| node_schemas
node_reservation_routes -->|"authorizes requests"| node_auth
node_reservation_routes -->|"requests session"| node_db_session
node_reservation_routes -->|"checks offer"| node_offer_records
node_reservation_routes -->|"checks and creates"| node_reservation_records
node_reservation_routes -->|"creates contract"| node_contract_records
node_reservation_routes -->|"validates and returns"| node_schemas
node_contract_routes -->|"authorizes requests"| node_auth
node_contract_routes -->|"requests session"| node_db_session
node_contract_routes -->|"reads and confirms"| node_contract_records
node_contract_routes -->|"returns contract data"| node_schemas
node_db_session -->|"opens sessions"| node_postgres

click node_app "https://github.com/laakmus/parking-warszawa/blob/main/src/main.py"
click node_health "https://github.com/laakmus/parking-warszawa/blob/main/src/main.py"
click node_auth_routes "https://github.com/laakmus/parking-warszawa/blob/main/src/routers/auth.py"
click node_auth "https://github.com/laakmus/parking-warszawa/blob/main/src/auth.py"
click node_user_store "https://github.com/laakmus/parking-warszawa/blob/main/src/models.py"
click node_offers_routes "https://github.com/laakmus/parking-warszawa/blob/main/src/routers/offers.py"
click node_geocoding "https://github.com/laakmus/parking-warszawa/blob/main/src/geocoding.py"
click node_offer_records "https://github.com/laakmus/parking-warszawa/blob/main/src/models.py"
click node_reservation_routes "https://github.com/laakmus/parking-warszawa/blob/main/src/routers/reservations.py"
click node_reservation_records "https://github.com/laakmus/parking-warszawa/blob/main/src/models.py"
click node_contract_routes "https://github.com/laakmus/parking-warszawa/blob/main/src/routers/contracts.py"
click node_contract_records "https://github.com/laakmus/parking-warszawa/blob/main/src/models.py"
click node_schemas "https://github.com/laakmus/parking-warszawa/blob/main/src/schemas.py"
click node_db_session "https://github.com/laakmus/parking-warszawa/blob/main/src/database.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_app,node_health,node_client toneBlue
class node_auth_routes,node_auth,node_postgres toneAmber
class node_offers_routes,node_geocoding,node_reservation_routes,node_contract_routes toneMint
class node_user_store,node_offer_records,node_reservation_records,node_contract_records,node_schemas,node_db_session toneRose
class node_nominatim toneIndigo
```

## Components

### API entry

- [FastAPI app](https://github.com/laakmus/parking-warszawa/blob/main/src/main.py): `src/main.py`
- [Health check](https://github.com/laakmus/parking-warszawa/blob/main/src/main.py): `src/main.py`

### Accounts and access

- [Account routes](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/auth.py): `src/routers/auth.py`
- [Token and password auth](https://github.com/laakmus/parking-warszawa/blob/main/src/auth.py): `src/auth.py`

### Parking marketplace

- [Offer routes and search](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/offers.py): `src/routers/offers.py`
- [Geocoding and distance](https://github.com/laakmus/parking-warszawa/blob/main/src/geocoding.py): `src/geocoding.py`
- [Reservation routes](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/reservations.py): `src/routers/reservations.py`
- [Contract routes](https://github.com/laakmus/parking-warszawa/blob/main/src/routers/contracts.py): `src/routers/contracts.py`

### Domain and persistence

- [User records](https://github.com/laakmus/parking-warszawa/blob/main/src/models.py): `src/models.py`
- [Offer records](https://github.com/laakmus/parking-warszawa/blob/main/src/models.py): `src/models.py`
- [Reservation records](https://github.com/laakmus/parking-warszawa/blob/main/src/models.py): `src/models.py`
- [Contract records](https://github.com/laakmus/parking-warszawa/blob/main/src/models.py): `src/models.py`
- [Request and response schemas](https://github.com/laakmus/parking-warszawa/blob/main/src/schemas.py): `src/schemas.py`
- [Database sessions](https://github.com/laakmus/parking-warszawa/blob/main/src/database.py): `src/database.py`

### Other components

- **API client**
- **OpenStreetMap Nominatim**
- **PostgreSQL**

## Connections

- API client → FastAPI app: sends requests
- FastAPI app → Account routes: registers router
- FastAPI app → Offer routes and search: registers router
- FastAPI app → Reservation routes: registers router
- FastAPI app → Contract routes: registers router
- API client → Health check: checks uptime
- Account routes → Token and password auth: uses auth helpers
- Account routes → Database sessions: requests session
- Account routes → User records: queries and updates
- Account routes → Request and response schemas: validates and returns
- Offer routes and search → Token and password auth: authorizes owner actions
- Offer routes and search → Database sessions: requests session
- Offer routes and search → Offer records: queries and updates
- Offer routes and search → Geocoding and distance: geocodes and measures
- Geocoding and distance → OpenStreetMap Nominatim: requests coordinates
- Offer routes and search → Request and response schemas: validates and returns
- Reservation routes → Token and password auth: authorizes requests
- Reservation routes → Database sessions: requests session
- Reservation routes → Offer records: checks offer
- Reservation routes → Reservation records: checks and creates
- Reservation routes → Contract records: creates contract
- Reservation routes → Request and response schemas: validates and returns
- Contract routes → Token and password auth: authorizes requests
- Contract routes → Database sessions: requests session
- Contract routes → Contract records: reads and confirms
- Contract routes → Request and response schemas: returns contract data
- Database sessions → PostgreSQL: opens sessions
