# jolbol1/supatodo architecture

> Architecture diagram of the GitHub repository jolbol1/supatodo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jolbol1/supatodo
- Repository: https://github.com/jolbol1/supatodo

## Overview

##### Main System Components

a) Client Layer:
- Next.js Frontend (app directory structure)
- UI Components (components directory)
- Client-side State Management

b) Server Layer:
- Next.js Server Components
- Server Actions
- Authentication Middleware

c) External Services:
- Supabase Authentication
- Supabase Database
- GitHub OAuth

##### Data Flow Representation

- Client-Server interactions via Server Actions
- Authentication flow between Client → Server → Supabase
- Database operations flow
- OAuth authentication flow

##### Technical Details

Annotations for:
- TypeScript integration (types directory)
- Authentication middleware flow
- Database schema structure
- Server Action endpoints

**[Client Layer]**
- ↕
**[Server Layer]**
- ↕
**[External Services Layer]**

Important Implementation Details to Highlight:
- Server Actions implementation in /app/todos/actions.ts
- Auth flow through /app/auth/*
- Supabase client configuration in utils/supabase/*
- UI components structure in /components
- Middleware authentication checks

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Next.js Frontend]
        UI[UI Components]:::ui
        LP[Login Page]:::page
        TP[Todos Page]:::page
        OF[OAuth Form]:::component
        TF[Todo Form]:::component
        TI[Todo Item]:::component
        TL[Todo List]:::component
        HD[Header]:::component
    end

    subgraph Server
        SA[Server Actions]:::server
        AH[Auth Handlers]:::auth
        MW[Middleware]:::middleware
        SC[Supabase Config]:::config
    end

    subgraph External
        SB[Supabase]:::external
        subgraph Supabase_Services
            AS[Auth Service]:::auth
            DB[(Database)]:::database
        end
        GH[GitHub OAuth]:::external
    end

    %% Connections
    FE --> UI
    UI --> TF
    UI --> TI
    UI --> TL
    UI --> HD
    FE --> LP
    FE --> TP
    LP --> OF
    OF --> AH
    TP --> SA
    SA --> DB
    AH --> AS
    MW --> SC
    SC --> AS
    SC --> DB
    AS --> GH

    %% Styles
    classDef ui fill:#3498db
    classDef page fill:#2ecc71
    classDef component fill:#95a5a6
    classDef server fill:#e74c3c
    classDef auth fill:#f39c12
    classDef middleware fill:#8e44ad
    classDef config fill:#16a085
    classDef external fill:#7f8c8d
    classDef database fill:#2c3e50

    %% Click Events
    click UI "https://github.com/jolbol1/supatodo/tree/main/components"
    click TF "https://github.com/jolbol1/supatodo/blob/main/components/todo-form.tsx"
    click TI "https://github.com/jolbol1/supatodo/blob/main/components/todo-item.tsx"
    click TL "https://github.com/jolbol1/supatodo/blob/main/components/todo-list.tsx"
    click HD "https://github.com/jolbol1/supatodo/blob/main/components/header.tsx"
    click LP "https://github.com/jolbol1/supatodo/blob/main/app/login/page.tsx"
    click OF "https://github.com/jolbol1/supatodo/blob/main/app/login/oauth-signin.tsx"
    click TP "https://github.com/jolbol1/supatodo/blob/main/app/todos/page.tsx"
    click SA "https://github.com/jolbol1/supatodo/blob/main/app/todos/actions.ts"
    click AH "https://github.com/jolbol1/supatodo/tree/main/app/auth"
    click MW "https://github.com/jolbol1/supatodo/blob/main/middleware.ts"
    click SC "https://github.com/jolbol1/supatodo/blob/main/utils/supabase/server.ts"

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Pages]:::page
        L3[Components]:::component
        L4[Server Actions]:::server
        L5[Auth Components]:::auth
        L6[Middleware]:::middleware
        L7[Configuration]:::config
        L8[External Services]:::external
        L9[(Database)]:::database
    end
```
