# nischaldutt/techlance architecture

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

- Interactive diagram: https://gitdiagram.com/nischaldutt/techlance
- Repository: https://github.com/nischaldutt/techlance

## Overview

##### Main Components Identification

The system should be divided into these primary components:

a) Client-Side (Frontend):
- Public Client Interface
- Business Admin Interface
- Authentication System
- Component Library (shared components)

b) Server-Side (Next.js API Routes):
- API Layer
- Authentication Services
- Business Logic Layer

c) External Services:
- Database (implied by the hooks structure)
- File Storage (indicated by FileUpload component)

##### Specific Implementation Details

- How the booking flow works (BookingRequestSteps)
- Business registration process (RegistrationSteps)
- Service management flow
- Review and rating system

##### Key Architectural Patterns to Highlight

- Next.js Pages Router architecture
- Context-based state management
- Custom hooks for data fetching
- Component composition pattern
- Feature-based folder structure

##### Data Flow Representation

- API calls between frontend and backend
- Authentication flows
- File upload processes
- Booking request lifecycle
- Review submission flow

##### Important Notes

Specific elements:
- Clear separation between client and business portals
- Authentication boundaries
- API endpoint groupings
- Shared resource access patterns

- The separation between client and business interfaces
- The role of shared components
- The authentication and authorization flow
- The booking and service management system
- The review and rating mechanism

- How the application handles different user types (clients vs. businesses)
- The flow of data through the system
- The relationship between components
- The security boundaries and authentication flows
- The scalability considerations in the architecture

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        direction TB
        Client["Public Client Interface"]
        Business["Business Admin Interface"]
        SharedComp["Shared Component Library"]
        
        subgraph AuthSystem["Authentication System"]
            direction TB
            ClientAuth["Client Auth"]
            BusinessAuth["Business Auth"]
            AuthContext["Auth Context"]
        end

        subgraph Layout["Layout System"]
            direction TB
            AdminLayout["Admin Layout"]
            Sidebar["Business Sidebar"]
            NavBar["Client NavBar"]
        end
    end

    subgraph ApplicationLayer["Application Layer"]
        direction TB
        APIRoutes["API Routes"]
        AxiosClient["API Client"]

        subgraph BusinessLogic["Business Logic"]
            direction TB
            BusinessHooks["Business Hooks"]
            CustomerHooks["Customer Hooks"]
            AuthHooks["Auth Hooks"]
        end

        subgraph Contexts["Context Management"]
            direction TB
            AuthCtx["Auth Context"]
            RegCtx["Registration Context"]
            QueryCtx["Query Cache Context"]
        end
    end

    subgraph Features["Core Features"]
        direction TB
        BookingSystem["Booking System"]
        RegSystem["Registration System"]
        ReviewSystem["Review System"]
        ServiceMgmt["Service Management"]
        FileStorage["File Storage System"]
    end

    %% Connections
    Client --> AuthSystem
    Business --> AuthSystem
    Client --> SharedComp
    Business --> SharedComp
    AuthSystem --> APIRoutes
    BusinessLogic --> APIRoutes
    Features --> BusinessLogic
    Features --> AxiosClient
    AxiosClient --> APIRoutes

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:#fff
    classDef backend fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef feature fill:#e67e22,stroke:#d35400,color:#fff
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:#fff
    classDef context fill:#95a5a6,stroke:#7f8c8d,color:#fff

    class Client,Business,SharedComp,Layout frontend
    class APIRoutes,AxiosClient,BusinessLogic backend
    class Features,BookingSystem,RegSystem,ReviewSystem,ServiceMgmt feature
    class AuthSystem,ClientAuth,BusinessAuth auth
    class Contexts,AuthCtx,RegCtx,QueryCtx context

    %% Click Events
    click Client "https://github.com/nischaldutt/techlance/tree/main/components/client"
    click Business "https://github.com/nischaldutt/techlance/tree/main/components/business"
    click SharedComp "https://github.com/nischaldutt/techlance/tree/main/components/common"
    click ClientAuth "https://github.com/nischaldutt/techlance/tree/main/components/client/Auth"
    click BusinessAuth "https://github.com/nischaldutt/techlance/tree/main/components/business/Auth"
    click AuthContext "https://github.com/nischaldutt/techlance/blob/main/contexts/AuthContext.jsx"
    click APIRoutes "https://github.com/nischaldutt/techlance/tree/main/pages/api"
    click BusinessHooks "https://github.com/nischaldutt/techlance/tree/main/hooks/business"
    click CustomerHooks "https://github.com/nischaldutt/techlance/tree/main/hooks/customer"
    click AuthHooks "https://github.com/nischaldutt/techlance/tree/main/hooks/auth"
    click FileStorage "https://github.com/nischaldutt/techlance/tree/main/components/common/FileUpload"
    click BookingSystem "https://github.com/nischaldutt/techlance/tree/main/components/client/BookingRequestSteps"
    click RegSystem "https://github.com/nischaldutt/techlance/tree/main/components/business/RegistrationSteps"
    click ReviewSystem "https://github.com/nischaldutt/techlance/tree/main/components/client/BusinessReviews"
    click ServiceMgmt "https://github.com/nischaldutt/techlance/tree/main/components/business/Services"
    click AuthCtx "https://github.com/nischaldutt/techlance/blob/main/contexts/AuthContext.jsx"
    click RegCtx "https://github.com/nischaldutt/techlance/blob/main/contexts/BusinessRegistrationContext.jsx"
    click QueryCtx "https://github.com/nischaldutt/techlance/blob/main/contexts/QueryCacheContext.jsx"
    click AxiosClient "https://github.com/nischaldutt/techlance/blob/main/libs/axiosClient.js"
    click AdminLayout "https://github.com/nischaldutt/techlance/blob/main/layouts/Admin.jsx"
    click Sidebar "https://github.com/nischaldutt/techlance/tree/main/components/business/Sidebar"
    click NavBar "https://github.com/nischaldutt/techlance/tree/main/components/client/NavBar"
```
