# cauazinkj/condora architecture

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

- Interactive diagram: https://gitdiagram.com/cauazinkj/condora
- Repository: https://github.com/cauazinkj/condora

## Overview

Condomínio Digital is an MVP for condominium administration and QR-based visitor access. Residents, administrators, and gate staff use role-specific web screens; the frontend communicates with a FastAPI API that handles authentication, condominium and resident records, visitor credentials, and gate validation. The backend persists domain records in PostgreSQL and uses Redis for login throttling and token revocation. The README supports the overall frontend/API relationship; more specific frontend-to-service calls are not shown in the sampled evidence.

Main entry points: [`backend/app/main.py`](https://github.com/cauazinkj/condora/blob/main/backend/app/main.py) (FastAPI entry), [`backend/app/db/database.py`](https://github.com/cauazinkj/condora/blob/main/backend/app/db/database.py) (Async database sessions), [`backend/app/api/v1/endpoints/auth.py`](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/auth.py) (Authentication), [`backend/app/core/deps.py`](https://github.com/cauazinkj/condora/blob/main/backend/app/core/deps.py) (Session and role checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_web_app["Role-based screens"]
  node_frontend_services["API services"]
end

subgraph group_api["API workflows"]
  node_api_entry["FastAPI entry<br/>[main.py]"]
  node_auth_routes["Authentication<br/>[auth.py]"]
  node_condo_routes["Condominium setup<br/>[condominios.py]"]
  node_resident_routes["Resident records<br/>[moradores.py]"]
  node_visitor_routes["Visitor access<br/>[visitantes.py]"]
  node_gate_routes["Gate operations<br/>[portaria.py]"]
  node_admin_routes["Administration<br/>[admin.py]"]
  node_qr_service["QR generation and validation<br/>[qr_service.py]"]
end

subgraph group_security["Identity and security"]
  node_auth_deps["Session and role checks<br/>[deps.py]"]
  node_token_security["JWT and passwords<br/>[security.py]"]
  node_auth_cookies["Auth cookies<br/>[cookies.py]"]
  node_redis_state[("Rate limits and revocation<br/>[redis.py]")]
end

subgraph group_data["Persistence and domain"]
  node_db_session["Async database sessions<br/>[database.py]"]
  node_domain_models[("Condominium domain records<br/>[models.py]")]
  node_api_schemas["Request and response schemas<br/>[schemas.py]"]
end

node_admin(("Administrator"))
node_resident(("Resident"))
node_gate_staff(("Gate staff"))
node_postgres[("PostgreSQL")]
node_redis_service[("Redis service")]

node_admin -->|"manages"| node_web_app
node_resident -->|"uses"| node_web_app
node_gate_staff -->|"uses"| node_web_app
node_web_app -.->|"uses API services"| node_frontend_services
node_frontend_services -->|"calls API"| node_api_entry
node_api_entry -->|"registers"| node_auth_routes
node_api_entry -->|"registers"| node_admin_routes
node_api_entry -->|"registers"| node_condo_routes
node_api_entry -->|"registers"| node_resident_routes
node_api_entry -->|"registers"| node_gate_routes
node_api_entry -->|"registers"| node_visitor_routes
node_api_entry -->|"initializes"| node_db_session
node_api_entry -->|"opens and closes"| node_redis_state
node_auth_routes -->|"checks login and revocation"| node_redis_state
node_auth_routes -->|"creates and decodes tokens"| node_token_security
node_auth_routes -->|"sets and clears"| node_auth_cookies
node_auth_routes -->|"queries users"| node_db_session
node_auth_deps -->|"checks revocation"| node_redis_state
node_auth_deps -->|"decodes tokens"| node_token_security
node_auth_deps -->|"loads current user"| node_db_session
node_resident_routes -->|"checks roles"| node_auth_deps
node_condo_routes -->|"checks roles"| node_auth_deps
node_visitor_routes -->|"delegates QR work"| node_qr_service
node_visitor_routes -->|"uses sessions"| node_db_session
node_qr_service -->|"reads and writes"| node_domain_models
node_qr_service -->|"accepts QR input"| node_api_schemas
node_db_session -->|"connects"| node_postgres
node_domain_models -->|"inherits base"| node_db_session
node_redis_state -->|"stores shared state"| node_redis_service
node_token_security -.->|"validates API data"| node_api_schemas

click node_web_app "https://github.com/cauazinkj/condora/tree/main/frontend/src/app"
click node_frontend_services "https://github.com/cauazinkj/condora/tree/main/frontend/src/services"
click node_api_entry "https://github.com/cauazinkj/condora/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/auth.py"
click node_condo_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/condominios.py"
click node_resident_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/moradores.py"
click node_visitor_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/visitantes.py"
click node_gate_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/portaria.py"
click node_admin_routes "https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/admin.py"
click node_qr_service "https://github.com/cauazinkj/condora/blob/main/backend/app/services/qr_service.py"
click node_auth_deps "https://github.com/cauazinkj/condora/blob/main/backend/app/core/deps.py"
click node_token_security "https://github.com/cauazinkj/condora/blob/main/backend/app/core/security.py"
click node_auth_cookies "https://github.com/cauazinkj/condora/blob/main/backend/app/core/cookies.py"
click node_redis_state "https://github.com/cauazinkj/condora/blob/main/backend/app/core/redis.py"
click node_db_session "https://github.com/cauazinkj/condora/blob/main/backend/app/db/database.py"
click node_domain_models "https://github.com/cauazinkj/condora/blob/main/backend/app/models/models.py"
click node_api_schemas "https://github.com/cauazinkj/condora/blob/main/backend/app/schemas/schemas.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_web_app,node_frontend_services toneBlue
class node_api_entry,node_auth_routes,node_condo_routes,node_resident_routes,node_visitor_routes,node_gate_routes,node_admin_routes,node_qr_service,node_postgres,node_redis_service toneAmber
class node_auth_deps,node_token_security,node_auth_cookies,node_redis_state toneMint
class node_db_session,node_domain_models,node_api_schemas toneRose
class node_admin,node_resident,node_gate_staff toneIndigo
```

## Components

### Web application

- [Role-based screens](https://github.com/cauazinkj/condora/tree/main/frontend/src/app): `frontend/src/app`
- [API services](https://github.com/cauazinkj/condora/tree/main/frontend/src/services): `frontend/src/services`

### API workflows

- [FastAPI entry](https://github.com/cauazinkj/condora/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/auth.py): `backend/app/api/v1/endpoints/auth.py`
- [Condominium setup](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/condominios.py): `backend/app/api/v1/endpoints/condominios.py`
- [Resident records](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/moradores.py): `backend/app/api/v1/endpoints/moradores.py`
- [Visitor access](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/visitantes.py): `backend/app/api/v1/endpoints/visitantes.py`
- [Gate operations](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/portaria.py): `backend/app/api/v1/endpoints/portaria.py`
- [Administration](https://github.com/cauazinkj/condora/blob/main/backend/app/api/v1/endpoints/admin.py): `backend/app/api/v1/endpoints/admin.py`
- [QR generation and validation](https://github.com/cauazinkj/condora/blob/main/backend/app/services/qr_service.py): `backend/app/services/qr_service.py`

### Identity and security

- [Session and role checks](https://github.com/cauazinkj/condora/blob/main/backend/app/core/deps.py): `backend/app/core/deps.py`
- [JWT and passwords](https://github.com/cauazinkj/condora/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Auth cookies](https://github.com/cauazinkj/condora/blob/main/backend/app/core/cookies.py): `backend/app/core/cookies.py`
- [Rate limits and revocation](https://github.com/cauazinkj/condora/blob/main/backend/app/core/redis.py): `backend/app/core/redis.py`

### Persistence and domain

- [Async database sessions](https://github.com/cauazinkj/condora/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Condominium domain records](https://github.com/cauazinkj/condora/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [Request and response schemas](https://github.com/cauazinkj/condora/blob/main/backend/app/schemas/schemas.py): `backend/app/schemas/schemas.py`

### Other components

- **Administrator**
- **Resident**
- **Gate staff**
- **PostgreSQL**
- **Redis service**

## Connections

- Administrator → Role-based screens: manages (evidence: `README.md`)
- Resident → Role-based screens: uses (evidence: `README.md`)
- Gate staff → Role-based screens: uses (evidence: `README.md`)
- Role-based screens → API services: uses API services
- API services → FastAPI entry: calls API (evidence: `README.md`)
- FastAPI entry → Authentication: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Administration: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Condominium setup: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Resident records: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Gate operations: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Visitor access: registers (evidence: `backend/app/main.py`)
- FastAPI entry → Async database sessions: initializes (evidence: `backend/app/main.py`)
- FastAPI entry → Rate limits and revocation: opens and closes (evidence: `backend/app/main.py`)
- Authentication → Rate limits and revocation: checks login and revocation (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Authentication → JWT and passwords: creates and decodes tokens (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Authentication → Auth cookies: sets and clears (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Authentication → Async database sessions: queries users (evidence: `backend/app/api/v1/endpoints/auth.py`)
- Session and role checks → Rate limits and revocation: checks revocation (evidence: `backend/app/core/deps.py`)
- Session and role checks → JWT and passwords: decodes tokens (evidence: `backend/app/core/deps.py`)
- Session and role checks → Async database sessions: loads current user (evidence: `backend/app/core/deps.py`)
- Resident records → Session and role checks: checks roles (evidence: `backend/app/api/v1/endpoints/moradores.py`)
- Condominium setup → Session and role checks: checks roles (evidence: `backend/app/api/v1/endpoints/condominios.py`)
- Visitor access → QR generation and validation: delegates QR work (evidence: `backend/app/api/v1/endpoints/visitantes.py`)
- Visitor access → Async database sessions: uses sessions (evidence: `backend/app/api/v1/endpoints/visitantes.py`)
- QR generation and validation → Condominium domain records: reads and writes (evidence: `backend/app/services/qr_service.py`)
- QR generation and validation → Request and response schemas: accepts QR input (evidence: `backend/app/services/qr_service.py`)
- Async database sessions → PostgreSQL: connects (evidence: `backend/app/db/database.py`)
- Condominium domain records → Async database sessions: inherits base (evidence: `backend/app/models/models.py`)
- Rate limits and revocation → Redis service: stores shared state (evidence: `backend/app/core/redis.py`)
- JWT and passwords → Request and response schemas: validates API data
