# yeabnoah/frame architecture

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

- Interactive diagram: https://gitdiagram.com/yeabnoah/frame
- Repository: https://github.com/yeabnoah/frame

## Overview

##### Project Type and Purpose
- This is a full-stack web application built with a separation between a Next.js frontend (located under the "client2" folder) and a backend API/server (found under the "src" directory).
- The presence of a Prisma folder (with database migrations and schema) confirms that the application uses a relational database with an ORM.
- The README’s simple instructions (“bun install”, “bun run dev”) indicate the use of Bun as the JavaScript runtime and package manager.

##### File Structure
- Frontend ("client2"):
- Uses the new Next.js app architecture, as seen from the “app” folder with sub-routes for authentication (login, register), dashboard, and main pages.
- Contains a rich set of components (organized in directories like components/app, components/dashboard, components/hero, components/ui, etc.), hooks, providers, and interfaces.
- Has its own environment and configuration files, giving hints about its setup and styling (e.g., tailwind.config.ts, globals.css).

- Backend ("src"):
- Organized into clearly separated concerns: controllers (for articles, info, links, projects, skills, testimonies, user), routes (which likely group the API endpoints), and middleware.
- Contains a “lib” subdirectory (with utilities such as authentication and database connection) and a set of interfaces, following typical MVC or layered architecture patterns.

- Database ("prisma"):
- Contains multiple migration subdirectories and a master schema file, showing an evolving database schema that supports the backend’s CRUD operations.

- Other Artifacts:
- A “validation” folder (both within client2 and at the project root) suggests robust data validation procedures, and there are configuration files (.env.example, tsconfig.json, etc.) that support the project’s environment setup.

##### Key Components
a. Frontend:
- Pages & Routing: Represent “app” subdirectories (auth, dashboard, main) indicating different user interfaces or flows.
- Components: Group by types such as UI components, reusable components, editor/hero components, etc.
- Providers & Hooks: Include state management and context providers (QueryClientProvider, sessionProvider, themeProvider) which manage global states and API data caching.

b. Backend:
- API Server: Represent the “src” directory as the backend service.
- Divide into:
- Controllers: Illustrate modules for managing articles, info, links, projects, skills, testimonies, and user operations.
- Routes: Indicate that controllers are exposed via HTTP endpoints (both public and authenticated routes).
- Middleware: Show a layer that handles authentication and user checks.
- Utilities/Lib: Indicate support modules such as database utilities and authentication helpers.

c. Database:
- Database Service: Represent the database, with a note that Prisma is used to manage migrations and schema.

##### Relationships and Interactions
- That the Backend interacts directly with the Database through the Prisma ORM.
- Optionally, denote any middleware filtering or transformation steps on the API side along the data flow.

##### Architectural Patterns and Technologies
- Clearly mention that the architecture leverages a separation of concerns (Frontend vs. Backend) and follows a layered approach.
- Technologies:
- Next.js (frontend routing and component-based UI)
- Bun (runtime environment and package management)
- TypeScript (found throughout the project)
- Prisma (ORM for the database)
- MVC or similar patterns in the backend (controllers, routes, middleware layers) and note how client-side state is managed via providers.

##### Final Recommendations
- That all major directories and functions are represented as distinct components.
- Integration points (such as the Prisma-managed database) and the common utilities across the system.
- Be very detailed: capture both the client-side user flows (via the various Next.js pages and components) and the server-side logic (controllers, routes, middleware, validation).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Frontend (Next.js)"
        FE_APP["Frontend App"]
        FE_PAGES["Pages & Routing"]
        FE_COMPONENTS["Components"]
        FE_PROVIDERS["Providers"]
        FE_HOOKS["Hooks"]
    end

    %% Backend Subgraph
    subgraph "Backend (API Server)"
        BE_API["API Server"]
        BE_ROUTES["API Routes"]
        BE_MW["Middleware"]
        BE_CTRL["Controllers"]
        BE_LIB["Utilities/Lib"]
    end

    %% Database Node
    DB["Database (Prisma)"]

    %% Frontend Internal Connections
    FE_APP --> FE_PAGES
    FE_APP --> FE_COMPONENTS
    FE_APP --> FE_PROVIDERS
    FE_APP --> FE_HOOKS

    %% Frontend to Backend Flow
    FE_PAGES -->|"API_Request"| BE_ROUTES

    %% Backend Internal Flow
    BE_API -->|"Exposes_Endpoints"| BE_ROUTES
    BE_ROUTES -->|"Auth_Check"| BE_MW
    BE_MW -->|"Invoke_Controller"| BE_CTRL
    BE_CTRL -->|"Calls_Lib"| BE_LIB
    BE_LIB -->|"DB_Query"| DB

    %% Click Events for Frontend Components
    click FE_APP "https://github.com/yeabnoah/frame/tree/main/client2/"
    click FE_PAGES "https://github.com/yeabnoah/frame/tree/main/client2/app/"
    click FE_COMPONENTS "https://github.com/yeabnoah/frame/tree/main/client2/components/"
    click FE_PROVIDERS "https://github.com/yeabnoah/frame/tree/main/client2/provider/"
    click FE_HOOKS "https://github.com/yeabnoah/frame/tree/main/client2/hooks/"

    %% Click Events for Backend Components
    click BE_API "https://github.com/yeabnoah/frame/tree/main/src/"
    click BE_CTRL "https://github.com/yeabnoah/frame/tree/main/src/controllers/"
    click BE_ROUTES "https://github.com/yeabnoah/frame/tree/main/src/routes/"
    click BE_MW "https://github.com/yeabnoah/frame/tree/main/src/middleware/"
    click BE_LIB "https://github.com/yeabnoah/frame/tree/main/src/lib/"

    %% Click Event for Database
    click DB "https://github.com/yeabnoah/frame/tree/main/prisma/"

    %% Styles
    classDef frontend fill:#aee1f9,stroke:#333,stroke-width:2px;
    classDef backend fill:#f9d6a7,stroke:#333,stroke-width:2px;
    classDef database fill:#c8f7c5,stroke:#333,stroke-width:2px;

    class FE_APP,FE_PAGES,FE_COMPONENTS,FE_PROVIDERS,FE_HOOKS frontend;
    class BE_API,BE_ROUTES,BE_MW,BE_CTRL,BE_LIB backend;
    class DB database;
```
