# rizqyn9/rdev-web architecture

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

- Interactive diagram: https://gitdiagram.com/rizqyn9/rdev-web
- Repository: https://github.com/rizqyn9/rdev-web

## Overview

##### Main Application Components

a) Client-Side Layer
- Browser environment where the client-side JavaScript runs
- Entry.client.tsx as the main client entry point
- Routing system (routes directory structure)

b) Server-Side Layer
- Entry.server.tsx as the main server entry point
- Server/index.ts as the production server
- Server/dev-server.js for development environment

##### Key Architectural Components

a) Frontend Components (app/components/)
- UI Components
- Pages Components
- Typography Components
- Hooks

b) Core Services (app/services/)
- Blog Service
- Database Service (db.server.ts)
- Redis Service (redis.server.ts)
- Storage Service
- Email Service (resend.server.ts)

c) Routing Layer (app/routes/)
- Main Routes
- Action Routes
- SEO Routes
- Blog Routes

##### External Services Integration

Connections to external services:
- Cloudinary (utils/cloudinary.server.ts)
- ImageKit (utils/imagekit.server.ts)
- Redis
- Database (likely PostgreSQL/MySQL based on the schema files)

##### Data Flow Representation

- Client-Server communication
- API calls to external services
- Data flow between services
- Server-side rendering flow

##### Specific Implementation Details

Specialized components:
- MDX compilation system (compile-mdx.server.ts)
- SEO handling (seo.ts, root-seo.ts)
- Asset handling (public directory)
- Authentication flow (if present)

##### Deployment Architecture

Deployment flow:
- Docker container (Dockerfile)
- GitHub Actions workflow
- Fly.io deployment (fly.toml)

Drawing Instructions:

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser Environment"]
        ClientEntry["Client Entry"]:::client
        Routes["Routes Layer"]:::client
    end

    subgraph Server
        ServerEntry["Server Entry"]:::server
        ProdServer["Production Server"]:::server
        DevServer["Development Server"]:::server
    end

    subgraph "Frontend Components"
        UI["UI Components"]:::frontend
        Pages["Pages Components"]:::frontend
        Typography["Typography Components"]:::frontend
        Hooks["Hooks"]:::frontend
    end

    subgraph "Core Services"
        BlogService["Blog Service"]:::service
        DBService["Database Service"]:::service
        RedisService["Redis Service"]:::service
        StorageService["Storage Service"]:::service
        EmailService["Email Service"]:::service
    end

    subgraph "External Services"
        Cloudinary["Cloudinary"]:::external
        ImageKit["ImageKit"]:::external
        Redis[(Redis)]:::database
        Database[(Database)]:::database
    end

    subgraph "Content Processing"
        MDX["MDX Compiler"]:::processor
        SEO["SEO Handler"]:::processor
    end

    subgraph "Deployment"
        Docker["Docker"]:::deployment
        GithubActions["GitHub Actions"]:::deployment
        FlyIO["Fly.io"]:::deployment
    end

    Browser --> ClientEntry
    ClientEntry --> Routes
    Routes --> ServerEntry
    ServerEntry --> |Production| ProdServer
    ServerEntry --> |Development| DevServer

    Routes --> UI
    Routes --> Pages
    Pages --> Typography
    Pages --> Hooks

    ServerEntry --> BlogService
    ServerEntry --> DBService
    ServerEntry --> RedisService
    ServerEntry --> StorageService
    ServerEntry --> EmailService

    BlogService --> Database
    RedisService --> Redis
    StorageService --> Cloudinary
    StorageService --> ImageKit

    BlogService --> MDX
    Routes --> SEO

    ProdServer --> Docker
    Docker --> GithubActions
    GithubActions --> FlyIO

    %% Click Events
    click ClientEntry "https://github.com/rizqyn9/rdev-web/blob/main/app/entry.client.tsx"
    click ServerEntry "https://github.com/rizqyn9/rdev-web/blob/main/app/entry.server.tsx"
    click ProdServer "https://github.com/rizqyn9/rdev-web/blob/main/server/index.ts"
    click DevServer "https://github.com/rizqyn9/rdev-web/blob/main/server/dev-server.js"
    click UI "https://github.com/rizqyn9/rdev-web/tree/main/app/components/ui/"
    click Pages "https://github.com/rizqyn9/rdev-web/tree/main/app/components/pages/"
    click Typography "https://github.com/rizqyn9/rdev-web/tree/main/app/components/typography/"
    click Hooks "https://github.com/rizqyn9/rdev-web/tree/main/app/components/hook/"
    click BlogService "https://github.com/rizqyn9/rdev-web/tree/main/app/services/blog/"
    click DBService "https://github.com/rizqyn9/rdev-web/blob/main/app/services/db.server.ts"
    click RedisService "https://github.com/rizqyn9/rdev-web/blob/main/app/services/redis.server.ts"
    click StorageService "https://github.com/rizqyn9/rdev-web/tree/main/app/services/storage/"
    click EmailService "https://github.com/rizqyn9/rdev-web/blob/main/app/services/resend.server.ts"
    click Cloudinary "https://github.com/rizqyn9/rdev-web/blob/main/app/utils/cloudinary.server.ts"
    click ImageKit "https://github.com/rizqyn9/rdev-web/blob/main/app/utils/imagekit.server.ts"
    click Routes "https://github.com/rizqyn9/rdev-web/tree/main/app/routes/"
    click MDX "https://github.com/rizqyn9/rdev-web/blob/main/app/utils/compile-mdx.server.ts"
    click SEO "https://github.com/rizqyn9/rdev-web/blob/main/app/utils/seo.ts"
    click Docker "https://github.com/rizqyn9/rdev-web/tree/main/Dockerfile"
    click GithubActions "https://github.com/rizqyn9/rdev-web/tree/main/.github/workflows/"
    click FlyIO "https://github.com/rizqyn9/rdev-web/blob/main/fly.toml"

    %% Styling
    classDef client fill:#2196F3,color:white
    classDef server fill:#4CAF50,color:white
    classDef frontend fill:#90CAF9,color:black
    classDef service fill:#81C784,color:black
    classDef external fill:#FFD700,color:black
    classDef database fill:#9C27B0,color:white
    classDef processor fill:#FF9800,color:black
    classDef deployment fill:#795548,color:white

    %% Legend
    subgraph Legend
        Client_["Client-side"]:::client
        Server_["Server-side"]:::server
        Frontend_["Frontend"]:::frontend
        Service_["Services"]:::service
        External_["External"]:::external
        Database_["Database"]:::database
        Processor_["Processors"]:::processor
        Deployment_["Deployment"]:::deployment
    end
```
