# muhammadradifa/portfolio-v2 architecture

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

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

## Overview

##### Main Components
- Frontend – Next.js Application:
- This includes the pages under src/app (e.g., about, contact, education, project, resume) that render the views.
- UI components under src/components provide reusable elements (Navbar, Footer, and various common widgets like ProjectCard, AudioPlayer, etc.).
- The provider layer (src/provider) and utility modules (src/utils) for things like theming, animations, constants, and services (like data fetchers and counters).
- Assets in the src/Assets folder and public resources (such as the cv.pdf and landing image referenced in the README).
- API/Backend – Express.js Server:
- Although not directly visible in the file tree, this component should be depicted as handling server-side logic, routing, and providing data endpoints used by the frontend.
- Database – MongoDB:
- This as storing and managing dynamic data (for example, projects, experiences, any data that might be fetched by the Express API).

##### Relationships and Interactions
- The Next.js frontend communicates with the backend APIs—potentially via fetch calls that are encapsulated in the src/utils/service/Fetcher.ts and similar modules.
- The Express.js service acts as the middle layer, processing client requests, applying business logic, and interacting with the MongoDB database.
- Data flow should show requests originating from the UI, moving through the API layer (Express.js), and data being retrieved or stored in the MongoDB database.
- Client-side providers (like themesProvider.tsx) and UI state management help in rendering components based on the fetched data and user interactions.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- The system is clearly sectioned into presentation (Next.js pages and components), business logic (which would be in the Express backend), and data management (MongoDB).
- Component-Based UI:
- The Next.js structure with reusable components ensures maintainability and clarity in UI design.
- API-Driven Interaction:
- The design emphasizes the coordination between frontend and backend, mediated by API calls.
- Context/Provider Pattern:
- Use of themesProvider.tsx and similar context files suggests that global state management (like theming) is handled via providers.

##### Final Checklist
- Clear labels for each component (e.g., “Next.js Frontend”, “Express.js Backend”, “MongoDB Database”).
- As much granularity as needed in the frontend part to show pages, providers, and utility modules, emphasizing how these pieces support the core functionality of the site.
- Architectural patterns, such as separation of concerns and API-driven communication.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Next.js Frontend"
        direction TB
        FE_Pages["Pages (src/app)"]:::frontend
        FE_Components["UI Components (src/components)"]:::frontend
        FE_Providers["Provider Modules (src/provider/themesProvider.tsx)"]:::frontend
        FE_Utils["Utility Modules (src/utils)"]:::frontend
        FE_Assets["Assets (src/Assets & public)"]:::frontend
    end

    BE_API["Express.js API Server"]:::backend
    DB["MongoDB Database"]:::database

    FE_Pages -->|"fetches"| BE_API
    FE_Components -->|"callsAPI"| BE_API
    FE_Utils -->|"handlesFetch"| BE_API
    BE_API -->|"queries/inserts"| DB
    BE_API -->|"responds"| FE_Pages
    FE_Providers -->|"providesState"| FE_Components

    click FE_Pages "https://github.com/muhammadradifa/portfolio-v2/tree/master/src/app"
    click FE_Components "https://github.com/muhammadradifa/portfolio-v2/tree/master/src/components"
    click FE_Providers "https://github.com/muhammadradifa/portfolio-v2/blob/master/src/provider/themesProvider.tsx"
    click FE_Utils "https://github.com/muhammadradifa/portfolio-v2/tree/master/src/utils"
    click FE_Assets "https://github.com/muhammadradifa/portfolio-v2/tree/master/src/Assets"

    classDef frontend fill:#4A90E2,stroke:#1a1a1a,stroke-width:2px;
    classDef backend fill:#7ED321,stroke:#1a1a1a,stroke-width:2px;
    classDef database fill:#F5A623,stroke:#1a1a1a,stroke-width:2px;
```
