# yahiamana/portfolio architecture

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

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

## Overview

##### Project type and purpose
- This is a full-stack, React-based web application built with Next.js (App Router).
- The app provides a public-facing portfolio or projects page with image-upload functionality and an admin panel to manage project entries.
- It uses Prisma as an ORM to persist project data to a database and stores uploaded files in the `public/uploads` directory.

##### File structure
- Top-level Next.js config and build files: `next.config.ts`, `eslint.config.mjs`, `tsconfig.json`.
- `public/` holds static assets and an `uploads/` subfolder for user-uploaded files.
- `prisma/` contains the database schema (`schema.prisma`), migrations, and a helper (`lib/prisma.ts`) to instantiate the Prisma client.
- `src/app/` is the Next.js App Router folder:
- `page.tsx` and `layout.tsx` define entry points and the common layout.
- `components/` houses presentational React components (Hero, Projects, About, Contact, Nav).
- `api/` contains two serverless route handlers:
– `projects/route.ts` for CRUD operations on project records via Prisma.
– `upload/route.ts` to handle file uploads to `public/uploads`.
- `adminpanel/page.tsx` is the protected UI for managing projects.

##### README for additional insights
- Standard Next.js boilerplate created with `create-next-app`.

##### Elements
- UI requests and responses between Client ↔ Next.js Pages
- API calls between Client → API Routes → Prisma → DB
- File writes to File Store and subsequent static file serving
- Blue = Presentation (Browser + React)
- Green = Application (Next.js Server + API)
- Orange = Data (Prisma, DB, File Store)
- Grey = Infrastructure (Vercel)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI_Browser["Client Browser"]:::presentation
        React_Components["React UI Components"]:::presentation
        Page["Public-Facing Page\n(page.tsx)"]:::presentation
        Layout["Common Layout\n(layout.tsx)"]:::presentation
        Admin_UI["Admin Panel UI\n(adminpanel/page.tsx)"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        NextServer["Next.js App Server"]:::application
        API_Projects["Projects API\n(route.ts)"]:::application
        API_Upload["Upload API\n(route.ts)"]:::application
        Config["Next.js Configuration\n(next.config.ts)"]:::application
    end

    %% Data Layer
    subgraph "Data Layer"
        PrismaClient["Prisma Client Init\n(lib/prisma.ts)"]:::data
        DB["Database Schema\n(schema.prisma)"]:::data
        Migrations["DB Migrations"]:::data
        FileStore["File Storage\n(public/uploads)"]:::data
        TSConfig["TypeScript Config\n(tsconfig.json)"]:::data
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        Deployment["Deployment Platform"]:::infra
    end

    %% Connections
    UI_Browser -->|"requests pages"| NextServer
    NextServer --> Page
    NextServer --> Layout
    NextServer --> Admin_UI

    UI_Browser -->|"GET/POST/DELETE"| API_Projects
    UI_Browser -->|"POST (upload)"| API_Upload

    API_Projects -->|"uses"| PrismaClient
    PrismaClient -->|"reads/writes"| DB
    Migrations -->|"evolves schema"| DB

    API_Upload -->|"writes file"| FileStore
    NextServer -->|"serves static"| FileStore

    Deployment --> NextServer
    Deployment --> API_Projects
    Deployment --> API_Upload
    Deployment --> FileStore

    %% Click Events
    click React_Components "https://github.com/yahiamana/portfolio/tree/main/src/app/components/"
    click Page "https://github.com/yahiamana/portfolio/blob/main/src/app/page.tsx"
    click Layout "https://github.com/yahiamana/portfolio/blob/main/src/app/layout.tsx"
    click Admin_UI "https://github.com/yahiamana/portfolio/blob/main/src/app/adminpanel/page.tsx"
    click API_Projects "https://github.com/yahiamana/portfolio/blob/main/src/app/api/projects/route.ts"
    click API_Upload "https://github.com/yahiamana/portfolio/blob/main/src/app/api/upload/route.ts"
    click PrismaClient "https://github.com/yahiamana/portfolio/blob/main/prisma/lib/prisma.ts"
    click DB "https://github.com/yahiamana/portfolio/blob/main/prisma/schema.prisma"
    click Migrations "https://github.com/yahiamana/portfolio/tree/main/prisma/migrations/"
    click FileStore "https://github.com/yahiamana/portfolio/tree/main/public/uploads"
    click Config "https://github.com/yahiamana/portfolio/blob/main/next.config.ts"
    click TSConfig "https://github.com/yahiamana/portfolio/blob/main/tsconfig.json"

    %% Styles
    classDef presentation fill:#DDEEFF,stroke:#333,stroke-width:1px
    classDef application fill:#DDFFDD,stroke:#333,stroke-width:1px
    classDef data fill:#FFEEAA,stroke:#333,stroke-width:1px
    classDef infra fill:#EEEEEE,stroke:#333,stroke-width:1px
```
