# rajender-01/food-recipe-app-using-next-js architecture

> Architecture diagram of the GitHub repository rajender-01/food-recipe-app-using-next-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajender-01/food-recipe-app-using-next-js
- Repository: https://github.com/rajender-01/food-recipe-app-using-next-js

## Overview

##### Project type and purpose
- This is a Next.js–based full-stack web application (a recipe-sharing site) with both front-end pages and back-end API routes for authentication and data handling.
- Key indicators:
- `next.config.mjs`, `src/app/…/page.tsx` → Next.js routing & SSR/SSG pages
- `src/app/api/auth/[...nextauth]/route.ts` + `src/models/userModel.ts` → NextAuth API integration and user model
- `public/images/…` → static assets for recipes

##### File structure
- Top-level config & scripts: `.eslintrc.json`, `next.config.mjs`, `tailwind.config.ts`, `postcss.config.mjs`, `tsconfig.json`, `package.json`.
- Public assets under `public/`.
- Front-end app under `src/app/`, organized by route: home (`page.tsx`), recipe list & detail, login, signup, about us, plus global layout & CSS.
- API layer under `src/app/api/auth/[...nextauth]`.
- UI components under `src/components`, subdivided into domain components (Banner, Navbar, Recipe lists, etc.) and generic UI (`ui/button.tsx`, `ui/card.tsx`, etc.).
- Utilities and business logic: `src/actions/login.ts`, `src/lib/utils.ts`, `src/utils/helpers.js`, and a data file.
- Model definition in `src/models/userModel.ts` suggests a database (MongoDB/Mongoose or similar).

##### (No README content provided)
- We infer architecture from file layout and naming conventions.

