# rajeshceg3/fruitninja architecture

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

- Interactive diagram: https://gitdiagram.com/rajeshceg3/fruitninja
- Repository: https://github.com/rajeshceg3/fruitninja

## Overview

##### Project type and purpose
- This is a full-stack Next.js application for browsing and filtering a collection of fruits.
- The frontend is built in React (Next.js pages + components), state is managed via a client store, and data is persisted in a SQLite database accessed through Prisma. API routes expose the data to the UI.

##### File structure
- Top­-level folders:
– components/: reusable React UI (BenefitFilter, DaySelector, FruitCard, FruitGrid, Header)
– pages/: Next.js pages (index.js, dynamic [id].js under pages/fruit/, plus API routes under pages/api/)
– prisma/: Prisma schema and development SQLite DB (schema.prisma, dev.db)
– store/: client-side state management (fruitStore.js)
– public/: static assets (images)
– styles/: CSS modules & global styles
– data/: possibly seed/static data (fruits.js)
- Config & scripts: next.config.mjs, jsconfig.json, .eslintrc.json, package.json

##### README
- Bootstrapped via create-next-app
- Describes dev server, API-route mapping, font optimization, and deployment hints

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser / React UI Layer
    subgraph "Browser / React UI"
        direction TB
        BF["BenefitFilter"]:::frontend
        DS["DaySelector"]:::frontend
        FC["FruitCard"]:::frontend
        FG["FruitGrid"]:::frontend
        HD["Header"]:::frontend
        Store["Zustand Store"]:::store
    end

    %% Next.js Pages (SSR/SSG Layer)
    subgraph "Next.js Pages (SSR/SSG Layer)"
        direction TB
        Home["Home Page (index.js)"]:::pages
        Detail["Fruit Detail Page ([id].js)"]:::pages
        App["Custom App (_app.js)"]:::pages
        Document["Custom Document (_document.js)"]:::pages
    end

    %% API Routes (Serverless)
    subgraph "API Routes (Serverless)"
        direction TB
        FruitsAPI["/api/fruits"]:::api
        HelloAPI["/api/hello"]:::api
    end

    Prisma["Prisma Client"]:::api
    DB["SQLite DB"]:::db
    Static["Static Assets (public/images)"]:::static
    Data["Seed Data (data/fruits.js)"]:::static
    Styles["Styles & Config"]:::static

    %% Relationships
    HD -->|renders| Home
    Home -->|renders| FG
    FG -->|renders| FC
    Home -->|renders| BF
    Home -->|renders| DS

    BF -->|reads/writes| Store
    DS -->|reads/writes| Store
    FG -->|reads| Store
    FC -->|reads| Store

    BF -->|client fetch| FruitsAPI
    DS -->|client fetch| FruitsAPI
    FG -->|client fetch| FruitsAPI
    FC -->|client fetch| FruitsAPI

    Home -->|SSR fetch| FruitsAPI
    Detail -->|SSR fetch| FruitsAPI

    FruitsAPI -->|uses| Prisma
    HelloAPI -->|uses| Prisma
    Prisma -->|queries| DB

    Home -->|serves| Static
    Document -->|includes| Styles
    App -->|applies| Styles

    Data -->|seed for| DB

    %% Click Events
    click BF "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/components/BenefitFilter.js"
    click DS "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/components/DaySelector.js"
    click FC "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/components/FruitCard.js"
    click FG "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/components/FruitGrid.js"
    click HD "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/components/Header.js"
    click Store "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/store/fruitStore.js"
    click Home "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/index.js"
    click Detail "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/fruit/[id].js"
    click App "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/_app.js"
    click Document "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/_document.js"
    click FruitsAPI "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/api/fruits.js"
    click HelloAPI "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/pages/api/hello.js"
    click Prisma "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/prisma/schema.prisma"
    click DB "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/prisma/dev.db"
    click Static "https://github.com/rajeshceg3/fruitninja/tree/feat/fruitful-days-core-pending-tests/public/images/"
    click Data "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/data/fruits.js"
    click Styles "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/styles/globals.css"
    click Styles "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/styles/Home.module.css"
    click Styles "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/next.config.mjs"
    click Styles "https://github.com/rajeshceg3/fruitninja/blob/feat/fruitful-days-core-pending-tests/jsconfig.json"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef store fill:#B0E0E6,stroke:#333,stroke-width:1px
    classDef pages fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef api fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
```
