# zanhzanhzanh/finalcapstone-fiverr-web-app architecture

> Architecture diagram of the GitHub repository zanhzanhzanh/finalcapstone-fiverr-web-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zanhzanhzanh/finalcapstone-fiverr-web-app
- Repository: https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app

## Overview

##### Main Components
- Application Entry: Start with the core NestJS application entry point (src/main.ts), which boots up the Nest application.
- Modules: Represent each NestJS module as a distinct component. This includes Auth, Comment, Job, Job Rental, Job Type Details, Job Type, and User modules. They serve as the principal building blocks encapsulating specific concerns.
- Common/Utility Components: Include shared utilities and helpers present in the common and util directories.
- Configuration and Deployment: Include Dockerfile and docker-compose.yml, as well as Nest CLI and environment configuration files which dictate project setup done outside of the runtime code.

##### Relationships and Interactions
- That the main NestJS application (bootstrap in src/main.ts) integrates all the modules using the App Module (src/app.module.ts).
- For authentication, illustrate that the Auth module uses strategies (local and JWT) with guard patterns that intercept and validate credentials before allowing access to secured resources.
- Database as an external component that is accessed by the Prisma service. Connect this with all modules that require data persistence (e.g., Comment, Job, User modules).

##### Architectural Patterns and Technologies
- Modular design: Group components by the NestJS module.
- Layers: Separate presentation (controllers), business logic (services), data access (Prisma), and configuration (modules, environment files).
- Dependency Injection: Implicitly indicate that NestJS uses dependency injection, where the App Module injects and bundles the different modules.
- Containerization: Represent the Docker container, which encapsulates the application along with the execution environment.

