# arjuncodess/portify architecture

> Architecture diagram of the GitHub repository arjuncodess/portify, 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/arjuncodess/portify
- Repository: https://github.com/arjuncodess/portify

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js App Router Architecture (app directory structure)
- Client Components (components directory)
- Server Components (app directory)
- Authentication Layer (app/(auth) directory)

b) Backend Layer:
- API Routes (app/api directory)
- Database Layer (db directory with Drizzle ORM)
- External Services:
- Cloudinary (for media storage, as indicated by lib/cloudinary.ts)
- Authentication Service (implied by auth directory structure)

##### Architectural Patterns to Highlight

a) Next.js App Router Pattern:
- Route grouping ((auth), (root))
- Demonstrate dynamic routes ([username])
- API routes structure

b) Feature-based Organization:
- Portfolio features
- Admin dashboard
- User management
- Analytics system

##### Component Relationships

a) Data Flow:
- Client-Server interactions
- API endpoint connections
- Database operations
- External service communications

b) State Management:
- Theme provider connections
- User data flow
- Project management flow

##### Specific Implementation Details

Create sections for:

a) UI Layer:
- Components hierarchy
- Shared UI components
- Feature-specific components

b) Data Layer:
- Database schema
- API routes
- Data actions

##### Key Sections

a) Public Facing:
- Landing page
- Portfolio views
- Sign-in/Sign-up flows

b) Administrative:
- Admin dashboard
- Analytics
- Project management

c) Infrastructure:
- Database schema
- API architecture
- External service integration

##### Implementation Notes

Annotations for:
- Authentication flow
- Project creation/management flow
- Analytics tracking
- Theme/Template management
- Media handling with Cloudinary

Remember to highlight the modern Next.js features being used, such as:
- Server Components
- App Router
- API Routes
- Dynamic Routes
- Middleware functionality

This will create a complete picture of the system while maintaining clarity and usefulness for development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Layer"
        direction TB
        NC[Next.js Client Components]
        NSC[Next.js Server Components]
        
        subgraph "Authentication"
            direction TB
            Auth[Authentication Layer]:::auth
            SignIn[Sign In]
            SignUp[Sign Up]
        end

        subgraph "Features"
            direction TB
            PF[Portfolio Features]:::portfolio
            AD[Admin Dashboard]:::admin
            PC[Project Creation]:::create
            PM[Project Management]:::projects
            AS[Analytics System]:::analytics
            PR["Public Routes ([username])"]:::public
        end

        subgraph "UI Components"
            direction TB
            SUI[Shared UI Components]:::ui
            TP[Theme Provider]:::theme
            TO[Theme Options]:::theme
            TempO[Template Options]:::template
        end
    end

    subgraph "Backend Layer"
        direction TB
        API[API Routes]:::api
        
        subgraph "Data Management"
            direction TB
            DB[(Database)]:::db
            DA[Data Actions]:::actions
            UM[User Management]:::user
        end

        subgraph "Analytics"
            direction TB
            AA[Analytics API]:::analytics
            PA[Project Analytics]:::analytics
        end
    end

    subgraph "External Services"
        direction TB
        Cloud[Cloudinary]:::external
        AuthService[Auth Service]:::external
    end

    %% Connections
    Auth --> API
    Auth --> AuthService
    PF --> API
    AD --> API
    PM --> API
    AS --> AA
    PR --> API
    PC --> API
    API --> DB
    API --> Cloud
    PA --> DB
    AA --> DB
    DA --> DB
    UM --> DB

    %% Styles
    classDef auth fill:#f9f,stroke:#333
    classDef api fill:#9f9,stroke:#333
    classDef db fill:#ff9,stroke:#333
    classDef external fill:#99f,stroke:#333
    classDef portfolio fill:#f99,stroke:#333
    classDef admin fill:#9ff,stroke:#333
    classDef projects fill:#f9f,stroke:#333
    classDef analytics fill:#ff9,stroke:#333
    classDef ui fill:#9f9,stroke:#333
    classDef theme fill:#99f,stroke:#333
    classDef template fill:#f99,stroke:#333
    classDef actions fill:#9ff,stroke:#333
    classDef user fill:#f9f,stroke:#333
    classDef public fill:#ff9,stroke:#333
    classDef create fill:#99f,stroke:#333

    %% Click Events
    click Auth "https://github.com/arjuncodess/portify/tree/main/app/(auth)"
    click API "https://github.com/arjuncodess/portify/tree/main/app/api"
    click DB "https://github.com/arjuncodess/portify/blob/main/db/schema.ts"
    click AD "https://github.com/arjuncodess/portify/tree/main/app/(root)/admin"
    click AS "https://github.com/arjuncodess/portify/tree/main/app/(root)/admin/analytics"
    click PF "https://github.com/arjuncodess/portify/tree/main/components/portfolio"
    click PM "https://github.com/arjuncodess/portify/tree/main/components/projects"
    click SUI "https://github.com/arjuncodess/portify/tree/main/components/ui"
    click TP "https://github.com/arjuncodess/portify/blob/main/components/theme-provider.tsx"
    click TO "https://github.com/arjuncodess/portify/blob/main/components/theme-options.tsx"
    click TempO "https://github.com/arjuncodess/portify/blob/main/components/template-options.tsx"
    click Cloud "https://github.com/arjuncodess/portify/blob/main/lib/cloudinary.ts"
    click DA "https://github.com/arjuncodess/portify/blob/main/actions/user.ts"
    click PR "https://github.com/arjuncodess/portify/tree/main/app/(root)/[username]"
    click PC "https://github.com/arjuncodess/portify/tree/main/app/(root)/create"
    click AA "https://github.com/arjuncodess/portify/blob/main/app/api/analytics/route.ts"
    click UM "https://github.com/arjuncodess/portify/tree/main/app/api/user"
    click PA "https://github.com/arjuncodess/portify/blob/main/app/api/projects/click/route.ts"
```
