# nortey-micheal/zestify architecture

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

- Interactive diagram: https://gitdiagram.com/nortey-micheal/zestify
- Repository: https://github.com/nortey-micheal/zestify

## Overview

##### Project type and purpose
- This is a full-stack web application called “Zestify,” designed for recipe sharing.
- Frontend: React (TypeScript) + Tailwind CSS, state managed via Redux Toolkit.
- Backend: Node.js + Express.js, REST API endpoints for user and recipe operations.
- Persistence: MongoDB for data; Cloudinary for image storage; Resend for email.
- Auth: JWT + bcrypt; email verification flow via Resend.

##### File structure
- Top-level split: /frontend and /backend.
- Backend organizes code by concern:
- controllers/ – business logic for recipes & users
- routes/ – Express routers for API endpoints
- models/ – Mongoose schemas for Recipe and User
- middleware/ – JWT verification
- utils/ – token generators
- cloudinary/ – image upload helper
- resend/ – email templates & senders
- Frontend follows a feature-slice structure:
- src/pages/ – page components with routing wrappers
- src/components/ – UI & feature components
- src/hooks/ – custom React hooks for API calls
- src/redux/ – state slices for recipes & users
- build config: vite.config.ts, tsconfig, .env

##### Key insights from the README
- Calls out API calls for signup, login, posting & fetching recipes.
- Highlights Cloudinary and Resend integrations.
- Emphasizes search, filters, dark mode.

## Diagram (Mermaid)

```mermaid
flowchart LR
    %% Frontend Layer
    subgraph "React SPA" 
        direction TB
        Pages["Pages"]:::frontend
        UIComp["UI Components"]:::frontend
        FeatureComp["Feature Components"]:::frontend
        Hooks["Custom Hooks"]:::frontend
        Store["Redux Store"]:::frontend
        RootReducer["Root Reducer"]:::frontend
        SlicesRec["Recipe State Slices"]:::frontend
        SlicesUser["User State Slices"]:::frontend
        Vite["Vite Configuration"]:::frontend
    end

    %% Backend Layer
    subgraph "Express API" 
        direction TB
        Server["server.js"]:::backend

        subgraph "Routes"
            direction TB
            URoutes["User API Routes"]:::backend
            RRoutes["Recipe API Routes"]:::backend
        end

        subgraph "Controllers"
            direction TB
            UCtrl["User Controller"]:::backend
            RCtrl["Recipe Controller"]:::backend
        end

        subgraph "Middleware"
            direction TB
            Auth["verifyToken"]:::backend
        end

        subgraph "Models"
            direction TB
            UModel["User Model"]:::backend
            RModel["Recipe Model"]:::backend
        end

        subgraph "Utils"
            direction TB
            JWTUtil["generateJWTtoken"]:::backend
            VERUtil["generateVerificationToken"]:::backend
        end

        Upload["Cloudinary Helper"]:::backend
        EmailSend["Email Senders"]:::backend
        EmailTemp["Email Templates"]:::backend
    end

    %% Persistence & External Services
    subgraph "Persistence & Externals"
        direction TB
        Mongo["MongoDB"]:::database
        CloudinaryExt["Cloudinary"]:::external
        ResendExt["Resend"]:::external
    end

    %% Connections
    Pages -->|"uses Hooks"| Hooks
    FeatureComp --> Hooks
    Hooks -->|"dispatch Actions"| Store
    Store -->|"Root Reducer"| RootReducer
    Store -->|"uses Slices"| SlicesRec
    Store -->|"uses Slices"| SlicesUser
    Vite --> Pages

    Store -->|"HTTPS" | Server
    UIComp -->|"HTTPS"| Server

    Server --> URoutes
    Server --> RRoutes
    URoutes --> UCtrl
    RRoutes --> RCtrl
    URoutes --> Auth
    RRoutes --> Auth
    UCtrl --> UModel
    RCtrl --> RModel
    UCtrl --> JWTUtil
    UCtrl --> VERUtil
    RCtrl --> Upload
    Upload --> CloudinaryExt
    CloudinaryExt --> Upload
    RCtrl --> RModel

    Server -->|"queries"| Mongo
    UModel --> Mongo
    RModel --> Mongo

    UCtrl --> EmailSend
    EmailSend --> EmailTemp
    EmailSend --> ResendExt
    ResendExt -->|-->| Server

    %% Click Events
    click Pages "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/pages"
    click UIComp "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/components/ui"
    click FeatureComp "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/components"
    click Hooks "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/hooks"
    click Store "https://github.com/nortey-micheal/zestify/blob/main/frontend/src/redux/store.ts"
    click RootReducer "https://github.com/nortey-micheal/zestify/blob/main/frontend/src/redux/rootReducer.ts"
    click SlicesRec "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/redux/recipe"
    click SlicesUser "https://github.com/nortey-micheal/zestify/tree/main/frontend/src/redux/user"
    click Vite "https://github.com/nortey-micheal/zestify/blob/main/frontend/vite.config.ts"
    click Server "https://github.com/nortey-micheal/zestify/blob/main/backend/server.js"
    click URoutes "https://github.com/nortey-micheal/zestify/blob/main/backend/routes/userRoutes.js"
    click RRoutes "https://github.com/nortey-micheal/zestify/blob/main/backend/routes/recipeRoutes.js"
    click UCtrl "https://github.com/nortey-micheal/zestify/blob/main/backend/controllers/userController.js"
    click RCtrl "https://github.com/nortey-micheal/zestify/blob/main/backend/controllers/recipeController.js"
    click Auth "https://github.com/nortey-micheal/zestify/blob/main/backend/middleware/verifyToken.js"
    click UModel "https://github.com/nortey-micheal/zestify/blob/main/backend/models/userModel.js"
    click RModel "https://github.com/nortey-micheal/zestify/blob/main/backend/models/recipeModel.js"
    click JWTUtil "https://github.com/nortey-micheal/zestify/blob/main/backend/utils/generateJWTtoken.js"
    click VERUtil "https://github.com/nortey-micheal/zestify/blob/main/backend/utils/generateVerificationToken.js"
    click Upload "https://github.com/nortey-micheal/zestify/blob/main/backend/cloudinary/cloudinary.js"
    click EmailSend "https://github.com/nortey-micheal/zestify/blob/main/backend/resend/email/signupEmail.js"
    click EmailTemp "https://github.com/nortey-micheal/zestify/blob/main/backend/resend/template/signupTemplate.js"

    %% Classes
    classDef frontend fill:#D0E8F2,stroke:#0366d6,color:#0366d6
    classDef backend fill:#F2D0D0,stroke:#d73a49,color:#d73a49
    classDef database fill:#D0F2D0,stroke:#28a745,color:#28a745
    classDef external fill:#F2E0B0,stroke:#e36209,color:#e36209
```
