# hyunsdev/opize-calendar2notion-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/hyunsdev/opize-calendar2notion-frontend
- Repository: https://github.com/hyunsdev/opize-calendar2notion-frontend

## Overview

##### Main Architecture Components

a) Frontend Layer:
- Next.js Client-Side Components
- Page Routes
- Component Library
- Dashboard Interface
- Admin Interface
- Flow Interface

b) API Layer:
- Next.js API Routes
- Authentication Services
- External API Integrations

c) Integration Layer:
- Google Calendar Integration
- Notion Integration
- SyncBot Service

##### Detailed Component Breakdown

a) Frontend Components (Top Layer):
- Dashboard
- Admin Panel
- Flow
- Settings
- GCalIcon
- NotionPage
- PlanCard
- Footer

b) State Management (Middle Layer):
- State management flow with:
- Page States
- User States
- States
- Admin States

c) API Integration (Bottom Layer):
- Client Services:
- Old Client
- New Client
- API Endpoints
- External Services:
- Google Calendar API
- Notion API
- SyncBot Service

##### Connection Flows

- User Authentication Flow
- Calendar Sync Flow
- Notion Integration Flow
- Admin Management Flow

**[User Interface Layer]**
- ↓
**[State Management Layer]**
- ↓
**[API Layer]**
- ↓
**[Integration Layer]**
- ↓
**[External Services]**

##### Additional Elements

Supporting elements:

- Version information
- Data flow indicators
- Security boundaries
- API endpoint groupings

##### Key Features to Highlight

Architectural features:

- Next.js page routing system
- API route structure
- Integration patterns with external services
- Admin management capabilities
- User dashboard flow
- Flow system

Remember to include a clear indication of the data flow between components, especially in the connection and sync processes between Google Calendar and Notion, as this seems to be a central feature of the application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Layer"
        Pages["Page Routes"]
        Dashboard["Dashboard Interface"]
        Admin["Admin Interface"]
        Connect["Connect Flow Interface"]
        
        subgraph "Component Library"
            GCalIcon["GCalIcon"]
            NotionPage["NotionPage"]
            PlanCard["PlanCard"]
            Footer["Footer"]
        end
        
        subgraph "Settings"
            SettingsPages["Settings Pages"]
            AccountSettings["Account Settings"]
            CalendarSettings["Calendar Settings"]
        end
    end
    
    subgraph "State Management Layer"
        ConnectStates["Connect States"]
        AdminStates["Admin States"]
        PageStates["Page States"]
    end
    
    subgraph "API Layer"
        APIRoutes["API Routes"]
        ClientServices["Client Services"]
        OldClientServices["Old Client Services"]
    end
    
    subgraph "Integration Layer"
        SyncBot["SyncBot Service"]
        GCalIntegration["Google Calendar Integration"]
        NotionIntegration["Notion Integration"]
    end
    
    subgraph "User Management"
        UserHooks["User Hooks"]
        UserContainer["User Container"]
        UserAPI["User API Endpoints"]
    end
    
    %% Connections
    Pages --> Dashboard
    Pages --> Admin
    Pages --> Connect
    Dashboard --> SettingsPages
    SettingsPages --> AccountSettings
    SettingsPages --> CalendarSettings
    
    Connect --> ConnectStates
    Admin --> AdminStates
    Pages --> PageStates
    
    ConnectStates --> APIRoutes
    AdminStates --> APIRoutes
    PageStates --> APIRoutes
    
    APIRoutes --> ClientServices
    APIRoutes --> OldClientServices
    
    ClientServices --> GCalIntegration
    ClientServices --> NotionIntegration
    OldClientServices --> SyncBot
    
    UserHooks --> UserContainer
    UserContainer --> UserAPI
    
    %% Styles
    classDef frontend fill:#3498db,color:#fff
    classDef state fill:#9b59b6,color:#fff
    classDef api fill:#2ecc71,color:#fff
    classDef integration fill:#e67e22,color:#fff
    classDef user fill:#95a5a6,color:#fff
    
    class Pages,Dashboard,Admin,Connect,GCalIcon,NotionPage,PlanCard,Footer,SettingsPages,AccountSettings,CalendarSettings frontend
    class ConnectStates,AdminStates,PageStates state
    class APIRoutes,ClientServices,OldClientServices api
    class SyncBot,GCalIntegration,NotionIntegration integration
    class UserHooks,UserContainer,UserAPI user
    
    %% Click Events
    click Pages "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//pages"
    click Dashboard "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/dashboard"
    click Admin "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/admin"
    click Connect "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/connect"
    click GCalIcon "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//components/GCalIcon"
    click NotionPage "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//components/notionPage"
    click PlanCard "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//components/PlanCard"
    click Footer "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//components/footer"
    click APIRoutes "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//pages/api"
    click ClientServices "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//lib/client"
    click OldClientServices "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//lib/old-client"
    click SyncBot "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/admin/syncbot"
    click GCalIntegration "https://github.com/HyunsDev/opize-calendar2notion-frontend/blob/main//lib/old-client/endpoints/user/calendar.ts"
    click NotionIntegration "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//lib/react-notion-cacher"
    click ConnectStates "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/connect/state"
    click AdminStates "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/admin/user/state"
    click PageStates "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/admin/errors/state"
    click UserHooks "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//hooks/useUser"
    click UserContainer "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/admin/user"
    click UserAPI "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//lib/old-client/endpoints/user"
    click SettingsPages "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/dashboard/pages/setting"
    click AccountSettings "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/dashboard/pages/setting/pages/account"
    click CalendarSettings "https://github.com/HyunsDev/opize-calendar2notion-frontend/tree/main//containers/dashboard/pages/setting/pages/calendar"
```
