# kondomino/kondos-api architecture

> Architecture diagram of the GitHub repository kondomino/kondos-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kondomino/kondos-api
- Repository: https://github.com/kondomino/kondos-api

## Overview

##### Project Type Analysis
This is a NestJS backend application that appears to be a real estate or property management system (based on the "kondo" module naming). It's built with TypeScript and follows NestJS's modular architecture pattern.

##### Main Components

A. Core Layer:
- Database Module (Sequelize integration)
- Authentication System (JWT, Google OAuth)
- Pagination Utilities
- Core Constants

B. Feature Modules:
- Kondo Module (Property Management)
- User Module
- Media Module
- Unit Module
- Like Module
- Integrator Module (Excel file processing)

C. Infrastructure:
- Firebase Hosting (indicated by workflows)
- Database (likely PostgreSQL/MySQL based on Sequelize usage)

**┌─ Client Layer ─────────────────────────────────────┐**
- External Clients (Mobile/Web Applications)         │
- ┬───────────────────────────────┘

**┌─ API Gateway ───────▼───────────────────────────────┐**
- NestJS Controllers (Routes & Endpoints)             │
- ┬───────────────────────────────┘

**┌─ Authentication ────▼───────────────────────────────┐**
- JWT Guard │ Google OAuth │ Public Routes            │
- ┬───────────────────────────────┘

**┌─ Business Logic ────▼───────────────────────────────┐**
- ┌─────────────┐ ┌──────────┐ ┌────────┐ ┌────────┐ │
- Kondo Module │ │User Module│ │Media   │ │Unit    │ │
- Services     │ │Services   │ │Module  │ │Module  │ │
- ┘ └──────────┘ └────────┘ └────────┘ │
- ┬───────────────────────────────┘

**┌─ Data Access ───────▼───────────────────────────────┐**
- Repositories │ Entity Models │ DTOs                 │
- ┬───────────────────────────────┘

**┌─ Database ──────────▼───────────────────────────────┐**
- Sequelize ORM │ Database Provider                   │
- ┘

##### Important Details

a. Authentication Flow:
- JWT authentication path
- Google OAuth integration
- Public routes with special indicators

b. Module Relationships:
- How Kondo entities relate to Units
- Media attachments to Kondos
- User interactions with Likes

c. Data Flow:
- How the Integrator module processes Excel files
- Where the Slugify utility is used
- Pagination flow in list operations

##### Technical Stack Indicators
- NestJS Framework
- Sequelize ORM
- JWT/Google OAuth
- Firebase Hosting
- TypeScript

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        C[Client Applications]
    end

    subgraph API_Gateway
        AG[NestJS Controllers]:::api
    end

    subgraph Auth_Layer
        JWT[JWT Authentication]:::auth
        GO[Google OAuth]:::auth
        Guards[Auth Guards]:::auth
    end

    subgraph Business_Logic
        KM[Kondo Module]:::module
        UM[User Module]:::module
        MM[Media Module]:::module
        UnitM[Unit Module]:::module
        LM[Like Module]:::module
        IM[Integrator Module]:::module
        SU[Slugify Utility]:::util
    end

    subgraph Data_Access
        Rep[Repositories]:::data
        DTO[DTOs]:::data
        Entities[Entity Models]:::data
    end

    subgraph Database_Layer
        DB[(Database)]:::db
        ORM[Sequelize ORM]:::db
        DBConfig[Database Config]:::db
    end

    C --> AG
    AG --> |Authenticate| JWT
    AG --> |OAuth| GO
    JWT --> Guards
    GO --> Guards
    Guards --> |Authorized| KM
    Guards --> |Authorized| UM
    Guards --> |Authorized| MM
    Guards --> |Authorized| UnitM
    Guards --> |Authorized| LM
    Guards --> |Authorized| IM

    KM --> Rep
    UM --> Rep
    MM --> Rep
    UnitM --> Rep
    LM --> Rep
    IM --> Rep

    KM --> |Uses| SU
    Rep --> Entities
    Rep --> DTO
    Entities --> ORM
    ORM --> DB
    DBConfig --> DB

    %% Click Events
    click JWT "https://github.com/Kondomino/kondos-api/blob/main/src/auth/strategies/jwt.strategy.ts"
    click GO "https://github.com/Kondomino/kondos-api/blob/main/src/auth/strategies/google.strategy.ts"
    click Guards "https://github.com/Kondomino/kondos-api/tree/main/src/auth/guards"
    click KM "https://github.com/Kondomino/kondos-api/tree/main/src/kondo"
    click UM "https://github.com/Kondomino/kondos-api/tree/main/src/user"
    click MM "https://github.com/Kondomino/kondos-api/tree/main/src/media"
    click UnitM "https://github.com/Kondomino/kondos-api/tree/main/src/unit"
    click LM "https://github.com/Kondomino/kondos-api/tree/main/src/like"
    click IM "https://github.com/Kondomino/kondos-api/tree/main/src/integrator"
    click SU "https://github.com/Kondomino/kondos-api/blob/main/src/utils/slugify/slugify.service.ts"
    click DBConfig "https://github.com/Kondomino/kondos-api/blob/main/src/core/database/database.config.ts"
    click ORM "https://github.com/Kondomino/kondos-api/blob/main/src/core/database/database.provider.ts"

    %% Styling
    classDef api fill:#2374AB
    classDef auth fill:#FFD700
    classDef module fill:#4CAF50
    classDef data fill:#A0A0A0
    classDef db fill:#607D8B
    classDef util fill:#FF9800

    %% Legend
    subgraph Legend
        L1[API Components]:::api
        L2[Auth Components]:::auth
        L3[Business Modules]:::module
        L4[Data Components]:::data
        L5[Database Components]:::db
        L6[Utilities]:::util
    end
```
