# rezaageng/me architecture

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

- Interactive diagram: https://gitdiagram.com/rezaageng/me
- Repository: https://github.com/rezaageng/me

## Overview

##### Project type and purpose
- This is a full-stack portfolio website that showcases creative work, built using Next.js. It focuses on a visually engaging, interactive experience with animations (via Framer Motion and Lenis) and responsive design (via Tailwind CSS).
- The README highlights that the website is a “canvas where pixels come alive” and integrates with an external API (by default, Strapi).

##### And segment the file structure
- Notice the separation between project concerns:
- The /app directory under src contains Next.js pages, API endpoints, and routing logic.
- The /components directory includes all reusable UI pieces (home, about, terminal, navbar, etc.), which indicate a well-modularized front-end.
- The /ssg folder indicates a static site generation (SSG) approach which likely pre-builds some parts of the site.
- The /graphql and /libs directories encapsulate external integrations and helper utilities, such as Apollo Client configuration and GraphQL queries.
- Extensive testing folders hint at robust test coverage and component isolation.
- Build and configuration files (like next.config.mjs, tailwind.config.js, tsconfig.json) that anchor the project’s technical stack.

##### Main components to capture
a. Client/Browser:
- End-user accessing the website, with support for the “Kawaii Mode” toggled via URL parameters.
b. Next.js Frontend:
- Next.js application divided into UI components (found in the /components and /app directories).
- Pages like Home, About, Projects, etc., and note the layout system (layout.tsx, globals.css) and the use of dynamic routing for projects ([slug] pages).
- How static generation (SSG) and API routes (in /app/api) are used to fetch and serve dynamic content.
c. API Routes (Backend Layer within Next.js):
- API endpoints under /app/api (e.g., for educations, experiences, home, etc.), which are used to interface with both internal logic and the external API.
d. External API Integration:
- Integration with third-party services like GitHub API (through stored tokens) and Wakatime.
e. GraphQL Layer:
- GraphQL integration as part of the data fetching architecture (see /graphql/github-gql.ts, leetcode-gql.ts) that pulls in external data.
f. State Management and Helpers:
- Summarize the client-side state management (e.g., terminal-store and kawaii-store) and utility functions (helpers, libs) that support the main interactive features.

##### Relationships and interactions between components
- From the Client’s browser, requests hit the Next.js server for pre-rendered pages and interactive components.
- API routes receive requests and may themselves call external APIs (Strapi) for dynamic data.
- SSG components at build time fetch and incorporate data from external sources (GraphQL or REST endpoints) into static content.
- Internal state management sits on the client side to manage UI interactions such as terminal commands and dynamic animations.
- That some components also interact with the external API asynchronously for real-time data updates.

##### Important architectural patterns and technologies
- Separation of concerns with distinct layers (presentation, API, data fetching).
- Use of modern frontend patterns such as component-based design (React components), static and server-side rendering, and API integration.
- Integrations: Next.js for SSR/SSG, Tailwind CSS for styling, Framer Motion for animations, and Lenis for smooth scrolling.
- Test-driven approach with comprehensive __tests__ and __mocks__ folders ensuring reliability.

