# samuriseee/batdongsan-frontend architecture

> Architecture diagram of the GitHub repository samuriseee/batdongsan-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/samuriseee/batdongsan-frontend
- Repository: https://github.com/samuriseee/batdongsan-frontend

## Overview

##### Project Type and Purpose
- This is a frontend project built with Vue.js. Given the name “bat-dong-san-frontend” (bat-dong-san meaning “real estate” in Vietnamese), the application appears to be a user interface for a real estate management or listing platform.
- The README verifies that the project is set up via Vue CLI with standard build, serve, and lint commands. This confirms that the focus is entirely on the presentation layer.

##### File Structure
- Notice the standard configuration files: .env, Dockerfile, docker-compose.yml, vue.config.js, tailwind.config.js, etc., which suggest containerized deployment and modern CSS (Tailwind) integration.
- The “src” directory is the heart of the application. It includes:
- Assets: CSS files (including Tailwind and shared login/responsive styles), images, fonts.
- Components: These are organized into sub-folders by responsibility (AdminDashboard, CreatePost, EmployeePage, EstateDetailPage, UserPostManagement, article, layout, and ui). The naming suggests multiple user roles (admin, employee, end-user) with tailored interfaces.
- Views: The “views” folder further segments pages into groups (AdminDashboard, AuthenView, EmployeeDashboard, EstateList, UserPostManagement, etc.), mapping to different application routes.
- Router and Store directories: The presence of “src/router” and “src/store” indicates the use of Vue Router for navigation and Vuex (or similar) for state management.
- Other configuration files like cloudinaryConfig.js hint at integration with external services (here, likely for image upload in real estate posts).

##### Key Components and How They Interact
- Entry Point: src/main.js is where the Vue instance is created, connecting the router, store, and global components.
- UI Structure: The “layout” components (NavBar.vue, Footer.vue) provide a common structure while the “views” determine screen-specific layouts. The router maps user interactions to these views.
- Domain-Specific Modules: There are clearly several modules:
- Admin Dashboard – for administrative tasks (employee management, user/post management).
- Employee Dashboard – for employee-specific functionalities.
- AuthenView – for authentication flows (login, registration, password management).
- EstateDetail/EstateList – for displaying detailed information for individual estates and listing available properties (for rent and sale).
- UserPostManagement and CreatePost views – for user-generated content.
- Reusable UI Components: Under “components/ui”, elements like modal dialogs, filters, and search bars ensure reusability across the application.
- External Integrations: Cloudinary integration is evidenced by CloudinaryUpload.vue and cloudinaryConfig.js, suggesting image management and upload functionality.

