# vnt87/capufeed architecture

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

- Interactive diagram: https://gitdiagram.com/vnt87/capufeed
- Repository: https://github.com/vnt87/capufeed

## Overview

##### Component Relationships

- Frontend → API (REST calls)
- API → Database (data persistence)
- State Management → Components (data flow)
- Context Providers → Components (theme/settings)

##### Key Technical Elements to Highlight

- Build/Dev Tools: Vite, TypeScript, Tailwind CSS
- UI Component Library: shadcn-ui components
- State Management: Custom hooks
- Internationalization: i18n setup (en/vi)

##### Specific Implementation Details

Annotations for:
- Environment configurations (.env.development)
- Build/Deploy configurations (wrangler.toml, vite.config.ts)
- API routes and endpoints
- Component hierarchy

**[Client Browser]**
- ↓
**[Cloudflare Pages (Hosting)]**
- ↓
**[Frontend Layer]**
- React Components
- UI Library (shadcn)
- State Management
- i18n
- ↓
**[Cloudflare Workers API]**
- Feed Management
- API Routes
- ↓
**[Database Layer]**
- SQL Database

Important Considerations:

- Component hierarchy
- State management flow
- API endpoint structure

##### Architectural decisions
- Use of Cloudflare Workers for API
- Component-based UI architecture
- State management approach
- Internationalization implementation

## Diagram (Mermaid)

```mermaid
graph LR
    subgraph Client
        Browser[Browser]
    end

    subgraph CloudflarePages["Cloudflare Pages"]
        PagesConfig["Pages Config"]:::config
    end

    subgraph FrontendLayer["Frontend"]
        React["React + TS"]:::frontend
        UIComponents["UI Components"]:::frontend
        Pages["Pages"]:::frontend
        StateManagement["State"]:::frontend
        ThemeContext["Theme"]:::frontend
        I18n["i18n"]:::frontend
        UILib["shadcn"]:::frontend
    end

    subgraph APILayer["API"]
        WorkerConfig["Config"]:::api
        FeedsAPI["Feeds API"]:::api
        DBUtils["DB Utils"]:::api
    end

    subgraph Infrastructure["Infrastructure"]
        Database[(SQL DB)]:::db
        Schema["Schema"]:::db
    end

    Browser --> CloudflarePages
    CloudflarePages --> FrontendLayer
    React --> UIComponents & Pages & StateManagement & ThemeContext & I18n & UILib
    FrontendLayer --> APILayer
    APILayer --> Infrastructure
    FeedsAPI --> Database
    Schema --> Database
    DBUtils --> Database

    %% Click Events
    click UIComponents "https://github.com/vnt87/capufeed/tree/main/src/components"
    click Pages "https://github.com/vnt87/capufeed/tree/main/src/pages"
    click StateManagement "https://github.com/vnt87/capufeed/blob/main/src/hooks/use-feed-store.ts"
    click ThemeContext "https://github.com/vnt87/capufeed/blob/main/src/contexts/ThemeContext.tsx"
    click I18n "https://github.com/vnt87/capufeed/tree/main/src/i18n"
    click FeedsAPI "https://github.com/vnt87/capufeed/tree/main/functions/api/feeds"
    click Schema "https://github.com/vnt87/capufeed/blob/main/functions/api/feeds/schema.sql"
    click WorkerConfig "https://github.com/vnt87/capufeed/blob/main/functions/_worker.ts"
    click PagesConfig "https://github.com/vnt87/capufeed/blob/main/.cloudflare/pages.toml"
    click UILib "https://github.com/vnt87/capufeed/tree/main/src/components/ui"
    click DBUtils "https://github.com/vnt87/capufeed/blob/main/src/lib/db.ts"

    %% Styling
    classDef frontend fill:#2563eb,color:white
    classDef api fill:#22c55e,color:white
    classDef db fill:#eab308,color:white
    classDef config fill:#6b7280,color:white
```
