# 1tahaahmed/propertymanagement architecture

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

- Interactive diagram: https://gitdiagram.com/1tahaahmed/propertymanagement
- Repository: https://github.com/1tahaahmed/propertymanagement

## Overview

PropertyManagement is a multi-tenant real-estate management API. The principal workflow is an authenticated organization member managing properties and units, maintaining resident records and emergency contacts, and creating or progressing leases. The API uses CQRS application handlers over domain entities, with infrastructure providing EF Core persistence, identity, JWTs and SMTP; tenant filters and permission policies enforce isolation and access. Edges are limited to controller dispatches, sampled handler-to-repository calls, and tenant-context behavior shown in the excerpts or README; other feature wiring is not inferred.

Main entry points: [`src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs) (SQL Server data), [`src/PropertyManagement.Api/Program.cs`](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Program.cs) (REST API), [`src/PropertyManagement.Api/Controllers/AuthController.cs`](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/AuthController.cs) (Authentication endpoints), [`src/PropertyManagement.Application/Features/Authentication`](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Authentication) (Authentication workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api["REST API<br/>[Program.cs]"]
  node_permissions["Permission policies"]
  node_auth_api["Authentication endpoints<br/>[AuthController.cs]"]
  node_confirmation_api["Email confirmation API"]
  node_properties_api["Property endpoints"]
  node_units_api["Unit endpoints<br/>[UnitController.cs]"]
  node_residents_api["Resident endpoints"]
  node_leases_api["Lease endpoints"]
end

subgraph group_identity["Identity and onboarding"]
  node_auth_features["Authentication workflows<br/>[Authentication]"]
  node_email_features["Email verification<br/>[EmailConfirmation]"]
  node_identity_service["Identity service<br/>[IdentityService.cs]"]
  node_jwt["JWT generation"]
end

subgraph group_portfolio["Property portfolio"]
  node_property_features["Property management<br/>[Properties]"]
  node_unit_features["Unit management<br/>[Units]"]
  node_property_domain["Property and unit rules<br/>[Property.cs]"]
  node_property_repo["Property and unit repositories"]
end

subgraph group_occupancy["Residents and leases"]
  node_resident_features["Resident management<br/>[Residents]"]
  node_resident_domain["Resident rules<br/>[Resident.cs]"]
  node_resident_repo["Resident repository"]
  node_lease_features["Lease lifecycle<br/>[Leases]"]
  node_lease_domain["Lease rules<br/>[Lease.cs]"]
end

subgraph group_platform["Application and infrastructure"]
  node_application["CQRS and validation"]
  node_current_user["Tenant context<br/>[CurrentUser.cs]"]
  node_database[("SQL Server data")]
  node_email_sender["SMTP email<br/>[SmtpEmailSender.cs]"]
end

node_member(("Organization member"))

node_member -->|"sends requests"| node_api
node_api -->|"authorizes"| node_permissions
node_member -->|"logs in or registers"| node_auth_api
node_auth_api -.->|"dispatches"| node_auth_features
node_confirmation_api -.->|"dispatches"| node_email_features
node_auth_features -.->|"uses identity"| node_identity_service
node_identity_service -.->|"generates tokens"| node_jwt
node_properties_api -.->|"dispatches"| node_property_features
node_units_api -.->|"dispatches"| node_unit_features
node_residents_api -->|"dispatches"| node_resident_features
node_leases_api -.->|"dispatches"| node_lease_features
node_property_features -->|"reads properties"| node_property_repo
node_unit_features -->|"reads units"| node_property_repo
node_resident_features -->|"reads resident contacts"| node_resident_repo
node_current_user -->|"scopes tenant data"| node_database
node_property_domain -.->|"persists entities"| node_database
node_resident_domain -.->|"persists entities"| node_database
node_lease_domain -.->|"persists entities"| node_database
node_email_features -.->|"sends confirmation"| node_email_sender

click node_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Program.cs"
click node_permissions "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Authorization/PermissionAuthorizationHandler.cs"
click node_auth_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/AuthController.cs"
click node_confirmation_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/EmailConfirmationController.cs"
click node_properties_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/PropertiesController.cs"
click node_units_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/UnitController.cs"
click node_residents_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/ResidentsController.cs"
click node_leases_api "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/LeasesController.cs"
click node_auth_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Authentication"
click node_email_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Authentication/EmailConfirmation"
click node_identity_service "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Identity/IdentityService.cs"
click node_jwt "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Common/Security/JwtTokenGenerator.cs"
click node_property_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Properties"
click node_unit_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Units"
click node_property_domain "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Properties/Property.cs"
click node_property_repo "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/Repositories/PropertyRepository.cs"
click node_resident_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Residents"
click node_resident_domain "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Residents/Resident.cs"
click node_resident_repo "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/Repositories/ResidentRepository.cs"
click node_lease_features "https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Leases"
click node_lease_domain "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Leases/Lease.cs"
click node_application "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Application/Common/Behaviors/ValidationBehavior.cs"
click node_current_user "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Common/Security/CurrentUser.cs"
click node_database "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs"
click node_email_sender "https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Email/SmtpEmailSender.cs"

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_api,node_permissions,node_auth_api,node_confirmation_api,node_properties_api,node_units_api,node_residents_api,node_leases_api toneBlue
class node_auth_features,node_email_features,node_identity_service,node_jwt toneAmber
class node_property_features,node_unit_features,node_property_domain,node_property_repo toneMint
class node_resident_features,node_resident_domain,node_resident_repo,node_lease_features,node_lease_domain toneRose
class node_application,node_current_user,node_database,node_email_sender,node_member toneIndigo
```

## Components

### API and access

- [REST API](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Program.cs): `src/PropertyManagement.Api/Program.cs`
- [Permission policies](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Authorization/PermissionAuthorizationHandler.cs): `src/PropertyManagement.Api/Authorization/PermissionAuthorizationHandler.cs`
- [Authentication endpoints](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/AuthController.cs): `src/PropertyManagement.Api/Controllers/AuthController.cs`
- [Email confirmation API](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/EmailConfirmationController.cs): `src/PropertyManagement.Api/Controllers/EmailConfirmationController.cs`
- [Property endpoints](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/PropertiesController.cs): `src/PropertyManagement.Api/Controllers/PropertiesController.cs`
- [Unit endpoints](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/UnitController.cs): `src/PropertyManagement.Api/Controllers/UnitController.cs`
- [Resident endpoints](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/ResidentsController.cs): `src/PropertyManagement.Api/Controllers/ResidentsController.cs`
- [Lease endpoints](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Api/Controllers/LeasesController.cs): `src/PropertyManagement.Api/Controllers/LeasesController.cs`

### Identity and onboarding

- [Authentication workflows](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Authentication): `src/PropertyManagement.Application/Features/Authentication`
- [Email verification](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Authentication/EmailConfirmation): `src/PropertyManagement.Application/Features/Authentication/EmailConfirmation`
- [Identity service](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Identity/IdentityService.cs): `src/PropertyManagement.Infrastructure/Identity/IdentityService.cs`
- [JWT generation](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Common/Security/JwtTokenGenerator.cs): `src/PropertyManagement.Infrastructure/Common/Security/JwtTokenGenerator.cs`

### Property portfolio

- [Property management](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Properties): `src/PropertyManagement.Application/Features/Properties`
- [Unit management](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Units): `src/PropertyManagement.Application/Features/Units`
- [Property and unit rules](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Properties/Property.cs): `src/PropertyManagement.Domain/Entities/Properties/Property.cs`
- [Property and unit repositories](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/Repositories/PropertyRepository.cs): `src/PropertyManagement.Infrastructure/Persistence/Repositories/PropertyRepository.cs`

### Residents and leases

- [Resident management](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Residents): `src/PropertyManagement.Application/Features/Residents`
- [Resident rules](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Residents/Resident.cs): `src/PropertyManagement.Domain/Entities/Residents/Resident.cs`
- [Resident repository](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/Repositories/ResidentRepository.cs): `src/PropertyManagement.Infrastructure/Persistence/Repositories/ResidentRepository.cs`
- [Lease lifecycle](https://github.com/1tahaahmed/propertymanagement/tree/main/src/PropertyManagement.Application/Features/Leases): `src/PropertyManagement.Application/Features/Leases`
- [Lease rules](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Domain/Entities/Leases/Lease.cs): `src/PropertyManagement.Domain/Entities/Leases/Lease.cs`

### Application and infrastructure

- [CQRS and validation](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Application/Common/Behaviors/ValidationBehavior.cs): `src/PropertyManagement.Application/Common/Behaviors/ValidationBehavior.cs`
- [Tenant context](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Common/Security/CurrentUser.cs): `src/PropertyManagement.Infrastructure/Common/Security/CurrentUser.cs`
- [SQL Server data](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs): `src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`
- [SMTP email](https://github.com/1tahaahmed/propertymanagement/blob/main/src/PropertyManagement.Infrastructure/Email/SmtpEmailSender.cs): `src/PropertyManagement.Infrastructure/Email/SmtpEmailSender.cs`

### Other components

- **Organization member**

## Connections

- Organization member → REST API: sends requests (evidence: `README.md`)
- REST API → Permission policies: authorizes (evidence: `README.md`)
- Organization member → Authentication endpoints: logs in or registers (evidence: `README.md`)
- Authentication endpoints → Authentication workflows: dispatches (evidence: `src/PropertyManagement.Api/Controllers/AuthController.cs`)
- Email confirmation API → Email verification: dispatches
- Authentication workflows → Identity service: uses identity
- Identity service → JWT generation: generates tokens
- Property endpoints → Property management: dispatches
- Unit endpoints → Unit management: dispatches (evidence: `src/PropertyManagement.Api/Controllers/UnitController.cs`)
- Resident endpoints → Resident management: dispatches (evidence: `src/PropertyManagement.Api/Controllers/ResidentsController.cs`)
- Lease endpoints → Lease lifecycle: dispatches (evidence: `src/PropertyManagement.Api/Controllers/LeasesController.cs`)
- Property management → Property and unit repositories: reads properties (evidence: `src/PropertyManagement.Application/Features/Properties/GetProperties/GetPropertiesQueryHandler.cs`)
- Unit management → Property and unit repositories: reads units (evidence: `src/PropertyManagement.Application/Features/Units/GetById/GetUnitByIdQueryHandler.cs`)
- Resident management → Resident repository: reads resident contacts (evidence: `src/PropertyManagement.Application/Features/Residents/EmergencyContacts/GetEmergencyContactsQueryHandler.cs`)
- Tenant context → SQL Server data: scopes tenant data (evidence: `src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`)
- Property and unit rules → SQL Server data: persists entities (evidence: `src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`)
- Resident rules → SQL Server data: persists entities (evidence: `src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`)
- Lease rules → SQL Server data: persists entities (evidence: `src/PropertyManagement.Infrastructure/Persistence/ApplicationDbContext.cs`)
- Email verification → SMTP email: sends confirmation