- Clear labels for each component (e.g., "Home Page", "API Endpoint: /educations", "GraphQL Github Integration").
- Annotations for notable design choices such as SSG, and how routes in Next.js are structured (make special notes of the dynamic project routing and API integrations).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    client("Client (Browser)"):::client

    %% Next.js Frontend Subgraph
    subgraph "Next.js Frontend"
        direction TB
        pages("Pages & Layout"):::frontend
        components("Reusable UI Components"):::frontend
    end

    %% API Routes Subgraph
    subgraph "API Routes (Next.js)"
        direction TB
        apiEducations("API: Educations"):::backend
        apiExperiences("API: Experiences"):::backend
        apiHome("API: Home"):::backend
        apiLink("API: Link"):::backend
        apiProjects("API: Projects"):::backend
        apiSkill("API: SkillCategories"):::backend
    end

    %% SSG & External API Integration Subgraph
    subgraph "Static Site Generation (SSG) & API Integration"
        direction TB
        ssg("SSG & Data Fetching"):::ssg
    end

    %% GraphQL Integration Subgraph
    subgraph "GraphQL Integration"
        direction TB
        gqlGithub("GraphQL: GitHub"):::gql
        gqlLeetcode("GraphQL: Leetcode"):::gql
    end

    %% State Management & Helpers Subgraph
    subgraph "State Management & Helpers"
        direction TB
        stores("State Stores"):::state
        helpers("Helper Utilities & Libraries"):::state
    end

    %% External API Dependency
    external_api("External API (Strapi)"):::external

    %% Connections & Data Flow
    client -->|"requests"| pages
    client -->|"UI interactions"| components
    pages -->|"renders"| components
    pages -->|"fetch data via"| apiEducations
    pages -->|"fetch data via"| apiExperiences
    pages -->|"fetch data via"| apiHome
    pages -->|"fetch data via"| apiLink
    pages -->|"fetch data via"| apiProjects
    pages -->|"fetch data via"| apiSkill

    components -->|"manages state"| stores
    stores -->|"uses"| helpers

    apiEducations -->|"calls"| external_api
    apiExperiences -->|"calls"| external_api
    apiHome -->|"calls"| external_api
    apiLink -->|"calls"| external_api
    apiProjects -->|"calls"| external_api
    apiSkill -->|"calls"| external_api

    ssg -->|"pre-builds pages with"| pages
    ssg -->|"fetches from"| apiEducations
    ssg -->|"fetches from"| apiExperiences
    ssg -->|"fetches from"| apiHome
    ssg -->|"fetches from"| apiLink
    ssg -->|"fetches from"| apiProjects
    ssg -->|"fetches from"| apiSkill
    ssg -->|"incorporates data from"| gqlGithub
    ssg -->|"incorporates data from"| gqlLeetcode

    gqlGithub -->|"supplies data to"| apiEducations
    gqlLeetcode -->|"supplies data to"| apiExperiences

    %% Click Events for Component Mapping

    %% Next.js Frontend (Pages & Layout)
    click pages "https://github.com/rezaageng/me/tree/main/src/app"
    click pages "https://github.com/rezaageng/me/blob/main/src/app/layout.tsx"
    click pages "https://github.com/rezaageng/me/blob/main/src/app/page.tsx"
    click pages "https://github.com/rezaageng/me/blob/main/src/app/about/page.tsx"
    click pages "https://github.com/rezaageng/me/blob/main/src/app/projects/page.tsx"
    click pages "https://github.com/rezaageng/me/blob/main/src/app/projects/[slug]/page.tsx"

    %% Reusable UI Components
    click components "https://github.com/rezaageng/me/tree/main/src/components"

    %% API Routes
    click apiEducations "https://github.com/rezaageng/me/blob/main/src/app/api/educations/route.ts"
    click apiExperiences "https://github.com/rezaageng/me/blob/main/src/app/api/experiences/route.ts"
    click apiHome "https://github.com/rezaageng/me/blob/main/src/app/api/home/route.ts"
    click apiLink "https://github.com/rezaageng/me/blob/main/src/app/api/link/route.ts"
    click apiProjects "https://github.com/rezaageng/me/blob/main/src/app/api/projects/route.ts"
    click apiSkill "https://github.com/rezaageng/me/blob/main/src/app/api/skill-categories/route.ts"

    %% SSG Integration
    click ssg "https://github.com/rezaageng/me/blob/main/src/ssg/index.ts"

    %% GraphQL Integration
    click gqlGithub "https://github.com/rezaageng/me/blob/main/src/graphql/github-gql.ts"
    click gqlLeetcode "https://github.com/rezaageng/me/blob/main/src/graphql/leetcode-gql.ts"

    %% State Management & Helper Utilities
    click stores "https://github.com/rezaageng/me/tree/main/src/stores"
    click stores "https://github.com/rezaageng/me/blob/main/src/stores/terminal-store.tsx"
    click stores "https://github.com/rezaageng/me/blob/main/src/stores/kawaii-store.tsx"
    click helpers "https://github.com/rezaageng/me/tree/main/src/helpers"
    click helpers "https://github.com/rezaageng/me/blob/main/src/libs/apollo-client.ts"
    click helpers "https://github.com/rezaageng/me/blob/main/src/libs/query-provider.tsx"
    click helpers "https://github.com/rezaageng/me/blob/main/src/libs/react-lenis.tsx"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:2px;
    classDef frontend fill:#bbf,stroke:#333,stroke-width:2px;
    classDef backend fill:#fdd,stroke:#333,stroke-width:2px;
    classDef ssg fill:#dfd,stroke:#333,stroke-width:2px;
    classDef gql fill:#fed,stroke:#333,stroke-width:2px;
    classDef state fill:#ffe,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
```
