# kerokerokohei/akari_test architecture

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

- Interactive diagram: https://gitdiagram.com/kerokerokohei/akari_test
- Repository: https://github.com/kerokerokohei/akari_test

## Overview

##### Main Components
- Frontend: Represented by the "Frontend" directory. It includes:
- React components (e.g., TaskInput, Tasklist, CompleteButton, DeleteButton)
- Entry point files (e.g., main.tsx, App.tsx)
- Query definitions for data fetching (queries.ts)
- Backend: Represented by the "Backend" directory, which comprises:
- NestJS application structure (main.ts, app.module.ts, and several modules such as the Task module).
- GraphQL layer (schema.graphql, resolvers, and DTOs for task creation and update).
- Database integration using Prisma (schema.prisma, migrations, seed scripts, and prisma.service.ts)
- Testing set-ups in the test folder.
- Database Layer: Though not explicitly defined by a database server file, the backend’s use of Prisma and migration files implies integration with a relational database (e.g., PostgreSQL, MySQL).

##### Relationships and Interactions
- Frontend to Backend:
- The frontend sends GraphQL queries or mutations (using defined queries and mutations in files like TaskMutation.ts) to the backend API endpoints.
- Backend Processing:
- The NestJS backend processes these requests via resolvers/controllers, which then interact with corresponding services (e.g., TaskService).
- Services perform business logic and invoke the Prisma service to execute database operations.
- Database Integration:
- The Prisma service translates service calls into queries against the underlying database using the schema.prisma definitions and migrations.
- CI/CD and Code Quality:
- GitHub workflows (.github/workflows) are used for linting both the frontend and backend, ensuring code quality and consistency.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The delineation between frontend, backend, and database makes for a modular design.
- Layered Architecture in Backend: Notice the NestJS module organization with controllers/resolvers, services, and data access layers (via Prisma).
- GraphQL API: The existence of schema.graphql and resolver files indicates that the backend is designed to support GraphQL queries/mutations.
- Component-Based Frontend: The React codebase uses distinct components with a clear structure, facilitating modular UI development.
- Infrastructure as Code: CI/CD pipelines are configured in GitHub Actions, which helps automate testing and linting tasks.

##### Final Reminders
- Every component is labeled clearly.
- As many granular architectural details as possible to provide an end-to-end view of the system’s design, from initial API call from the React frontend to database operations performed via Prisma in the NestJS backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FM1["main.tsx (Entry)"]:::frontend
        FM2["App.tsx (Entry)"]:::frontend
        FQ["queries.ts (Query Layer)"]:::frontend
        FC["UI Components (TaskInput, Tasklist, CompleteButton, DeleteButton)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BS["GraphQL Schema (schema.graphql)"]:::backend
        BT["Task Module (Resolvers, DTOs, TaskService)"]:::backend
        BC["NestJS Core (main.ts, app.module.ts, app.service.ts)"]:::backend
        PS["Prisma Service (prisma.service.ts)"]:::backend
        PM["Prisma Schema & Migrations (schema.prisma, migrations, seed)"]:::backend
        TST["Backend Testing"]:::test
    end

    %% Database and CI/CD
    DB["Database (Relational)"]:::database
    CI["CI/CD Workflows"]:::ci

    %% Frontend vertical flow
    FM1 --> FM2
    FM2 --> FQ
    FQ --> FC
    %% Frontend to Backend
    FC -->|"GraphQL_API"| BS

    %% Backend vertical flow
    BS -->|"Handles_Request"| BT
    BT -->|"Invokes_Service"| BC
    BC -->|"Triggers_DB_Operation"| PS
    PS -->|"Uses_Schema"| PM
    PS -->|"Queries"| DB

    %% Testing connection (dotted indicating test interactions)
    TST -.-> BC

    %% CI/CD connections (dotted arrows from primary layers to CI/CD)
    FC -.-> CI
    BC -.-> CI

    %% Click Events
    click FM1 "https://github.com/kerokerokohei/akari_test/blob/main/Frontend/src/main.tsx"
    click FM2 "https://github.com/kerokerokohei/akari_test/blob/main/Frontend/src/App.tsx"
    click FQ "https://github.com/kerokerokohei/akari_test/blob/main/Frontend/src/queries.ts"
    click FC "https://github.com/kerokerokohei/akari_test/tree/main/Frontend/src/components"
    click BC "https://github.com/kerokerokohei/akari_test/tree/main/Backend/src"
    click BT "https://github.com/kerokerokohei/akari_test/tree/main/Backend/src/modules/task"
    click BS "https://github.com/kerokerokohei/akari_test/blob/main/Backend/src/schema.graphql"
    click PM "https://github.com/kerokerokohei/akari_test/tree/main/Backend/prisma"
    click PS "https://github.com/kerokerokohei/akari_test/blob/main/Backend/src/prisma.service.ts"
    click TST "https://github.com/kerokerokohei/akari_test/tree/main/Backend/test"
    click CI "https://github.com/kerokerokohei/akari_test/tree/main/.github/workflows"

    %% Styles
    classDef frontend fill:#ffefc6,stroke:#b38f00,stroke-width:2px;
    classDef backend fill:#c6e0ff,stroke:#005b96,stroke-width:2px;
    classDef database fill:#d0f0c0,stroke:#2d6a4f,stroke-width:2px,stroke-dasharray: 5 5;
    classDef ci fill:#ffe0e0,stroke:#a4161a,stroke-width:2px,stroke-dasharray: 3 3;
    classDef test fill:#fddde6,stroke:#d81159,stroke-width:2px,stroke-dasharray: 2 2;
```
