# likemycoffe/todo-list-ap architecture

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

- Interactive diagram: https://gitdiagram.com/likemycoffe/todo-list-ap
- Repository: https://github.com/likemycoffe/todo-list-ap

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (App Router)
- It provides UI pages for login, authentication callbacks, and a main “todo” page
- It uses Supabase as a backend-as-a-service (authentication + PostgreSQL database)
- Styling via Tailwind CSS and optimized fonts via next/font

##### File structure
- Top-level:
– app/ – Next.js “app router” directory with server and client routes, layouts, global CSS
– components/ – reusable UI components (Auth, MobileNav, Toast)
– lib/ – helper for Supabase client initialization (lib/supabase.js)
– middleware.ts – Next.js edge middleware (likely to protect routes or inject headers)
– next.config.mjs, postcss.config.mjs, tailwind.config.ts – build & styling configs
– public/ – static assets (fonts, images)
- Inside app/:
– layout.tsx & client-layout.tsx – shared and client-only layouts
– page.tsx – entry “/” page
– login/page.tsx – sign-in page
– auth/callback/route.ts – serverless API route to handle OAuth callback from Supabase

##### README for additional insights
- Confirms create-next-app bootstrap, development commands, font optimization
- Mentions deployment on Vercel (serverless environment)

a. Main components
1. Next.js Frontend (React components + pages in app/)
2. Next.js Server-Side (server components & API routes like auth/callback)
3. Middleware (edge functions for route protection)
4. Supabase Services (Auth, Database)
5. Vercel Platform (hosting, serverless execution)
6. Static Assets (public/)
b. Relationships & interactions
– Browser ↔ Next.js Frontend: user requests pages, client-side routing, hydration
– Next.js Frontend ↔ Server-Side: server components render on request, fetch data
– Next.js Server-Side ↔ Supabase Auth API (via lib/supabase.js) for signup/login, OAuth callback
– Next.js Server-Side ↔ Supabase Database (PostgreSQL) for CRUD on todos
– Middleware intercepts incoming requests to protect routes or redirect unauthenticated users
c. Architectural patterns & design principles
– App Router with nested layouts and server vs client components
– BaaS model (Supabase) to avoid managing own backend servers
– Edge middleware for security at the CDN layer
d. Relevant technologies/frameworks
– Next.js 13 App Router (React 18, SSR/SSG/ISR)
– Supabase JS client
– Tailwind CSS for utility-first styling
– Vercel serverless functions & hosting

##### Detailed capture of essential architectural elements
- Auth flow: login page → Supabase OAuth → auth callback route → set session
- Data fetching methods (fetch from lib/supabase.js inside server components)
- Middleware paths (which routes are protected)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    subgraph "Client (Browser)"
        direction TB
        Browser["User's Browser"]:::frontend
    end

    %% CDN / Hosting
    Browser -->|"HTTP Request"| CDN["Vercel CDN"]:::platform

    %% Static Assets
    subgraph "Static Assets (CDN)"
        direction TB
        Public["public/"]:::static
        Fonts["public/fonts/"]:::static
    end
    CDN -->|"Serve Assets"| Public
    CDN -->|"Serve Fonts"| Fonts

    %% Next.js Frontend (Client Components & Pages)
    subgraph "Next.js Frontend" 
        direction TB
        CL["Client Layout"]:::frontend
        LoginPage["Login Page"]:::frontend
        HomePage["Home (Todo) Page"]:::frontend
        AuthComponent["Auth Component"]:::frontend
        MobileNav["MobileNav Component"]:::frontend
        ToastComp["Toast Component"]:::frontend
    end
    CDN -->|"Serve JS/CSS"| Browser
    Browser -->|"Client-side Navigation"| CL
    CL --> LoginPage
    CL --> HomePage
    CL --> AuthComponent
    CL --> MobileNav
    CL --> ToastComp

    %% Next.js Server (Edge Middleware & Server Components)
    CDN -->|"Route Request"| Middleware["middleware.ts"]:::server
    subgraph "Next.js Server" 
        direction TB
        Middleware --> Layout
        Layout["Server Layout"]:::server
        GlobalsCSS["Global Styles"]:::server
        AuthCallback["Auth Callback Route"]:::server
        SupabaseLib["lib/supabase.js"]:::server
    end
    Layout --> GlobalsCSS
    Layout --> AuthCallback
    AuthCallback --> SupabaseAuth
    Layout --> SupabaseDB

    %% Supabase Services
    subgraph "Supabase Services"
        direction TB
        SupabaseAuth["Supabase Auth API"]:::external
        SupabaseDB["Supabase PostgreSQL"]:::external
    end

    %% Config & Metadata
    subgraph "Project Config & Metadata"
        direction TB
        Tailwind["tailwind.config.ts"]:::config
        PostCSS["postcss.config.mjs"]:::config
        NextConfig["next.config.mjs"]:::config
        README["README.md"]:::config
        Package["package.json"]:::config
        TSConfig["tsconfig.json"]:::config
    end

    %% Click Events
    click CL "https://github.com/likemycoffe/todo-list-ap/blob/main/app/client-layout.tsx"
    click LoginPage "https://github.com/likemycoffe/todo-list-ap/blob/main/app/login/page.tsx"
    click HomePage "https://github.com/likemycoffe/todo-list-ap/blob/main/app/page.tsx"
    click AuthComponent "https://github.com/likemycoffe/todo-list-ap/blob/main/components/Auth.tsx"
    click MobileNav "https://github.com/likemycoffe/todo-list-ap/blob/main/components/MobileNav.tsx"
    click ToastComp "https://github.com/likemycoffe/todo-list-ap/blob/main/components/Toast.tsx"
    click Layout "https://github.com/likemycoffe/todo-list-ap/blob/main/app/layout.tsx"
    click AuthCallback "https://github.com/likemycoffe/todo-list-ap/blob/main/app/auth/callback/route.ts"
    click GlobalsCSS "https://github.com/likemycoffe/todo-list-ap/blob/main/app/globals.css"
    click Middleware "https://github.com/likemycoffe/todo-list-ap/blob/main/middleware.ts"
    click SupabaseLib "https://github.com/likemycoffe/todo-list-ap/blob/main/lib/supabase.js"
    click Public "https://github.com/likemycoffe/todo-list-ap/tree/main/public/"
    click Fonts "https://github.com/likemycoffe/todo-list-ap/tree/main/public/fonts/"
    click Tailwind "https://github.com/likemycoffe/todo-list-ap/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/likemycoffe/todo-list-ap/blob/main/postcss.config.mjs"
    click NextConfig "https://github.com/likemycoffe/todo-list-ap/blob/main/next.config.mjs"
    click README "https://github.com/likemycoffe/todo-list-ap/blob/main/README.md"
    click Package "https://github.com/likemycoffe/todo-list-ap/blob/main/package.json"
    click TSConfig "https://github.com/likemycoffe/todo-list-ap/blob/main/tsconfig.json"

    %% Styles
    classDef frontend fill:#c3ddfd,stroke:#0366d6,color:#0366d6
    classDef server fill:#d1f4dd,stroke:#059669,color:#065f46
    classDef external fill:#ffe5b4,stroke:#f97316,color:#c2410c
    classDef platform fill:#e0e7ff,stroke:#4338ca,color:#3730a3
    classDef static fill:#faf5ff,stroke:#8b5cf6,color:#6d28d9
    classDef config fill:#f3f4f6,stroke:#6b7280,color:#374151
```
