# thanhhangdang/dacn architecture

> Architecture diagram of the GitHub repository thanhhangdang/dacn, 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/thanhhangdang/dacn
- Repository: https://github.com/thanhhangdang/dacn

## Overview

##### Project Type and Purpose
- The project clearly separates into three major parts: a frontend, a backend, and a database component.
- The naming of files and directories (e.g., workControllers.js, companyControllers.js, jobseeker-related components, etc.) suggests a job portal or career management system for both job seekers and employers.
- The database scripts in the Database folder (e.g., script_create_table_DACN_boostcareer.sql) indicate that the application’s persistent store schema and data are defined separately.

##### Analysis of the File Structure
- Top-Level Directories:
– Database: Contains SQL scripts and image resources.
– backend: Contains Node.js/Express server code, configurations (for CORS, database, S3, sessions), middleware (JWT authentication, image upload), and controllers/models/routes for various functionalities (authentication, company, category, user, work).
– frontend: Contains the React application including components, Redux actions/reducers for state management, and several pages dedicated to job seekers, employers, company management, etc.
- Architectural patterns:
– The backend appears to follow the MVC pattern (Models, Views – here replaced by controllers and routes since it's an API server).
– The frontend leverages component-based design (React components) with Redux for state management.
- Configuration files (package.json, various config files) and asset directories help distinguish between development and deployment responsibilities.

##### Final Recommendations
- That the design reflects both the separation of concerns (frontend vs. backend vs. database) and the detailed internal structures (e.g., separate controllers and middleware inside the backend).

This approach will ensure that the principal software engineer has a comprehensive visual overview of the project’s system architecture tailored to the project’s specific structure and technologies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer (React+Redux)"
        FE1("Frontend Application"):::frontend
        FE2("Job Seeker Pages"):::frontend
        FE3("Employer Pages"):::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer (Node.js/Express API)"
        BE1("Backend API Server"):::backend

        subgraph "Authentication Module"
            BEA1("Auth Controller"):::backendInner
            BEA2("Auth Route"):::backendInner
            BEA3("Auth Model"):::backendInner
            BEA4("Auth Middleware"):::backendInner
        end

        subgraph "Company Management Module"
            BEC1("Company Controller"):::backendInner
            BEC2("Company Route"):::backendInner
            BEC3("Company Model"):::backendInner
        end

        subgraph "Work Management Module"
            BEW1("Work Controller"):::backendInner
            BEW2("Work Route"):::backendInner
            BEW3("Work Model"):::backendInner
        end

        subgraph "Category Management Module"
            BECa1("Category Controller"):::backendInner
            BECa2("Category Route"):::backendInner
            BECa3("Category Model"):::backendInner
        end

        subgraph "User Management Module"
            BEU1("User Controller"):::backendInner
            BEU2("User Route"):::backendInner
            BEU3("User Model"):::backendInner
        end

        subgraph "External Service Integration"
            BES1("S3 Config"):::external
            BES2("Image Upload Middleware"):::external
        end
    end

    %% Database and External Services
    DB("((Database (SQL)))"):::database
    ES("External Services (AWS S3)"):::external

    %% Connections between Layers
    FE1 -->|"APIcalls"| BE1
    BE1 -->|"SQLQueries"| DB
    BE1 -->|"ImageUploads"| ES

    %% Styling Classes
    classDef frontend fill:#add8e6,stroke:#000,stroke-width:1px;
    classDef backend fill:#90ee90,stroke:#000,stroke-width:1px;
    classDef backendInner fill:#98fb98,stroke:#000,stroke-width:1px;
    classDef database fill:#ffcccb,stroke:#000,stroke-width:1px;
    classDef external fill:#ffd700,stroke:#000,stroke-width:1px;

    %% Click Events
    click FE1 "https://github.com/thanhhangdang/dacn/tree/main/frontend"
    click BE1 "https://github.com/thanhhangdang/dacn/tree/main/backend"
    click DB "https://github.com/thanhhangdang/dacn/tree/main/Database"

    click BEA1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/controllers/authencationControllers.js"
    click BEA2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/routes/authencationRoutes.js"
    click BEA3 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/models/authencationModels.js"
    click BEA4 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/middleware/JWTAction.js"

    click BEC1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/controllers/companyControllers.js"
    click BEC2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/routes/companyRoutes.js"
    click BEC3 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/models/companyModels.js"

    click BEW1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/controllers/workControllers.js"
    click BEW2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/routes/workRoutes.js"
    click BEW3 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/models/workModel.js"

    click BECa1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/controllers/categoryController.js"
    click BECa2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/routes/categoryRoutes.js"
    click BECa3 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/models/categoryModel.js"

    click BEU1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/controllers/userControllers.js"
    click BEU2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/routes/userRoutes.js"
    click BEU3 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/models/userModels.js"

    click BES1 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/config/s3Config.js"
    click BES2 "https://github.com/thanhhangdang/dacn/blob/main/backend/src/middleware/imageUpload.js"

    click FE2 "https://github.com/thanhhangdang/dacn/tree/main/frontend/src/component/JobSeekersPage"
    click FE3 "https://github.com/thanhhangdang/dacn/tree/main/frontend/src/component/EmployerPage"
```
