# shihabzzz/todo-rpc-next architecture

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

- Interactive diagram: https://gitdiagram.com/shihabzzz/todo-rpc-next
- Repository: https://github.com/shihabzzz/todo-rpc-next

## Overview

##### Main Components

Frontend Layer:
- Next.js Application (Port 3000)
- Pages (/app directory indicating Next.js 13+ App Router)
- Components (especially TaskManager)
- UI Components (toast system)

Backend Layer:
- Hono API Server
- Database Connection Layer
- API Routes
- Schema Definitions

Database Layer:
- Turso SQLite Database (distributed SQLite database)

**[Client Layer]**

- ▼
**[API Layer]**

- ▼
**[Database Layer]**

##### Connection and Data Flow

- Client-to-API communication (HTTP/REST)
- API-to-Database communication (SQL queries via Drizzle ORM)
- State management flow within the frontend

##### Technical Details

Framework & Libraries (Add as labels):
- Next.js
- Hono
- Drizzle ORM
- TailwindCSS
- TypeScript

##### Additional Elements

Environment Configuration:
- Environment variables influence
- Port configurations
- Database connection settings

##### Specific Implementation Notes

- Utils layer (shared utilities)
- Configuration files
- Type definitions

- Component interaction within the frontend
- Database schema relationships
- Authentication flow (if implemented)

- The separation between frontend and backend
- The role of the API layer as an intermediary
- The database interaction pattern
- The component-based architecture of the frontend

Use standardized UML or C4 model notation where applicable, but prioritize clarity and understanding over strict adherence to any particular notation system.

Remember to indicate the development ports (3000 for Next.js) and any other environment-specific configurations that are crucial for understanding the system's deployment structure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        NextApp["Next.js Application (Port 3000)"]
        AppRouter["App Router"]
        TaskManager["Task Manager"]
        ToastSystem["Toast System"]
        Hooks["Frontend Hooks"]
        UIComponents["UI Components"]
        
        NextApp --> AppRouter
        NextApp --> TaskManager
        NextApp --> ToastSystem
        NextApp --> Hooks
        NextApp --> UIComponents
    end

    subgraph API
        HonoAPI["Hono API Server"]
        APIRoutes["API Routes"]
        DBSchema["Database Schema"]
        DBConn["Database Connection"]
        APIUtils["API Utilities"]
        
        HonoAPI --> APIRoutes
        HonoAPI --> DBSchema
        HonoAPI --> DBConn
        HonoAPI --> APIUtils
    end

    subgraph Database
        TursoDB[(Turso SQLite Database)]
    end

    Client -- "HTTP/REST" --> API
    DBConn -- "SQL via Drizzle ORM" --> TursoDB

    %% Component Mappings
    click AppRouter "https://github.com/ShihabZzz/todo-rpc-next/blob/main/app/layout.tsx"
    click TaskManager "https://github.com/ShihabZzz/todo-rpc-next/blob/main/components/TaskManager.tsx"
    click ToastSystem "https://github.com/ShihabZzz/todo-rpc-next/blob/main/components/ui/toast.tsx"
    click Hooks "https://github.com/ShihabZzz/todo-rpc-next/blob/main/hooks/use-toast.ts"
    click HonoAPI "https://github.com/ShihabZzz/todo-rpc-next/blob/main/api/src/index.ts"
    click DBConn "https://github.com/ShihabZzz/todo-rpc-next/blob/main/api/connection.ts"
    click DBSchema "https://github.com/ShihabZzz/todo-rpc-next/blob/main/api/src/db/schema.ts"
    click APIUtils "https://github.com/ShihabZzz/todo-rpc-next/blob/main/api/utils.ts"
    click UIComponents "https://github.com/ShihabZzz/todo-rpc-next/tree/main/components/ui"

    classDef client fill:#e1f5fe,stroke:#01579b
    classDef api fill:#e8f5e9,stroke:#1b5e20
    classDef database fill:#fff3e0,stroke:#e65100

    class NextApp,AppRouter,TaskManager,ToastSystem,Hooks,UIComponents client
    class HonoAPI,APIRoutes,DBSchema,DBConn,APIUtils api
    class TursoDB database

    %% Legend
    subgraph Legend
        L1[Client Components]:::client
        L2[API Components]:::api
        L3[(Database Components)]:::database
    end
```
