# raerta/assignment architecture

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

- Interactive diagram: https://gitdiagram.com/raerta/assignment
- Repository: https://github.com/raerta/assignment

## Overview

##### Main Components

A. Frontend Layer (Client-Side):
- Next.js Application Container
- Pages/Routes Structure (/karagetir, /stprm)
- Components Layer
- Services Layer
- UI Framework Components (Mantine)
- Static Assets (public directory)

B. API Integration Layer:
- API Client Services
- Type Definitions
- Endpoint Configurations

- [Presentation Layer]
- Pages (app directory)
- Components
- UI Framework (Mantine)

- [Business Logic Layer]
- Services
- API Integration

- [Data Layer]
- Types
- Constants

##### Component Relationships

- Pages importing and using components
- Components calling services
- Services using API integration
- Data flow between layers

##### Specific Implementation Details

Key architectural elements:
- Next.js App Router structure (src/app directory)
- Component hierarchy (src/components)
- Service layer (src/services)
- Type definitions (src/types)
- API integration (src/request)

##### Additional Elements

- Configuration files (next.config.mjs, tailwind.config.ts)
- External dependencies (Mantine UI)
- Environment configurations

##### Notes for Implementation

- The app's modular structure
- Clear separation of concerns
- Service-based architecture
- Type safety implementation
- API integration pattern

Key Considerations:
- Relationship between pages and their corresponding components
- Service layer's role in handling business logic
- Demonstrate how types are used across the application
- API integration flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph NextApp["Next.js Application"]
        subgraph PL["Presentation Layer"]
            Pages["Pages Container"]
            MainPage["Main Page"]:::page
            KaragetirPage["Karagetir Page"]:::page
            StprmPage["STPRM Page"]:::page
            
            subgraph Components["Components Layer"]
                Nav["Navigation Components"]:::component
                MantineUI["Mantine UI Components"]:::component
                KaraGetirComp["KaraGetir Components"]:::component
                StpTableComp["STP Table Components"]:::component
            end
            
            Pages --> MainPage & KaragetirPage & StprmPage
        end
        
        subgraph BL["Business Logic Layer"]
            subgraph Services["Services Layer"]
                KaraService["Kara Service"]:::service
                LoginService["Login Service"]:::service
                StpRmService["STP RM Service"]:::service
            end
            
            subgraph API["API Integration Layer"]
                ApiClient["API Client"]:::api
                EndpointConfig["Endpoint Configurations"]:::config
            end
        end
        
        subgraph DL["Data Layer"]
            subgraph Types["Type Definitions"]
                KaraEkleTypes["KaraEkle Types"]:::type
                KaraGetirTypes["KaraGetir Types"]:::type
                StpRmTypes["StpRm Types"]:::type
            end
            
            subgraph Constants["Constants"]
                EnvConst["Environment Constants"]:::config
            end
        end
        
        subgraph Config["Configuration"]
            NextConfig["Next.js Config"]:::config
            TailwindConfig["Tailwind Config"]:::config
            TSConfig["TypeScript Config"]:::config
            ThemeConfig["Theme Config"]:::config
        end
    end
    
    %% Relationships
    MainPage & KaragetirPage & StprmPage --> Components
    Components --> Services
    Services --> API
    API --> EndpointConfig
    Services --> Types
    
    %% Click Events
    click Pages "https://github.com/raerta/assignment/tree/main/src/app/"
    click MainPage "https://github.com/raerta/assignment/blob/main/src/app/page.tsx"
    click KaragetirPage "https://github.com/raerta/assignment/blob/main/src/app/karagetir/page.tsx"
    click StprmPage "https://github.com/raerta/assignment/blob/main/src/app/stprm/page.tsx"
    click Nav "https://github.com/raerta/assignment/tree/main/src/components/Navigation/"
    click MantineUI "https://github.com/raerta/assignment/tree/main/src/components/Mantine/"
    click KaraGetirComp "https://github.com/raerta/assignment/tree/main/src/components/KaraGetir/"
    click StpTableComp "https://github.com/raerta/assignment/tree/main/src/components/StpTable/"
    click KaraService "https://github.com/raerta/assignment/blob/main/src/services/kara.service.ts"
    click LoginService "https://github.com/raerta/assignment/blob/main/src/services/login.service.ts"
    click StpRmService "https://github.com/raerta/assignment/blob/main/src/services/stpRmForKlasik.service.ts"
    click ApiClient "https://github.com/raerta/assignment/blob/main/src/request/api.ts"
    click EndpointConfig "https://github.com/raerta/assignment/blob/main/src/const/endpoints.ts"
    click KaraEkleTypes "https://github.com/raerta/assignment/blob/main/src/types/KaraEkle.ts"
    click KaraGetirTypes "https://github.com/raerta/assignment/blob/main/src/types/KaraGetir.ts"
    click StpRmTypes "https://github.com/raerta/assignment/blob/main/src/types/StpRmforKlasik.ts"
    click EnvConst "https://github.com/raerta/assignment/blob/main/src/const/env.ts"
    click NextConfig "https://github.com/raerta/assignment/blob/main/next.config.mjs"
    click TailwindConfig "https://github.com/raerta/assignment/blob/main/tailwind.config.ts"
    click TSConfig "https://github.com/raerta/assignment/blob/main/tsconfig.json"
    click ThemeConfig "https://github.com/raerta/assignment/blob/main/theme.ts"
    
    %% Styles
    classDef page fill:#2563eb,color:white
    classDef component fill:#16a34a,color:white
    classDef service fill:#ea580c,color:white
    classDef api fill:#9333ea,color:white
    classDef type fill:#6b7280,color:white
    classDef config fill:#475569,color:white
```