##### Elements
- Clear labels: e.g., “Browser”, “Next.js App Router”, “Auth API (NextAuth)”, “Database (User & Recipes)”, “Static Assets CDN”.
- From Browser → Next.js Page (HTTP GET)
- From Page → API Route (HTTP POST/GET for login, data fetch)
- From API → Database (DB queries)
- From API → External OAuth Provider (if used)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    subgraph "Client"
        Browser["Browser"]:::client
    end

    %% Next.js Server Boundary
    subgraph "Next.js Server" 
        direction TB

        %% Page Layer
        subgraph "Page Layer"
            direction TB
            Layout["layout.tsx"]:::frontend
            GlobalsCSS["globals.css"]:::frontend
            HomePage["page.tsx"]:::frontend
            About["aboutus/page.tsx"]:::frontend
            LoginPage["login/page.tsx"]:::frontend
            SignupPage["signup/page.tsx"]:::frontend
            RecipeList["recipe/page.tsx"]:::frontend
            RecipeDetail["recipe/[id]/page.tsx"]:::frontend
            NotFound["not-found.tsx"]:::frontend
        end

        %% API Layer
        subgraph "API Layer (NextAuth)"
            direction TB
            AuthRoute["[...nextauth]/route.ts"]:::backend
            AuthConfig["auth.ts"]:::backend
        end

        %% Component Library
        subgraph "Component Library"
            direction TB
            subgraph "Domain Components"
                direction TB
                Banner["Banner"]:::frontend
                Category["Category"]:::frontend
                Footer["Footer"]:::frontend
                ImageArticle["ImageArticle"]:::frontend
                MostSearched["MostSearchedRecipes"]:::frontend
                Navbar["Navbar"]:::frontend
                Recent["RecentRecipes"]:::frontend
                SearchComp["Search"]:::frontend
                FormComp["client/form.tsx"]:::frontend
            end
            subgraph "UI Primitives"
                direction TB
                Button["button.tsx"]:::frontend
                Card["card.tsx"]:::frontend
                InputUI["input.tsx"]:::frontend
                SonnerUI["sonner.tsx"]:::frontend
            end
        end

        %% Business Logic & Utilities
        subgraph "Business Logic & Utilities"
            direction TB
            LoginAction["login.ts"]:::backend
            UtilsLib["utils.ts"]:::backend
            DataFile["data.js"]:::backend
            Helpers["helpers.js"]:::backend
        end

        %% Data Model
        subgraph "Data Model"
            UserModel["userModel.ts"]:::backend
        end

        %% Static Assets
        subgraph "Static Assets (CDN)"
            direction TB
            Img1["image-article.avif"]:::cdn
            Img2["image-article2.avif"]:::cdn
        end

        %% Configuration & Styling
        subgraph "Configuration & Styling"
            direction TB
            NextConfig["next.config.mjs"]:::config
            Tailwind["tailwind.config.ts"]:::config
            PostCSS["postcss.config.mjs"]:::config
            TSConf["tsconfig.json"]:::config
            ESLint[".eslintrc.json"]:::config
            Package["package.json"]:::config
        end
    end

    %% Database and External
    DB[(Database)]:::db
    OAuth["OAuth Providers"]:::external

    %% Connections
    Browser -->|"HTTP GET/Navigation"| HomePage
    Browser -->|"HTTP GET"| About
    Browser -->|"HTTP GET"| RecipeList
    Browser -->|"HTTP GET"| RecipeDetail
    Browser -->|"HTTP GET"| LoginPage
    Browser -->|"HTTP GET"| SignupPage
    Browser -->|"HTTP GET"| NotFound
    Browser -->|"Fetch Static"| Img1
    Browser -->|"Fetch Static"| Img2

    HomePage -->|"uses Components"| Banner
    HomePage -->|"uses Components"| Navbar
    HomePage -->|"fetches Data"| LoginAction
    LoginPage -->|"POST credentials"| AuthRoute
    SignupPage -->|"POST data"| AuthRoute
    AuthRoute -->|"calls"| LoginAction
    AuthRoute -->|"uses"| AuthConfig
    LoginAction -->|"reads/writes"| UserModel
    AuthRoute -->|"queries"| UserModel
    LoginAction -->|"uses Utils"| UtilsLib
    UtilsLib -->|"reads"| DataFile
    UtilsLib -->|"calls"| Helpers
    AuthRoute -->|"calls external"| OAuth
    LoginAction --> DB
    UserModel --> DB

    %% Click Events
    click Layout "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/layout.tsx"
    click GlobalsCSS "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/globals.css"
    click HomePage "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/page.tsx"
    click About "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/aboutus/page.tsx"
    click LoginPage "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/login/page.tsx"
    click SignupPage "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/signup/page.tsx"
    click RecipeList "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/recipe/page.tsx"
    click RecipeDetail "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/recipe/[id]/page.tsx"
    click NotFound "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/not-found.tsx"

    click AuthRoute "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/app/api/auth/[...nextauth]/route.ts"
    click AuthConfig "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/auth.ts"

    click Banner "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/Banner/index.tsx"
    click Category "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/Category/index.tsx"
    click Footer "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/Footer/index.tsx"
    click ImageArticle "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/ImageArticle/index.tsx"
    click MostSearched "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/MostSeachedRecipes/index.tsx"
    click Navbar "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/Navbar/index.tsx"
    click Recent "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/RecentRecipes/index.tsx"
    click SearchComp "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/Search/index.tsx"
    click FormComp "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/client/form.tsx"

    click Button "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/ui/button.tsx"
    click Card "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/ui/card.tsx"
    click InputUI "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/ui/input.tsx"
    click SonnerUI "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/components/ui/sonner.tsx"

    click LoginAction "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/actions/login.ts"
    click UtilsLib "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/lib/utils.ts"
    click DataFile "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/utils/data.js"
    click Helpers "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/utils/helpers.js"

    click UserModel "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/src/models/userModel.ts"

    click Img1 "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/public/images/image-article.avif"
    click Img2 "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/public/images/image-article2.avif"

    click NextConfig "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/next.config.mjs"
    click Tailwind "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/tailwind.config.ts"
    click PostCSS "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/postcss.config.mjs"
    click TSConf "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/tsconfig.json"
    click ESLint "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/.eslintrc.json"
    click Package "https://github.com/rajender-01/food-recipe-app-using-next-js/blob/master/package.json"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px
    classDef db fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#000,stroke-width:1px
    classDef cdn fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#000,stroke-width:1px
```
