# berkayderin/ibb-otobus-app architecture

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

- Interactive diagram: https://gitdiagram.com/berkayderin/ibb-otobus-app
- Repository: https://github.com/berkayderin/ibb-otobus-app

## Overview

##### Main Components

a. Client-Side Layer:
- Sub-components:
- UI Components (from /components/ui)
- Feature Components (from /features/components)
- Client-Side State Management (React Query implied by useTransportQueries)

b. API Layer:
- Four main endpoints:
- /api/duraklar (Stops)
- /api/duyurular (Announcements)
- /api/filo (Fleet)
- /api/seferler (Trips)

c. Services Layer:
- TransportService from features/services

##### Component Relationships

- Feature Components → UI Components (composition)
- Feature Components → Transport Queries (data fetching)
- Transport Queries → API Routes (HTTP requests)
- API Routes → Transport Services (business logic)

##### Specific Implementation Details

- Next.js 13+ App Router architecture
- UI Component library integration
- React Query for state management
- TailwindCSS for styling

##### Technical Stack Highlights

- Next.js
- React
- TailwindCSS
- Shadcn UI (implied by component structure)
- React Query

**[User Interface Layer]**
- ↓
**[Feature Components Layer]**
- ↓
**[Data Management Layer (React Query)]**
- ↓
**[API Routes Layer]**
- ↓
**[Services Layer]**

Important Considerations:

##### How the transport queries interface with the API routes.

Additional Elements to Include:

##### Error Handling Flow
- How ErrorWithRetry component fits into the architecture
- Error propagation paths

##### Data Flow Patterns
- SSR (Server-Side Rendering) paths
- Client-side navigation flows
- Data refresh patterns

##### Configuration Context
- Relevant config files (next.config.mjs, tailwind.config.js)
- How they influence the application structure

- Grouping related components
- Adding clear labels and annotations
- Adding version numbers for key technologies

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User Interface Layer"
        UI["UI Components"]
        BC["Button"]:::ui
        FC["Form"]:::ui
        TC["Table"]:::ui
        DC["Dialog"]:::ui
        UI --> BC
        UI --> FC
        UI --> TC
        UI --> DC
    end

    subgraph "Feature Components Layer"
        FT["Feature Components"]
        ST["Stops"]:::feature
        AN["Announcements"]:::feature
        FL["Fleet"]:::feature
        TR["Trip Information"]:::feature
        FT --> ST
        FT --> AN
        FT --> FL
        FT --> TR
    end

    subgraph "Data Management Layer"
        DM["Transport Queries"]:::data
        ERR["Error Handler"]:::error
    end

    subgraph "API Routes Layer"
        API["Next.js API Routes"]
        SA["/api/duraklar"]:::api
        AA["/api/duyurular"]:::api
        FA["/api/filo"]:::api
        TA["/api/seferler"]:::api
        API --> SA
        API --> AA
        API --> FA
        API --> TA
    end

    subgraph "Services Layer"
        TS["Transport Service"]:::service
        UT["Utilities"]:::util
    end

    subgraph "Configuration"
        NC["Next.js Config"]:::config
        TC["Tailwind Config"]:::config
        ML["Main Layout"]:::config
        MP["Main Page"]:::config
        PR["Providers"]:::config
    end

    FT --> UI
    FT --> DM
    DM --> API
    DM --> ERR
    API --> TS
    TS --> UT

    classDef ui fill:#3b82f6,color:#fff
    classDef feature fill:#22c55e,color:#fff
    classDef data fill:#a855f7,color:#fff
    classDef api fill:#eab308,color:#fff
    classDef service fill:#ef4444,color:#fff
    classDef config fill:#64748b,color:#fff
    classDef error fill:#f43f5e,color:#fff
    classDef util fill:#0ea5e9,color:#fff

    click BC "https://github.com/berkayderin/ibb-otobus-app/blob/main/components/ui/button.jsx"
    click FC "https://github.com/berkayderin/ibb-otobus-app/blob/main/components/ui/form.jsx"
    click TC "https://github.com/berkayderin/ibb-otobus-app/blob/main/components/ui/table.jsx"
    click DC "https://github.com/berkayderin/ibb-otobus-app/blob/main/components/ui/dialog.jsx"
    click ST "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/components/Duraklar.jsx"
    click AN "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/components/Duyurular.jsx"
    click FL "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/components/FiloAraclari.jsx"
    click TR "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/components/SeferBilgisi.jsx"
    click SA "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/api/duraklar/route.js"
    click AA "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/api/duyurular/route.js"
    click FA "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/api/filo/route.js"
    click TA "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/api/seferler/route.js"
    click TS "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/services/transportService.js"
    click DM "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/queries/useTransportQueries.js"
    click ERR "https://github.com/berkayderin/ibb-otobus-app/blob/main/features/components/ErrorWithRetry.jsx"
    click NC "https://github.com/berkayderin/ibb-otobus-app/blob/main/next.config.mjs"
    click TC "https://github.com/berkayderin/ibb-otobus-app/blob/main/tailwind.config.js"
    click UT "https://github.com/berkayderin/ibb-otobus-app/blob/main/lib/utils.js"
    click ML "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/layout.js"
    click MP "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/page.js"
    click PR "https://github.com/berkayderin/ibb-otobus-app/blob/main/app/providers.js"
    click UI "https://github.com/berkayderin/ibb-otobus-app/tree/main/components/ui"
```
