# anmol-baranwal/designlyfe architecture

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

- Interactive diagram: https://gitdiagram.com/anmol-baranwal/designlyfe
- Repository: https://github.com/anmol-baranwal/designlyfe

## Overview

##### Main Components

a. Client-Side (Frontend):
- Next.js Application Layer
- Authentication UI Components
- Dashboard Components
- Landing Page Components
- Theme System
- UI Component Library

b. Server-Side:
- Next.js API Routes
- Authentication Services
- Asset Management Services
- User Management Services

c. External Services:
- Firebase Authentication
- Firestore Database
- GitHub Authentication
- Simple Analytics
- Pageclip (Email Subscriptions)

**[Client Layer]**
- ↕
**[Application Layer]**
- ↕
**[Data Layer]**

##### Detailed Component Breakdown

a. Client Layer (Top):
- Landing Page
- Authentication Pages
- Dashboard
- Settings Panel
- Asset Management Interface
- With the theme provider and context providers

b. Application Layer (Middle):
- Next.js API Routes (/api/*)
- Authentication Middleware
- Asset Management Services
- User Management Services

c. Data Layer (Bottom):
- Firebase Services
- Authentication
- Firestore Database (with collections structure)
- External Services Integration

##### Important Relationships to Highlight

- Bidirectional data flow between frontend components and API routes
- Authentication flow:
- User → Auth UI → Firebase Auth → Custom Token Generation
- Demonstrate asset management flow:
- Dashboard → API Routes → Firestore Collections
- Data synchronization patterns

##### Technical Details

- TypeScript integration
- Tailwind CSS styling system
- Firebase Configuration
- Next.js routing system
- API route handlers

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        LP["Landing Page"]:::frontend
        click LP "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/landing-page.tsx"
        NAV["Navigation"]:::frontend
        click NAV "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/navbar/Navbar.tsx"
        FEAT["Features"]:::frontend
        click FEAT "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/how-it-works.tsx"
        SUB["Subscribe"]:::frontend
        click SUB "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/subscribe.tsx"
        
        subgraph Dashboard
            DASH["Dashboard Main"]:::frontend
            click DASH "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/main/dashboard-main-page.tsx"
            SIDE["Sidebar"]:::frontend
            click SIDE "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/main/sidebar.tsx"
            UNAV["User Navigation"]:::frontend
            click UNAV "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/main/user-nav.tsx"
            ASSET["Asset Display"]:::frontend
            click ASSET "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/main/asset-artwork.tsx"
        end
        
        subgraph Theme
            TP["Theme Provider"]:::theme
            click TP "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/theme-provider.tsx"
            TT["Theme Toggle"]:::theme
            click TT "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/toggle-theme.tsx"
            TS["Theme Settings"]:::theme
            click TS "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/profile/appearance/appearance-form.tsx"
        end
        
        subgraph Auth_UI
            UAF["User Auth Form"]:::auth
            click UAF "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/authentication/user-auth-form.tsx"
            PF["Profile Form"]:::frontend
            click PF "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/components/ui/dashboard/profile/main/profile-form.tsx"
        end
    end
    
    subgraph Application
        subgraph API_Routes
            AA["Asset APIs"]:::api
            click AA "https://github.com/Anmol-Baranwal/designlyfe/tree/main/src/pages/api"
            UA["User APIs"]:::api
            click UA "https://github.com/Anmol-Baranwal/designlyfe/tree/main/src/pages/api"
            
            subgraph Asset_APIs
                CA["Create Assets"]:::api
                click CA "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/createAssets.ts"
                GAD["Get Asset Data"]:::api
                click GAD "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/getAssetData.ts"
                AUB["Add to Bookmarks"]:::api
                click AUB "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/addAssetToUserBookmarks.ts"
                GMA["Get Most Upvoted"]:::api
                click GMA "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/getMostUpvotedAssets.ts"
            end
            
            subgraph User_APIs
                CU["Create User"]:::api
                click CU "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/createUser.ts"
                GUD["Get User Details"]:::api
                click GUD "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/getUserDetails.ts"
                UUD["Update User Details"]:::api
                click UUD "https://github.com/Anmol-Baranwal/designlyfe/blob/main/src/pages/api/updateUserDetails.ts"
            end
        end
        
        subgraph Auth_Services
            AM["Auth Middleware"]:::auth
            click AM "https://github.com/Anmol-Baranwal/designlyfe/blob/main/lib/firebase/middleware/auth.ts"
            AC["Auth Context"]:::auth
            click AC "https://github.com/Anmol-Baranwal/designlyfe/blob/main/lib/firebase/context/AuthContext.tsx"
            GHA["GitHub Auth"]:::auth
            click GHA "https://github.com/Anmol-Baranwal/designlyfe/blob/main/lib/GitHubAuth.ts"
            EPA["Email Password Auth"]:::auth
            click EPA "https://github.com/Anmol-Baranwal/designlyfe/blob/main/lib/emailPasswordAuth.ts"
            CT["Custom Token Gen"]:::auth
            click CT "https://github.com/Anmol-Baranwal/designlyfe/blob/main/lib/firebase/middleware/generateCustomToken.ts"
        end
    end
    
    subgraph Data
        subgraph Firebase
            FA["Firebase Auth"]:::firebase
            click FA "https://github.com/Anmol-Baranwal/designlyfe/blob/main/firebaseConfig.js"
            FS["Firestore"]:::firebase
            click FS "https://github.com/Anmol-Baranwal/designlyfe/blob/main/firestore.rules"
        end
        
        subgraph External
            GH["GitHub"]:::external
            SA["Simple Analytics"]:::external
            PC["Pageclip"]:::external
        end
    end
    
    %% Relationships
    LP --> NAV
    DASH --> SIDE
    DASH --> UNAV
    DASH --> ASSET
    
    UAF --> AM
    AM --> FA
    AM --> AC
    GHA --> FA
    EPA --> FA
    
    AA --> FS
    UA --> FS
    
    FA --> GH
    
    %% Styling
    classDef frontend fill:#3498db
    classDef auth fill:#2ecc71
    classDef api fill:#e74c3c
    classDef firebase fill:#f39c12
    classDef external fill:#9b59b6
    classDef theme fill:#34495e
```
