# alexbaron-me/ical-filter architecture

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

- Interactive diagram: https://gitdiagram.com/alexbaron-me/ical-filter
- Repository: https://github.com/alexbaron-me/ical-filter

## Overview

##### Main Components Identification

a) Frontend Layer:
- React/Remix application (indicated by the app/routes structure)
- UI Components (located in app/components)
- Client-side hooks (in app/hooks)

b) Backend Layer:
- Authentication service (auth.server.ts)
- Session management (session.server.ts)
- iCal processing service (app/ical directory)
- API endpoints (routes/api.*)

c) Database Layer:
- SQL database (indicated by drizzle migrations)
- Database schema (app/db/schema.ts)

**External Services:**
- Original iCal Feed (e.g., RWTHOnline)

**Frontend Layer:**
- Web UI (React/Remix)
- Component Library
- Client-side State Management

**Backend Layer:**
- Authentication Service
- Session Manager
- iCal Processing Service
- Fetcher
- Filter
- API Gateway

**Database Layer:**
- SQL Database
- User Tables
- Calendar Tables
- Filter Rules Tables

##### User Authentication Flow
- User → Frontend → Auth Service → Database

##### Calendar Processing Flow
- External iCal → Backend Fetcher → Filter Service → API Endpoint → User's Calendar App

##### Filter Management Flow
- User → Frontend → Backend → Database

##### Important Details

a) Authentication Layer:
- Session management flow
- Secure endpoints (/_auth routes)

b) iCal Processing:
- Transformation pipeline from original feed to filtered feed
- Caching mechanism if implemented

c) API Endpoints:
- Public API endpoints (api.ical.$calendarId.ts)
- Relationship between filtered calendars and their public URLs

##### Technical Stack Indicators

- Remix.js
- React
- TypeScript
- SQL Database
- Tailwind CSS

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        ICAL[External iCal Feed]:::external
    end

    subgraph Frontend
        WUI[Web UI]:::frontend
        COMP[Component Library]:::frontend
        CSM[Client State Management]:::frontend
        
        subgraph Components
            CAL[Calendar Component]:::frontend
            FIL[Filter Component]:::frontend
            UI[Common UI Elements]:::frontend
        end
        
        subgraph Routes
            AUTH_ROUTES[Auth Protected Routes]:::frontend
            CAL_MGMT[Calendar Management]:::frontend
            LOGIN[Login Page]:::frontend
            SIGNUP[Signup Page]:::frontend
        end
    end

    subgraph Backend
        AUTH[Authentication Service]:::backend
        SESS[Session Manager]:::backend
        
        subgraph "iCal Processing"
            FETCH[Fetcher]:::backend
            FILTER[Filter]:::backend
        end
        
        subgraph "API Gateway"
            CAL_API[Calendar API]:::backend
            FAV_API[Favicon API]:::backend
        end
    end

    subgraph Database
        DB[(SQL Database)]:::database
        SCHEMA[Schema]:::database
    end

    %% Relationships
    ICAL --> FETCH
    FETCH --> FILTER
    FILTER --> CAL_API
    
    WUI --> AUTH
    AUTH --> SESS
    SESS --> DB
    
    CAL_API --> DB
    FAV_API --> DB
    
    Components --> WUI
    Routes --> WUI
    
    %% Click Events
    click CAL "https://github.com/alexbaron-me/ical-filter/blob/main/app/components/Calendar.tsx"
    click FIL "https://github.com/alexbaron-me/ical-filter/blob/main/app/components/Filter.tsx"
    click UI "https://github.com/alexbaron-me/ical-filter/blob/main/app/components/Button.tsx"
    click AUTH "https://github.com/alexbaron-me/ical-filter/blob/main/app/auth.server.ts"
    click SESS "https://github.com/alexbaron-me/ical-filter/blob/main/app/session.server.ts"
    click FETCH "https://github.com/alexbaron-me/ical-filter/blob/main/app/ical/fetcher.ts"
    click FILTER "https://github.com/alexbaron-me/ical-filter/blob/main/app/ical/filter.ts"
    click CAL_API "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/api.ical.$calendarId.ts"
    click FAV_API "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/api.favicon.ts"
    click SCHEMA "https://github.com/alexbaron-me/ical-filter/blob/main/app/db/schema.ts"
    click AUTH_ROUTES "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/_auth.tsx"
    click CAL_MGMT "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/_auth.calendars.$calendarId.tsx"
    click LOGIN "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/login.tsx"
    click SIGNUP "https://github.com/alexbaron-me/ical-filter/blob/main/app/routes/signup.tsx"
    
    %% Styling
    classDef frontend fill:#3b82f6,color:white
    classDef backend fill:#22c55e,color:white
    classDef database fill:#eab308,color:black
    classDef external fill:#6b7280,color:white

    %% Legend
    subgraph Legend
        F[Frontend]:::frontend
        B[Backend]:::backend
        D[Database]:::database
        E[External]:::external
    end
```
