# rootnick/root-podcasts architecture

> Architecture diagram of the GitHub repository rootnick/root-podcasts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rootnick/root-podcasts
- Repository: https://github.com/rootnick/root-podcasts

## Overview

##### Main Components

Frontend Layer (Next.js):
- Client-side Components
- Pages (Home, Statistics)
- Shared Components (Card, Header, Search, Select)
- API Routes (/api/podcasts)
- Server-side Components
- Authentication Provider
- Middleware
- Context Management

Backend Layer (Hono.js):
- Database Layer (SQLite)
- API Endpoints
- Database Connector
- Database Methods

**[Client Layer] → [Server Layer] → [Data Layer]**

##### Detailed Component Breakdown

Frontend (Blue Section):
**[Next.js Application]**
- Pages
- Home (/)
- Statistics (/statistics)
- Components
- Header
- Search
- CardsBlock
- Select
- API Routes
- /api/podcasts
- Context
- AuthProvider

Backend (Green Section):
**[Hono.js Server]**
- Database Connector
- Database Methods
- API Endpoints

Data Layer (Yellow Section):
**[SQLite Database]**
- pod.db

##### Key Interactions to Highlight

- Client-Server Communication:
- Authentication flow
- Podcast data flow

- Database Interactions:
- CRUD operations
- Data persistence flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        HomePage["Home Page"]
        StatsPage["Statistics Page"]
        
        subgraph Components
            direction TB
            Card["Card Component"]
            Header["Header Component"]
            Search["Search Component"]
            Select["Select Component"]
        end
        
        subgraph Context
            Auth["Auth Provider"]
        end
        
        subgraph "Frontend API Routes"
            direction TB
            PodcastAPI["Podcast API"]
            FavoritesAPI["Favorites API"]
            FiltersAPI["Filters API"]
        end
        
        TypeDefs["Type Definitions"]
    end
    
    subgraph Backend
        direction TB
        EntryPoint["Backend Entry Point"]
        
        subgraph "Database Layer"
            direction TB
            DBConnector["Database Connector"]
            DBMethods["Database Methods"]
            SQLite[(SQLite DB)]
        end
    end
    
    %% Relationships
    HomePage --> Components
    StatsPage --> Components
    Components --> Context
    Components --> PodcastAPI
    Components --> FavoritesAPI
    Components --> FiltersAPI
    
    PodcastAPI --> EntryPoint
    FavoritesAPI --> EntryPoint
    FiltersAPI --> EntryPoint
    
    EntryPoint --> DBConnector
    DBConnector --> DBMethods
    DBMethods --> SQLite
    
    %% Click Events
    click HomePage "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/page.tsx"
    click StatsPage "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/statictics/page.tsx"
    click Card "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/shared/Card/Card.tsx"
    click Header "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/components/Header/Header.tsx"
    click Search "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/components/Search/Search.tsx"
    click Select "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/components/Select/Select.tsx"
    click Auth "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/context/AuthProvider.tsx"
    click PodcastAPI "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/api/podcasts/route.ts"
    click FavoritesAPI "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/api/podcasts/favorite/route.ts"
    click FiltersAPI "https://github.com/rootnick/root-podcasts/blob/master/frontend/src/app/api/podcasts/filters/route.ts"
    click SQLite "https://github.com/rootnick/root-podcasts/blob/master/backend/pod.db"
    click DBConnector "https://github.com/rootnick/root-podcasts/blob/master/backend/src/database/connector.ts"
    click DBMethods "https://github.com/rootnick/root-podcasts/blob/master/backend/src/database/methods.ts"
    click EntryPoint "https://github.com/rootnick/root-podcasts/blob/master/backend/src/index.ts"
    click TypeDefs "https://github.com/rootnick/root-podcasts/tree/master/frontend/src/types"
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    
    class HomePage,StatsPage,Components,Card,Header,Search,Select,Context,Auth,TypeDefs frontend
    class EntryPoint,DBConnector,DBMethods backend
    class SQLite database
    class PodcastAPI,FavoritesAPI,FiltersAPI api
```
