# azizulabedinazmi/pocket-calendar architecture

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

- Interactive diagram: https://gitdiagram.com/azizulabedinazmi/pocket-calendar
- Repository: https://github.com/azizulabedinazmi/pocket-calendar

## Overview

##### Project type and purpose
- Pocket Calendar is a full-stack, server‐rendered web application built with Next.js 14’s App Router.
- It provides a weekly calendar interface, AI-assisted scheduling, analytics, weather integration, and optional cloud sync for personal and team use.
- Authentication is managed by Clerk; storage is a mix of LocalStorage (client), Vercel Blob or Misskey Drive (cloud).

##### File structure
- Top-level directories:
- app/        → Next.js App Router routes, layouts and server/client components
- app/api/    → serverless API route handlers (blob, chat, weather, share)
- components/ → reusable React UI components (account, analytics, sidebar, views)
- hooks/      → custom React hooks (toast, language, localStorage, mobile)
- lib/        → shared TypeScript utilities (i18n, ICS utils, analytics)
- Configuration files for build and deployment: next.config.mjs, bun.lock, tailwind.config.ts, tsconfig.json, middleware.ts.

##### README for additional insights
- Key features: AI scheduling, drag-and-drop UI, privacy (local first), optional cloud sync, multilingual, analytics, weather, import/export.
- Tech stack: Next.js, Tailwind CSS, shadcn/ui, TypeScript; Clerk auth; storage via LocalStorage, Vercel Blob, Misskey Drive; external APIs (OpenWeather, Groq).
- Deployment targets: Vercel or Netlify (serverless).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Zone
    subgraph "Frontend" 
        direction TB
        CalendarUI["Calendar UI"]:::frontend
        MainCalendar["Main Calendar"]:::frontend
        Sidebar["Sidebar & AI Chat Panel"]:::frontend
        EventDialog["Event Dialog & Preview"]:::frontend
        Analytics["Analytics Dashboard"]:::frontend
        LocalStorageHook["LocalStorage Hook"]:::storage
        ThemeProvider["Theme Provider"]:::frontend
        CalendarContext["Calendar Context"]:::frontend
        ToastHook["Toast Notifications Hook"]:::frontend
        ClerkWidget["Clerk Auth Widget"]:::auth
    end

    %% Backend Zone
    subgraph "Backend (Serverless Functions)" 
        direction TB
        BlobRead["Blob Read API"]:::backend
        BlobList["Blob List API"]:::backend
        BlobVercel["Blob Vercel API"]:::backend
        ShareDefault["Share API"]:::backend
        ShareVercel["Share Vercel API"]:::backend
        ChatAPI["AI Chat API"]:::backend
        ChatSchedule["AI Schedule API"]:::backend
        WeatherAPI["Weather Data API"]:::backend
    end

    %% Cloud Storage
    subgraph "Cloud Storage" 
        direction TB
        VercelBlob["Vercel Blob Storage"]:::storage
        MisskeyDrive["Misskey Drive"]:::storage
    end

    %% External Services
    subgraph "External Services" 
        direction TB
        OpenWeather["OpenWeather API"]:::external
        GroqAPI["Groq API"]:::external
    end

    %% Hosting Layer
    subgraph "Hosting (Vercel/Netlify)" 
        direction TB
        StaticAssets["Static Assets / SSR"]:::frontend
        BackendFunctions["Serverless Functions"]:::backend
    end

    %% Auth Service
    Clerk["Clerk Auth Service"]:::auth

    %% Relationships
    MainCalendar -->|uses| CalendarUI
    MainCalendar -->|uses| Sidebar
    MainCalendar -->|uses| EventDialog
    MainCalendar -->|uses| Analytics
    CalendarUI -->|reads/writes| LocalStorageHook
    MainCalendar -->|calls| BlobRead
    MainCalendar -->|calls| BlobList
    MainCalendar -->|calls| BlobVercel
    CalendarUI -->|calls| ShareDefault
    CalendarUI -->|calls| ShareVercel
    Sidebar -->|calls| ChatAPI
    Sidebar -->|calls| ChatSchedule
    CalendarUI -->|calls| WeatherAPI
    Analytics -->|calls| BlobList
    Analytics -->|calls| BlobRead
    BlobRead -->|stores in| VercelBlob
    BlobRead -->|stores in| MisskeyDrive
    BlobList -->|reads from| VercelBlob
    BlobList -->|reads from| MisskeyDrive
    ShareDefault -->|stores in| VercelBlob
    ShareVercel -->|stores in| VercelBlob
    ChatAPI -->|calls| OpenWeather
    ChatSchedule -->|calls| GroqAPI
    Frontend -->|hosts on| StaticAssets
    BackendFunctions -->|hosts on| VercelNetlify
    Frontend -->|auth flow| Clerk
    ClerkWidget -->|uses| Clerk

    %% Click Events
    click CalendarUI "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/components/view/WeekView.tsx"
    click MainCalendar "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/components/Calendar.tsx"
    click Sidebar "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/components/sidebar/Sidebar.tsx"
    click EventDialog "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/components/event/EventDialog.tsx"
    click Analytics "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/components/analytics/AnalyticsView.tsx"
    click LocalStorageHook "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/hooks/useLocalStorage.ts"
    click BlobRead "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/blob/route.ts"
    click BlobList "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/blob/list/route.ts"
    click BlobVercel "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/blob/vercel/route.ts"
    click ShareDefault "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/share/route.ts"
    click ShareVercel "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/share/vercel/route.ts"
    click ChatAPI "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/chat/route.ts"
    click ChatSchedule "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/chat/schedule/route.ts"
    click WeatherAPI "https://github.com/azizulabedinazmi/pocket-calendar/blob/main/app/api/weather/route.ts"
    click StaticAssets "https://github.com/azizulabedinazmi/pocket-calendar/tree/main/public/"
    click BackendFunctions "https://github.com/azizulabedinazmi/pocket-calendar/tree/main/app/api/"
    
    %% Styles
    classDef frontend fill:#e0f7fa,stroke:#006064,color:#004d40
    classDef backend fill:#e8f5e9,stroke:#2e7d32,color:#1b5e20
    classDef storage fill:#fff8e1,stroke:#f9a825,color:#ff6f00
    classDef external fill:#fff3e0,stroke:#ef6c00,color:#e65100
    classDef auth fill:#f3e5f5,stroke:#8e24aa,color:#4a148c
```
