# sun33t/suneet-codes architecture

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

- Interactive diagram: https://gitdiagram.com/sun33t/suneet-codes
- Repository: https://github.com/sun33t/suneet-codes

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js Application (App Router)
- Client-side Components
- Server-side Components
- Static Pages
- Dynamic Routes

b) External Services:
- Cloudinary (Image Management)
- PostHog (Analytics)
- Resend (Email Service)
- Cloudflare Turnstile (Security)

c) Content Management:
- MDX Content Collections
- Static Content

**App Router**
- Pages (Static & Dynamic)
- Components
- UI Components
- Layout Components
- Feature Components
- Content
- MDX Articles
- Static Content

##### Data Flow Indicators

- Content rendering flow
- API calls to external services
- User interaction paths
- Email submission flow
- Analytics tracking

##### Key Elements to Highlight

a) Application Features:
- Dark/Light mode implementation
- Contact form with Turnstile protection
- Article system with MDX
- Analytics integration
- Image optimization with Cloudinary

b) Technical Implementation:
- Environment variable handling (t3-env)
- Type safety
- Server-side vs. Client-side components
- Content collection management

##### Specific Implementation Details

a) Page Routes:
**/**
- /about
- /articles
- /[slug]
- /contact
- /following
- /projects
- /uses

b) Component Architecture:
**components/**
- UI (shadcn/ui)
- Typography
- Layout
- Feature-specific

##### Integration Points

Integration points with external services:
- Cloudinary for image optimization
- PostHog for analytics
- Resend for email handling
- Turnstile for form protection

##### Development Workflow

A small section showing:
- Local development setup
- Environment variable management
- Build and deployment process

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Next.js Application"]
        AppRouter["App Router"]
        click AppRouter "https://github.com/sun33t/suneet-codes/blob/main/app/layout.tsx"
        
        subgraph Pages["Pages"]
            StaticPages["Static Pages"]
            click StaticPages "https://github.com/sun33t/suneet-codes/blob/main/app/about/page.tsx"
            DynamicRoutes["Dynamic Routes"]
            click DynamicRoutes "https://github.com/sun33t/suneet-codes/blob/main/app/articles/[slug]/page.tsx"
        end
        
        subgraph Components["Components"]
            LayoutComp["Layout Components"]
            click LayoutComp "https://github.com/sun33t/suneet-codes/blob/main/components/layout.tsx"
            UIComp["UI Components"]
            click UIComp "https://github.com/sun33t/suneet-codes/tree/main/components/ui/"
            FeatureComp["Feature Components"]
        end
        
        subgraph Content["Content Management"]
            MDX["MDX Articles"]
            click MDX "https://github.com/sun33t/suneet-codes/tree/main/content/articles/"
            Collections["Content Collections"]
            click Collections "https://github.com/sun33t/suneet-codes/blob/main/content-collections.ts"
            StaticContent["Static Content"]
            click StaticContent "https://github.com/sun33t/suneet-codes/blob/main/content/projects.ts"
        end
        
        subgraph Utils["Utilities"]
            EnvVars["Environment Variables"]
            click EnvVars "https://github.com/sun33t/suneet-codes/blob/main/app/env.ts"
            BaseURL["Base URL Config"]
            click BaseURL "https://github.com/sun33t/suneet-codes/blob/main/lib/baseUrl.ts"
            DateFormat["Date Formatting"]
            click DateFormat "https://github.com/sun33t/suneet-codes/blob/main/lib/formatDate.ts"
        end
    end
    
    subgraph External["External Services"]
        Cloudinary[("Cloudinary")]
        click Cloudinary "https://github.com/sun33t/suneet-codes/blob/main/lib/utils/getCloudinaryBlurDataUrl.ts"
        PostHog[("PostHog")]
        click PostHog "https://github.com/sun33t/suneet-codes/blob/main/lib/posthog.ts"
        Resend[("Resend")]
        click Resend "https://github.com/sun33t/suneet-codes/blob/main/lib/resend.ts"
        Turnstile[("Cloudflare Turnstile")]
        click Turnstile "https://github.com/sun33t/suneet-codes/blob/main/lib/turnstile.ts"
    end
    
    subgraph Features["Key Features"]
        ThemeToggle["Theme Toggle"]
        click ThemeToggle "https://github.com/sun33t/suneet-codes/blob/main/components/mode-toggle.tsx"
        ContactForm["Contact Form"]
        click ContactForm "https://github.com/sun33t/suneet-codes/blob/main/components/contact-form.tsx"
        ArticleSystem["Articles System"]
        click ArticleSystem "https://github.com/sun33t/suneet-codes/blob/main/components/articles-list.tsx"
    end
    
    AppRouter --> Pages
    AppRouter --> Components
    AppRouter --> Content
    
    ContactForm --> Turnstile
    ContactForm --> Resend
    ArticleSystem --> MDX
    FeatureComp --> ThemeToggle
    FeatureComp --> ContactForm
    FeatureComp --> ArticleSystem
    
    AppRouter --> PostHog
    AppRouter --> Cloudinary
    
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
    classDef external fill:#c2e0c6,stroke:#333,stroke-width:2px;
    classDef feature fill:#d8e6f3,stroke:#333,stroke-width:2px;
    classDef content fill:#fff5cc,stroke:#333,stroke-width:2px;
    
    class Cloudinary,PostHog,Resend,Turnstile external;
    class ThemeToggle,ContactForm,ArticleSystem feature;
    class MDX,Collections,StaticContent content;
```
