# oldboyxx/jira_clone architecture

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

- Interactive diagram: https://gitdiagram.com/oldboyxx/jira_clone
- Repository: https://github.com/oldboyxx/jira_clone

## Overview

##### Main Components
- Backend/API Server: Represented by the “api” folder. Key subcomponents include:
- Controllers (e.g., authentication, comments, issues, projects, users) that handle the incoming HTTP requests.
- Database module (createConnection, createGuestAccount, resetDatabase) showing interactions with a PostgreSQL database.
- Entities (User, Issue, Project, Comment) defined with TypeORM that map directly to the database tables.
- Middleware and routing modules which control authentication, error handling, and shaping the HTTP responses.
- Utility modules (authToken, typeorm, validation) and error-handling logic that support the API functionality.
- Frontend Client: Represented by the “client” folder. Key components include:
- React components for authentication, project boards, issue details, searches, etc.
- Custom UI components (shared components like Button, Modal, Input, DatePicker, etc.) that are styled and organized.
- Routing and state management with React hooks (functional components, no Redux) to control the app’s flow.
- Test folders (Cypress and Jest) indicating end-to-end and unit test support.
- Custom webpack configuration for building and deploying the client code.
- Database: A PostgreSQL database (as described in README instructions) is used with TypeORM managing the connection and schema via the API.

##### Relationships and Interactions
- That the API server interacts with the PostgreSQL database using TypeORM.
- That the API is layered with middleware (authentication, error handling, response formatting).
- The API controllers are responsible for orchestrating operations between incoming requests and database transactions.

##### Architectural Patterns and Key Technologies
- Separation of concerns is a key design principle where the API is logically divided into controllers, middleware, database connectors, and error handling.
- MVC-like patterns in the API: Controllers for handling logic, Entities acting as Models, and Routes/middleware forming the connection to the view (the client).
- On the frontend, component-based architecture using React with functional components and custom hooks ensures a clear separation of UI, state, and business logic.
- Use of TypeORM in the API to abstract database interactions and leverage TypeScript’s static type checking.
- Custom configurations for webpack and Babel illustrate a more granular build system as compared to tools like create-react-app.

##### Be Detailed Yet Clear
- Notes for key design choices such as using TypeORM’s “synchronize” feature and the simplified authentication mechanism, as these are crucial for understanding the backend design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend (React Client)"
        F1["Frontend Client (React)"]:::frontend
        F2["React Components & Routing"]:::frontend
        F3["Shared UI Components"]:::frontend
        subgraph "Frontend Testing"
            F4["Cypress Tests"]:::frontend
            F5["Jest Tests"]:::frontend
        end
        subgraph "Build Configurations"
            F6["Webpack Config"]:::frontend
            F7["Production Webpack Config"]:::frontend
            F8["Babel Configuration"]:::frontend
        end
    end

    %% Backend Subgraph
    subgraph "Backend/API Server (Node/TypeScript)"
        B1["API Entry Point"]:::backend
        B2["Controllers (Auth, Comments, Issues, Projects, Users)"]:::backend
        B3["Middleware (Auth, Error Handling, Response Formatting)"]:::backend
        B4["Entities (User, Issue, Project, Comment)"]:::backend
        B5["Database Module (createConnection, createGuestAccount, resetDatabase)"]:::backend
        B6["Utility Modules (authToken, typeorm, validation)"]:::backend
    end

    %% Database
    D["PostgreSQL Database"]:::database

    %% Data Flow Connections
    F1 -->|"RESTful calls"| B1
    B1 -->|"routes to"| B2
    B2 -->|"invokes"| B3
    B2 -->|"maps data via"| B4
    B2 -->|"calls"| B5
    B5 -->|"connects to"| D

    %% Additional Frontend Relationships
    F1 --> F2
    F1 --> F3

    %% Click Events for Frontend Components
    click F1 "https://github.com/oldboyxx/jira_clone/tree/master/client/"
    click F2 "https://github.com/oldboyxx/jira_clone/tree/master/client/src/App/"
    click F3 "https://github.com/oldboyxx/jira_clone/tree/master/client/src/shared/components/"
    click F4 "https://github.com/oldboyxx/jira_clone/tree/master/client/cypress/"
    click F5 "https://github.com/oldboyxx/jira_clone/tree/master/client/jest/"
    click F6 "https://github.com/oldboyxx/jira_clone/blob/master/client/webpack.config.js"
    click F7 "https://github.com/oldboyxx/jira_clone/blob/master/client/webpack.config.production.js"
    click F8 "https://github.com/oldboyxx/jira_clone/blob/master/client/.babelrc"

    %% Click Events for Backend Components
    click B1 "https://github.com/oldboyxx/jira_clone/blob/master/api/src/index.ts"
    click B2 "https://github.com/oldboyxx/jira_clone/tree/master/api/src/controllers/"
    click B3 "https://github.com/oldboyxx/jira_clone/tree/master/api/src/middleware/"
    click B4 "https://github.com/oldboyxx/jira_clone/tree/master/api/src/entities/"
    click B5 "https://github.com/oldboyxx/jira_clone/tree/master/api/src/database/"
    click B6 "https://github.com/oldboyxx/jira_clone/tree/master/api/src/utils/"

    %% Class Definitions for Colors and Styles
    classDef frontend fill:#d6f9e3,stroke:#3eb04e,stroke-width:2px;
    classDef backend fill:#f9d6d5,stroke:#b0413e,stroke-width:2px;
    classDef database fill:#e3eaff,stroke:#3e53b0,stroke-width:2px;
```
