# sachinmhetre678/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/sachinmhetre678/portfolio
- Repository: https://github.com/sachinmhetre678/portfolio

## Overview

##### High-Level Architecture Components

a) Client Layer
- Next.js Frontend (React Components)
- Static Assets (public directory)
- Client-side Routing

b) Server Layer
- Next.js API Routes
- Server-side Rendering (SSR)
- Static Site Generation (SSG)

c) External Services Layer
- Firebase (noted from firebase.ts)
- GitHub API Integration
- WakaTime API Integration
- Prisma Database

##### Component Organization

Modular structure with:

a) Core Components:
- Common Components (src/common/components)
- Layout System
- Element Library
- Sidebar Navigation

b) Feature Modules:
- Home Module
- About Module
- Projects Module
- Contact Module

##### Data Flow Architecture

Following flows:

a) API Routes:
- /api/contact
- /api/content
- /api/github
- /api/projects
- /api/views
- /api/read-stats

b) Service Integrations:
- GitHub Service
- WakaTime Service
- Contact Service
- Fetcher Service

##### Key Architectural Patterns to Highlight

- Module-based architecture (src/modules structure)
- Component composition pattern (elements and layouts)
- Service layer abstraction
- API route organization
- Context-based state management (MenuContext)

##### Implementation Details

a) Frontend Architecture:
- Common components hierarchy
- Module organization
- Routing structure
- Static asset management

b) Backend Services:
- API route handlers
- External service integrations
- Data fetching patterns

c) Build & Deploy:
- Next.js configuration
- Vercel deployment (indicated by vercel.json)
- Static site generation pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Pages["Pages Layer"]
        Components["Core Components"]
        Modules["Feature Modules"]
        Assets["Static Assets"]
        Context["Context Management"]
    end

    subgraph Server
        API["API Routes"]
        Services["Service Layer"]
        Data["Data Layer"]
    end

    subgraph External
        GitHub[("GitHub API")]
        WakaTime[("WakaTime API")]
        Firebase[("Firebase")]
        PrismaDB[("Prisma DB")]
    end

    Pages --> |renders| Components
    Pages --> |uses| Modules
    Components --> |manages| Context
    Assets --> |served to| Pages

    Pages --> HomePage["Home Page"]
    Pages --> AboutPage["About Page"]
    Pages --> ProjectsPage["Projects Page"]
    Pages --> ContactPage["Contact Page"]

    Components --> Elements["UI Elements"]
    Components --> Layouts["Layout System"]
    Components --> Sidebar["Sidebar Navigation"]

    Modules --> HomeModule["Home Module"]
    Modules --> AboutModule["About Module"]
    Modules --> ProjectsModule["Projects Module"]
    Modules --> ContactModule["Contact Module"]

    API --> ContactAPI["Contact API"]
    API --> GithubAPI["GitHub API"]
    API --> ProjectsAPI["Projects API"]
    API --> ViewsAPI["Views API"]
    API --> ContentAPI["Content API"]

    Services --> GitHubService["GitHub Service"]
    Services --> WakaTimeService["WakaTime Service"]
    Services --> ContactService["Contact Service"]
    Services --> FetcherService["Fetcher Service"]

    Data --> Firebase
    Data --> PrismaDB

    GitHubService --> GitHub
    WakaTimeService --> WakaTime
    Services --> API

    classDef frontend fill:#FF6B6B,stroke:#FF6B6B,color:white
    classDef backend fill:#4ECDC4,stroke:#4ECDC4,color:white
    classDef external fill:#95A5A6,stroke:#95A5A6,color:white
    classDef data fill:#F7D794,stroke:#F7D794,color:black

    class Pages,Components,Modules,Assets,Context,HomePage,AboutPage,ProjectsPage,ContactPage,Elements,Layouts,Sidebar,HomeModule,AboutModule,ProjectsModule,ContactModule frontend
    class API,Services,ContactAPI,GithubAPI,ProjectsAPI,ViewsAPI,ContentAPI,GitHubService,WakaTimeService,ContactService,FetcherService backend
    class GitHub,WakaTime external
    class Firebase,PrismaDB,Data data

    click Pages "https://github.com/SachinMhetre678/Portfolio/tree/main/src/pages"
    click HomePage "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/index.tsx"
    click AboutPage "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/about.tsx"
    click ProjectsPage "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/projects/index.tsx"
    click ContactPage "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/contact.tsx"
    click Components "https://github.com/SachinMhetre678/Portfolio/tree/main/src/common/components"
    click Elements "https://github.com/SachinMhetre678/Portfolio/tree/main/src/common/components/elements"
    click Layouts "https://github.com/SachinMhetre678/Portfolio/tree/main/src/common/components/layouts"
    click Sidebar "https://github.com/SachinMhetre678/Portfolio/tree/main/src/common/components/sidebar"
    click HomeModule "https://github.com/SachinMhetre678/Portfolio/tree/main/src/modules/home"
    click AboutModule "https://github.com/SachinMhetre678/Portfolio/tree/main/src/modules/about"
    click ProjectsModule "https://github.com/SachinMhetre678/Portfolio/tree/main/src/modules/projects"
    click ContactModule "https://github.com/SachinMhetre678/Portfolio/tree/main/src/modules/contact"
    click ContactAPI "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/api/contact.ts"
    click GithubAPI "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/api/github.ts"
    click ProjectsAPI "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/api/projects.ts"
    click ViewsAPI "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/api/views.ts"
    click ContentAPI "https://github.com/SachinMhetre678/Portfolio/blob/main/src/pages/api/content.ts"
    click GitHubService "https://github.com/SachinMhetre678/Portfolio/blob/main/src/services/github.ts"
    click WakaTimeService "https://github.com/SachinMhetre678/Portfolio/blob/main/src/services/wakatime.ts"
    click ContactService "https://github.com/SachinMhetre678/Portfolio/blob/main/src/services/contact.ts"
    click FetcherService "https://github.com/SachinMhetre678/Portfolio/blob/main/src/services/fetcher.ts"
    click Firebase "https://github.com/SachinMhetre678/Portfolio/blob/main/src/common/libs/firebase.ts"
    click PrismaDB "https://github.com/SachinMhetre678/Portfolio/blob/main/src/common/libs/prisma.ts"
    click Assets "https://github.com/SachinMhetre678/Portfolio/tree/main/public"
    click Context "https://github.com/SachinMhetre678/Portfolio/blob/main/src/common/context/MenuContext.tsx"
```