##### Architectural Patterns and Design Principles
- Modular Component-Based Design: Separation of domain-specific components (Admin, Employee, Estate, Auth) enhances maintainability and clarity.
- Clear Separation of Concerns: Layout components, individual views, state management, and routing are structured in distinct folders.
- Use of a Centralized Store: The “store” encapsulates the application’s state logic, decoupling state management from UI components.
- Routing Management: The “router” directory clearly defines navigation and view mapping.
- Containerization and Consistency: Docker configurations imply that the development and deployment environments are well-considered.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Core Initialization
    subgraph "Core Initialization"
        A1("Entry Point (main.js)"):::entry
        A2("Router (src/router/index.js)"):::router
        A3("Store (src/store/index.js)"):::store
        A1 --> A2
        A1 --> A3
    end

    %% Layout Components
    subgraph "Layout Components"
        L1("NavBar"):::layout
        L2("Footer"):::layout
    end

    %% Admin Dashboard Module
    subgraph "Admin Dashboard Module"
        AD1("Dashboard Components"):::module
        AD2("Admin Views"):::module
        AD1 --> AD2
    end

    %% Employee Dashboard Module
    subgraph "Employee Dashboard Module"
        ED1("Dashboard Components"):::module
        ED2("Employee Views"):::module
        ED1 --> ED2
    end

    %% Authentication Module
    subgraph "Authentication Module"
        AU("Auth Views"):::module
    end

    %% Estate Module
    subgraph "Estate Module"
        ES1("Detail Components"):::module
        ES2("List Views"):::module
        ES3("Estate Details View"):::module
        ES1 --> ES3
    end

    %% User Post Management Module
    subgraph "User Post Management Module"
        UP1("Post Components"):::module
        UP2("User Post Views"):::module
        UP1 --> UP2
    end

    %% Create Post & Cloudinary Integration
    subgraph "Create Post & Cloudinary Integration"
        CP1("Create Post Components"):::module
        CP2("Cloudinary Upload"):::module
        CP3("Cloudinary Config"):::external
        CP1 --> CP2
        CP2 --> CP3
    end

    %% Reusable UI Components
    subgraph "Reusable UI Components"
        UI("UI Elements"):::ui
    end

    %% Assets
    subgraph "Assets"
        AS1("CSS & Tailwind"):::asset
        AS2("Images"):::asset
        AS3("Fonts"):::asset
    end

    %% Build & Deployment Configurations
    subgraph "Build & Deployment Configurations"
        BD1("Dockerfile"):::config
        BD2("docker-compose.yml"):::config
        BD3("Vue Config (vue.config.js)"):::config
        BD4("Tailwind Config (tailwind.config.js)"):::config
    end

    %% Connections from Core to Modules
    A2 -->|"routes_to"| AU
    A2 -->|"routes_to"| AD2
    A2 -->|"routes_to"| ED2
    A2 -->|"routes_to"| ES2
    A2 -->|"routes_to"| UP2
    A2 -->|"routes_to"| CP1
    A2 -->|"routes_to"| ES3

    %% Layout used by Views
    AU -->|"uses"| L1
    AU -->|"uses"| L2
    AD2 -->|"uses"| L1
    AD2 -->|"uses"| L2
    ED2 -->|"uses"| L1
    ED2 -->|"uses"| L2
    ES2 -->|"uses"| L1
    ES2 -->|"uses"| L2
    UP2 -->|"uses"| L1
    UP2 -->|"uses"| L2
    CP1 -->|"uses"| L1
    CP1 -->|"uses"| L2

    %% UI Integration & State Flow
    UI -->|"integrated_in"| AD2
    UI -->|"integrated_in"| ED2
    UI -->|"integrated_in"| AU
    UI -->|"integrated_in"| ES2
    UI -->|"integrated_in"| UP2
    UI -->|"updates_state"| A3
    L1 -->|"triggers_nav"| A2

    %% State change flows from views
    AU -->|"state_change"| A3
    AD2 -->|"state_change"| A3
    ED2 -->|"state_change"| A3
    ES3 -->|"state_change"| A3
    UP2 -->|"state_change"| A3

    %% Build & Deployment integration with Core
    BD1 --> A1
    BD2 --> A1
    BD3 --> A1
    BD4 --> A1

    %% Assets provide styling
    AS1 --> L1
    AS1 --> UI
    AS1 --> L2

    %% Click Events
    click A1 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/main.js"
    click A2 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/router/index.js"
    click A3 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/store/index.js"
    click L1 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/components/layout/NavBar.vue"
    click L2 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/components/layout/Footer.vue"
    click AD1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/AdminDashboard"
    click AD2 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/views/AdminDashboard"
    click ED1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/EmployeePage"
    click ED2 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/views/EmployeeDashboard"
    click AU "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/views/AuthenView"
    click ES1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/EstateDetailPage"
    click ES2 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/views/EstateList"
    click ES3 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/views/EstateDetails.vue"
    click UP1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/UserPostManagement"
    click UP2 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/views/UserPostManagement"
    click CP1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/CreatePost"
    click CP2 "https://github.com/samuriseee/batdongsan-frontend/blob/master/src/components/CreatePost/CloudinaryUpload.vue"
    click CP3 "https://github.com/samuriseee/batdongsan-frontend/blob/master/cloudinaryConfig.js"
    click UI "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/components/ui"
    click AS1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/assets/css"
    click AS2 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/assets/image"
    click AS3 "https://github.com/samuriseee/batdongsan-frontend/tree/master/src/assets/font"
    click BD1 "https://github.com/samuriseee/batdongsan-frontend/tree/master/Dockerfile"
    click BD2 "https://github.com/samuriseee/batdongsan-frontend/blob/master/docker-compose.yml"
    click BD3 "https://github.com/samuriseee/batdongsan-frontend/blob/master/vue.config.js"
    click BD4 "https://github.com/samuriseee/batdongsan-frontend/blob/master/tailwind.config.js"

    %% Styles
    classDef entry fill:#ffcccc,stroke:#ff0000,stroke-width:2px;
    classDef router fill:#ccffcc,stroke:#00aa00,stroke-width:2px;
    classDef store fill:#ccffff,stroke:#009999,stroke-width:2px;
    classDef layout fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef module fill:#e0ccff,stroke:#aa00aa,stroke-width:2px;
    classDef external fill:#fce5cd,stroke:#b45f06,stroke-width:2px;
    classDef ui fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef asset fill:#c9daf8,stroke:#1155cc,stroke-width:2px;
    classDef config fill:#f4cccc,stroke:#cc0000,stroke-width:2px;
```
