# tirthmewada/strategy-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/tirthmewada/strategy-frontend
- Repository: https://github.com/tirthmewada/strategy-frontend

## Overview

##### Main System Components

a) Client-Side (Frontend):
- Next.js App Router structure
- UI Components layer
- Authentication flow components
- Dashboard features

b) Server-Side:
- API Routes
- Authentication services
- Middleware handling

**┌─ Client Layer ─────────────────────┐**
- Pages                           │
- Public (/, /login, /signup)  │
- Protected (/dashboard/*)     │

- Components                      │
- UI Components               │
- Feature Components          │
- ┘

**┌─ Middleware Layer ────────────────┐**
- Auth Middleware               │
- Route Protection              │
- ┘

**┌─ Server Layer ──────────────────┐**
- API Routes                   │
- Auth Routes              │

- Services                    │
- Auth Service            │
- ┘

##### Key Relationships to Highlight

- Authentication flow between components
- Protected route access patterns
- API communication paths
- Component hierarchy

##### Implementation Details

Technical aspects:
- Next.js 13+ App Router
- Server-side API routes
- Client-side components
- Authentication services
- UI component library integration

##### Data Flow Patterns

Flows:
**User → Auth Flow → Protected Routes**
**↓**
**API Routes ↔ Auth Service**
**↓**
**Protected Resources**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Pages["Pages"]
        PublicPages["Public Pages"]
        ProtectedPages["Protected Pages"]
        Components["Components"]
        UIComponents["UI Components"]:::ui
        FeatureComponents["Feature Components"]:::feature
        
        Pages --> PublicPages
        Pages --> ProtectedPages
        Components --> UIComponents
        Components --> FeatureComponents
    end

    subgraph Middleware
        AuthMiddleware["Auth Middleware"]:::middleware
        RouteProtection["Route Protection"]:::middleware
    end

    subgraph Server
        APIRoutes["API Routes"]:::api
        AuthRoutes["Auth Routes"]:::auth
        Services["Services"]
        AuthService["Auth Service"]:::auth
        
        APIRoutes --> AuthRoutes
        Services --> AuthService
    end

    %% Relationships
    PublicPages --> AuthMiddleware
    ProtectedPages --> RouteProtection
    AuthMiddleware --> APIRoutes
    RouteProtection --> APIRoutes
    AuthRoutes --> AuthService

    %% Click Events
    click UIComponents "https://github.com/tirthmewada/strategy-frontend/tree/master/src/components/ui"
    click FeatureComponents "https://github.com/tirthmewada/strategy-frontend/tree/master/src/components"
    click AuthMiddleware "https://github.com/tirthmewada/strategy-frontend/blob/master/middleware.js"
    click PublicPages "https://github.com/tirthmewada/strategy-frontend/tree/master/src/app"
    click ProtectedPages "https://github.com/tirthmewada/strategy-frontend/tree/master/src/app/dashboard"
    click AuthRoutes "https://github.com/tirthmewada/strategy-frontend/tree/master/src/app/api/auth"
    click AuthService "https://github.com/tirthmewada/strategy-frontend/blob/master/src/services/authService.js"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef feature fill:#2ecc71,stroke:#27ae60,color:white
    classDef middleware fill:#f1c40f,stroke:#f39c12,color:black
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Feature["Feature Components"]:::feature
        Mid["Middleware"]:::middleware
        API["API Components"]:::api
        Auth["Auth Components"]:::auth
    end
```
