# gi0210lee/next14-notion-clone architecture

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

- Interactive diagram: https://gitdiagram.com/gi0210lee/next14-notion-clone
- Repository: https://github.com/gi0210lee/next14-notion-clone

## Overview

##### Main System Components

a) Frontend Layer:
- Marketing Pages (/(marketing))
- Authentication Pages (/(auth))
- Main Application (/(main))
- Public Preview (/(public))
- UI Components (/components)

b) Backend Layer:
- API Routes (/api)
- Convex Backend Integration (/convex)
- EdgeStore Integration (for file storage)

c) State & Data Management:
- Hooks (/hooks)
- Providers (/components/providers)

**┌─ Client Layer ─────────────────────┐**
- ┌─────────┐ ┌─────┐ ┌───────────┐ │
- Marketing│ │Auth │ │Main App   │ │
- ┘ └─────┘ └───────────┘ │
- ┘

**┌─ Application Layer ────────────────┐**
- ┌─────────┐ ┌──────┐ ┌─────────┐ │
- Next.js  │ │React │ │TailwindCSS│
- ┘ └──────┘ └─────────┘ │
- ┘

**┌─ Backend Services ────────────────┐**
- ┌────────┐ ┌─────────┐          │
- Convex DB│ │EdgeStore│          │
- ┘ └─────────┘          │
- ┘

##### Key Relationships to Highlight

- Client components → Next.js Router
- API Routes → Backend Services
- Authentication flow between components
- Data flow between documents and storage

##### Component Details

- Purpose
- Key dependencies
- Data flow direction
- Security boundaries

##### Technical Stack Callouts

Technologies:
- Next.js 13+ (App Router)
- Convex for backend
- EdgeStore for file storage
- TailwindCSS for styling
- TypeScript for type safety

##### Architectural Patterns

Patterns:
- Server Components vs Client Components
- Route Groups structure
- Provider pattern for global state
- Hook-based state management

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        Marketing["Marketing Pages"]
        Auth["Authentication Pages"]
        MainApp["Main Application"]
        PublicPreview["Public Preview"]
        UIComponents["UI Components"]
        Navigation["Navigation"]
        Editor["Editor Component"]
        Toolbar["UI Toolbar"]
        ImageDropzone["File Upload"]
        Modals["Modal System"]
    end

    subgraph AppLayer
        direction TB
        NextJS["Next.js App Router"]
        React["React"]
        TailwindCSS["TailwindCSS"]
        Hooks["State Hooks"]
        Providers["Global Providers"]
        ThemeProvider["Theme System"]
        Search["Search"]
    end

    subgraph Backend
        direction TB
        API["API Routes"]
        ConvexBackend["Convex Backend"]
        EdgeStore["EdgeStore"]
        DocStorage["Document Storage"]
    end

    %% Relationships
    Marketing --> NextJS
    Auth --> NextJS
    MainApp --> NextJS
    PublicPreview --> NextJS
    
    NextJS --> API
    API --> ConvexBackend
    API --> EdgeStore
    
    MainApp --> Editor
    Editor --> Toolbar
    Editor --> ImageDropzone
    MainApp --> Navigation
    MainApp --> Search
    
    Providers --> ThemeProvider
    ConvexBackend --> DocStorage

    %% Styling
    classDef frontend fill:#a8d0e6
    classDef backend fill:#95e1d3
    classDef storage fill:#a28089
    classDef service fill:#f8b195
    classDef component fill:#f67280

    class Marketing,Auth,MainApp,PublicPreview,UIComponents,Navigation,Editor,Toolbar,ImageDropzone,Modals frontend
    class API,ConvexBackend backend
    class EdgeStore,DocStorage storage
    class NextJS,React,TailwindCSS service
    class Hooks,Providers,ThemeProvider,Search component

    %% Click Events
    click Marketing "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/(marketing)"
    click Auth "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/(auth)/(routes)"
    click MainApp "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/(main)/(routes)"
    click PublicPreview "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/(public)/(routes)"
    click UIComponents "https://github.com/gi0210lee/next14-notion-clone/tree/main/components/ui"
    click API "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/api"
    click ConvexBackend "https://github.com/gi0210lee/next14-notion-clone/tree/main/convex/"
    click EdgeStore "https://github.com/gi0210lee/next14-notion-clone/tree/main/app/api/edgestore"
    click Hooks "https://github.com/gi0210lee/next14-notion-clone/tree/main/hooks/"
    click Providers "https://github.com/gi0210lee/next14-notion-clone/tree/main/components/providers"
    click Editor "https://github.com/gi0210lee/next14-notion-clone/blob/main/components/editor.tsx"
    click ThemeProvider "https://github.com/gi0210lee/next14-notion-clone/blob/main/components/providers/theme-provider.tsx"
    click Search "https://github.com/gi0210lee/next14-notion-clone/blob/main/hooks/use-search.tsx"
    click Navigation "https://github.com/gi0210lee/next14-notion-clone/blob/main/app/(main)/_components/navigation.tsx"
    click DocStorage "https://github.com/gi0210lee/next14-notion-clone/blob/main/convex/documents.ts"
    click Toolbar "https://github.com/gi0210lee/next14-notion-clone/blob/main/components/toolbar.tsx"
    click Modals "https://github.com/gi0210lee/next14-notion-clone/tree/main/components/modals"
    click ImageDropzone "https://github.com/gi0210lee/next14-notion-clone/blob/main/components/single-image-dropzone.tsx"
```
