# ajayteotia/storit architecture

> Architecture diagram of the GitHub repository ajayteotia/storit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ajayteotia/storit
- Repository: https://github.com/ajayteotia/storit

## Overview

##### Main System Components

A. Client Layer
- Next.js Frontend (src/app directory)
- UI Components (src/components)
- Client-side Hooks (src/hooks)

B. Server Layer
- Next.js Server Components
- Server Actions (src/lib/actions)

C. External Services Layer
- Appwrite Services
- Authentication
- Storage
- Database

##### Component Relationships

a) Frontend Architecture:
**(Root Layout) → (Auth Layout) → (Sign In/Sign Up Pages)**
- ↘ (Root Layout) → (Type-specific Pages)

b) Component Interactions:
**UI Components ↔ Server Actions ↔ Appwrite Services**

##### Specific Implementation Details

A. Authentication Flow:
- AuthForm component → User Actions → Appwrite Auth
- OTP verification system
- Protected routes structure

B. File Management System:
- File upload flow
- File actions (rename, delete, share)
- Storage management
- Search and sort functionality

##### Technical Stack Representation

Specific technology badges:
- Next.js 15
- React 19
- TypeScript
- Tailwind CSS
- Appwrite SDK
- ShadCN UI

##### Data Flow Visualization

Following flows:
**User → Authentication → File Operations → Storage**
**↑                                       ↓**
- Data Retrieval ────────────┘

##### Key Integration Points

Highlight:
- Appwrite configuration (src/lib/appwrite)
- Server actions integration
- File handling utilities
- State management

##### Architectural Patterns

Emphasize:
- Route groups ((auth) and (root))
- Component composition
- Server/Client component separation
- API integration patterns

##### External service integration

- User authentication
- File uploads and management
- Storage tracking
- Search and sort functionality
- File sharing capabilities
- Dashboard analytics

This will provide a complete picture of the system's architecture while maintaining clarity and readability.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        direction TB
        Frontend["Frontend (Next.js)"]
        UIComponents["UI Components"]
        ClientHooks["Client Hooks"]
        
        subgraph Auth["Authentication Components"]
            direction TB
            AuthForm["Auth Form"]:::component
            OTPModal["OTP Modal"]:::component
        end
        
        subgraph FileManagement["File Management"]
            direction TB
            FileUploader["File Uploader"]:::component
            ActionDropdown["Action Dropdown"]:::component
            ActionModal["Action Modal"]:::component
        end
        
        subgraph Navigation["Navigation"]
            direction TB
            Header["Header"]:::component
            Sidebar["Sidebar"]:::component
            MobileNav["Mobile Navigation"]:::component
        end
        
        subgraph Display["Display Components"]
            direction TB
            Search["Search"]:::component
            Sort["Sort"]:::component
            Card["Card"]:::component
            Thumbnail["Thumbnail"]:::component
            Chart["Chart"]:::component
        end
    end

    subgraph Server
        direction TB
        ServerComponents["Server Components"]
        
        subgraph Actions["Server Actions"]
            direction TB
            UserActions["User Actions"]:::component
            FileActions["File Actions"]:::component
        end
        
        subgraph AppwriteConfig["Appwrite Integration"]
            direction TB
            Config["Configuration"]:::component
            AppwriteSDK["Appwrite SDK"]:::component
        end
    end

    subgraph AppwriteServices["Appwrite Services"]
        direction TB
        Auth_Service["Authentication"]
        Storage_Service["Storage"]
        Database_Service["Database"]
    end

    %% Connections
    Frontend --> Auth
    Frontend --> FileManagement
    Frontend --> Navigation
    Frontend --> Display
    Frontend --> ClientHooks
    
    Auth --> UserActions
    FileManagement --> FileActions
    
    UserActions --> AppwriteConfig
    FileActions --> AppwriteConfig
    
    AppwriteConfig --> Auth_Service
    AppwriteConfig --> Storage_Service
    AppwriteConfig --> Database_Service

    %% Click Events
    click AuthForm "https://github.com/AjayTeotia/StorIt/blob/main/src/components/AuthForm.tsx"
    click OTPModal "https://github.com/AjayTeotia/StorIt/blob/main/src/components/OtpModal.tsx"
    click FileUploader "https://github.com/AjayTeotia/StorIt/blob/main/src/components/FileUploader.tsx"
    click ActionDropdown "https://github.com/AjayTeotia/StorIt/blob/main/src/components/ActionDropdown.tsx"
    click ActionModal "https://github.com/AjayTeotia/StorIt/blob/main/src/components/ActionModalContent.tsx"
    click Header "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Header.tsx"
    click Sidebar "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Sidebar.tsx"
    click MobileNav "https://github.com/AjayTeotia/StorIt/blob/main/src/components/MobileNavigation.tsx"
    click Search "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Search.tsx"
    click Sort "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Sort.tsx"
    click Card "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Card.tsx"
    click Thumbnail "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Thumbnail.tsx"
    click Chart "https://github.com/AjayTeotia/StorIt/blob/main/src/components/Chart.tsx"
    click UserActions "https://github.com/AjayTeotia/StorIt/blob/main/src/lib/actions/user.action.ts"
    click FileActions "https://github.com/AjayTeotia/StorIt/blob/main/src/lib/actions/file.action.ts"
    click Config "https://github.com/AjayTeotia/StorIt/blob/main/src/lib/appwrite/config.ts"
    click AppwriteSDK "https://github.com/AjayTeotia/StorIt/blob/main/src/lib/appwrite/index.ts"

    %% Styles
    classDef component fill:#f9f,stroke:#333,stroke-width:2px
    classDef service fill:#69b3a2,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        direction TB
        L1["Component"]:::component
        L2["Service"]:::service
    end
```