##### Putting It All Together
- Elements are clearly labeled with descriptive text and legends as necessary.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% NestJS Application
    subgraph "NestJS Application"
        subgraph "Application Entry"
            main_ts("main.ts"):::entry
            app_module("AppModule"):::entry
        end
        subgraph "Modules"
            %% Auth Module
            subgraph "Auth Module"
                auth_module("AuthModule"):::module
                auth_controller("AuthController"):::controller
                auth_service("AuthService"):::service
                auth_jwt("JWT Strategy"):::strategy
                auth_local("Local Strategy"):::strategy
            end
            %% Comment Module
            subgraph "Comment Module"
                comment_module("CommentModule"):::module
                comment_controller("CommentController"):::controller
                comment_service("CommentService"):::service
            end
            %% Job Module
            subgraph "Job Module"
                job_module("JobModule"):::module
                job_controller("JobController"):::controller
                job_service("JobService"):::service
            end
            %% Job Rental Module
            subgraph "Job Rental Module"
                jobrental_module("JobRentalModule"):::module
                jobrental_controller("JobRentalController"):::controller
                jobrental_service("JobRentalService"):::service
            end
            %% Job Type Details Module
            subgraph "Job Type Details Module"
                jobtypedetails_module("JobTypeDetailsModule"):::module
                jobtypedetails_controller("JobTypeDetailsController"):::controller
                jobtypedetails_service("JobTypeDetailsService"):::service
            end
            %% Job Type Module
            subgraph "Job Type Module"
                jobtype_module("JobTypeModule"):::module
                jobtype_controller("JobTypeController"):::controller
                jobtype_service("JobTypeService"):::service
            end
            %% User Module
            subgraph "User Module"
                user_module("UserModule"):::module
                user_controller("UserController"):::controller
                user_service("UserService"):::service
            end
        end
    end

    %% External components
    HTTP("HTTP Request"):::external
    subgraph "Common & Utilities"
        common("Common"):::common
        util("Util"):::common
    end
    subgraph "Prisma & Database"
        prisma_service("Prisma Service"):::prisma
        external_db("External Database"):::externalDB
    end
    subgraph "Configuration & Deployment"
        dockerfile("Dockerfile"):::config
        docker_compose("docker-compose.yml"):::config
        env_example(".env.example"):::config
        nest_cli("nest-cli.json"):::config
    end

    %% Connections
    main_ts --> app_module
    app_module --> auth_module
    app_module --> comment_module
    app_module --> job_module
    app_module --> jobrental_module
    app_module --> jobtypedetails_module
    app_module --> jobtype_module
    app_module --> user_module

    HTTP -->|"triggers"| auth_controller
    HTTP -->|"triggers"| comment_controller
    HTTP -->|"triggers"| job_controller
    HTTP -->|"triggers"| jobrental_controller
    HTTP -->|"triggers"| jobtypedetails_controller
    HTTP -->|"triggers"| jobtype_controller
    HTTP -->|"triggers"| user_controller

    auth_controller -->|"calls"| auth_service
    comment_controller -->|"calls"| comment_service
    job_controller -->|"calls"| job_service
    jobrental_controller -->|"calls"| jobrental_service
    jobtypedetails_controller -->|"calls"| jobtypedetails_service
    jobtype_controller -->|"calls"| jobtype_service
    user_controller -->|"calls"| user_service

    auth_service -->|"authenticates_via"| auth_jwt
    auth_service -->|"authenticates_via"| auth_local

    auth_service -->|"uses"| prisma_service
    comment_service -->|"uses"| prisma_service
    job_service -->|"uses"| prisma_service
    jobrental_service -->|"uses"| prisma_service
    jobtypedetails_service -->|"uses"| prisma_service
    jobtype_service -->|"uses"| prisma_service
    user_service -->|"uses"| prisma_service

    prisma_service --> external_db

    auth_service -->|"utilizes"| common
    comment_service -->|"utilizes"| common
    job_service -->|"utilizes"| common
    jobrental_service -->|"utilizes"| common
    jobtypedetails_service -->|"utilizes"| common
    jobtype_service -->|"utilizes"| common
    user_service -->|"utilizes"| common
    auth_service -->|"utilizes"| util
    comment_service -->|"utilizes"| util
    job_service -->|"utilizes"| util
    jobrental_service -->|"utilizes"| util
    jobtypedetails_service -->|"utilizes"| util
    jobtype_service -->|"utilizes"| util
    user_service -->|"utilizes"| util

    %% Click Events
    click main_ts "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/main.ts"
    click app_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/app.module.ts"

    click auth_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/auth/auth.module.ts"
    click auth_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/auth/auth.controller.ts"
    click auth_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/auth/auth.service.ts"
    click auth_jwt "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/auth/strategy/jwt.strategy.ts"
    click auth_local "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/auth/strategy/local.strategy.ts"

    click comment_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/comment/comment.module.ts"
    click comment_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/comment/comment.controller.ts"
    click comment_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/comment/comment.service.ts"

    click job_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job/job.module.ts"
    click job_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job/job.controller.ts"
    click job_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job/job.service.ts"

    click jobrental_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-rental/job-rental.module.ts"
    click jobrental_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-rental/job-rental.controller.ts"
    click jobrental_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-rental/job-rental.service.ts"

    click jobtypedetails_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-type-details/job-type-details.module.ts"
    click jobtypedetails_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-type-details/job-type-details.controller.ts"
    click jobtypedetails_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job-type-details/job-type-details.service.ts"

    click jobtype_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job_type/job_type.module.ts"
    click jobtype_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job_type/job_type.controller.ts"
    click jobtype_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/job_type/job_type.service.ts"

    click user_module "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/user/user.module.ts"
    click user_controller "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/user/user.controller.ts"
    click user_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/src/user/user.service.ts"

    click common "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/tree/main/src/common"
    click util "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/tree/main/src/util"

    click prisma_service "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/prisma/prisma.service.ts"
    click external_db "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/fiverr_db.sql"

    click dockerfile "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/tree/main/Dockerfile"
    click docker_compose "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/docker-compose.yml"
    click env_example "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/.env.example"
    click nest_cli "https://github.com/zanhzanhzanh/finalcapstone-fiverr-web-app/blob/main/nest-cli.json"

    %% Styles
    classDef entry fill:#FCE4D6,stroke:#333,stroke-width:2px;
    classDef module fill:#FFF2CC,stroke:#333,stroke-width:2px;
    classDef controller fill:#C9E6FF,stroke:#333,stroke-width:2px;
    classDef service fill:#DFF0D8,stroke:#333,stroke-width:2px;
    classDef strategy fill:#F2DEDE,stroke:#333,stroke-width:2px;
    classDef common fill:#E8E8E8,stroke:#333,stroke-width:2px;
    classDef prisma fill:#E1D5E7,stroke:#333,stroke-width:2px;
    classDef config fill:#E6E6E6,stroke:#333,stroke-width:2px;
    classDef externalDB fill:#F5DEB3,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD699,stroke:#333,stroke-width:2px;
```
