# shubhamsharmayo/notes-app architecture

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

- Interactive diagram: https://gitdiagram.com/shubhamsharmayo/notes-app
- Repository: https://github.com/shubhamsharmayo/notes-app

## Overview

##### Main Components
- Frontend (Client):
- Contains configuration files (Vercel, Vite) and public assets.
- The “client” directory is structured to separate concerns such as styling (CSS files), routing, assets, and context management.
- Backend (Server):
- Built with Node.js using Express.js.
- Contains API endpoints (for authentication and profile management) within the “server/api” and “server/routes” directories.
- Manages middleware (like token verification) and models (Schema definitions for Signup, tasks) which likely link to MongoDB via Mongoose (as mentioned in the README).
- Persistent Data Storage:
- Although not directly visible in the file tree, the README specifies a MongoDB database which is used to store notes and user data.
- Hosting & Deployment:
- The frontend is deployed on Vercel.
- The backend can be deployed on Vercel or any Node.js-supported hosting service.

##### Relationships and Interactions
- The client-side React application communicates with the backend via HTTP using Axios. This includes making API calls for CRUD operations on notes.
- Backend routes (such as /notes) receive these API calls, process business logic, and interact with the database.
- Middleware like verifyToken in the server ensures that user credentials and session integrity are maintained before allowing access to sensitive endpoints.
- The backend models represent the data structures stored in MongoDB, and they are used in routes to create, read, update, or delete data as needed.
- Environment configuration (using .env files) is required to link the backend to the MongoDB instance and the frontend to the backend API URL.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly separated (client vs. server) promotes modularity and maintainability.
- MVC (or a variation): The server directory’s structure (models, routes, middleware) follows an MVC-like approach for handling data and business logic.
- Component-Based UI: The React frontend uses a component-based architecture to promote reuse and separation of UI concerns.
- RESTful API Design: The endpoints described in the README indicate a REST-based interaction model.

##### Elements
- Components Breakdown:
- Under Frontend:
- Under Backend:
- Config & Deployment Details:
- A note or small section to indicate configuration files (.env usage) and the deployment targets (Vercel for frontend, cloud platform for backend).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend (React Application)
    subgraph "Frontend (React Application)"
        FE["Frontend (React)"]:::frontend
        subgraph "User Interface (React Components)"
            UI["UI Components"]:::frontend
            Login["Login Component"]:::frontend
            Signup["Signup Component"]:::frontend
            Dashboard["Dashboard"]:::frontend
            Notes["Notes Display"]:::frontend
            StarNotes["StarNotes Component"]:::frontend
            Star["Star Component"]:::frontend
            Starred["Starred Component"]:::frontend
            DeleteIcon["SVG Delete Icon"]:::frontend
            EditIcon["SVG Edit Icon"]:::frontend
        end
        Context["State Management/Context"]:::frontend
        subgraph "Assets & Config"
            PublicAssets["Public Assets"]:::frontend
            VercelConfig["vercel.json"]:::frontend
            ViteConfig["vite.config.js"]:::frontend
        end
    end

    %% Backend (Node.js/Express Application)
    subgraph "Backend (Node.js/Express Application)"
        BE["Backend (Node.js)"]:::backend
        API["API Endpoints"]:::backend
        Routes["RESTful Routes"]:::backend
        Middleware["Middleware (verifyToken)"]:::backend
        Models["Data Models"]:::backend
        SignupModel["Signup Model"]:::backend
        TasksModel["Tasks Model"]:::backend
    end

    %% Database (MongoDB)
    DB["Database (MongoDB)"]:::db

    %% Frontend internal connections
    FE --> UI
    UI --> Login
    UI --> Signup
    UI --> Dashboard
    UI --> Notes
    UI --> StarNotes
    UI --> Star
    UI --> Starred
    UI --> DeleteIcon
    UI --> EditIcon
    FE --> Context
    FE --> PublicAssets
    FE --> VercelConfig
    FE --> ViteConfig

    %% Frontend to Backend communication
    Dashboard ---|"HTTPRequests"| API
    Notes ---|"HTTPRequests"| API

    %% Backend internal flow
    BE --> API
    API --> Routes
    API --> Middleware
    Routes --> Models
    Models --> SignupModel
    Models --> TasksModel
    Models --> DB

    %% Click Events for Frontend
    click FE "https://github.com/shubhamsharmayo/notes-app/tree/main/client/"
    click UI "https://github.com/shubhamsharmayo/notes-app/tree/main/client/src/components/"
    click Login "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/Login/Login.jsx"
    click Signup "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/Signup/Signup.jsx"
    click Dashboard "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/dashboard/Dashboard.jsx"
    click Notes "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/notes/Notes.jsx"
    click StarNotes "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/StarNotes/Starnotes.jsx"
    click Star "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/star/Star.jsx"
    click Starred "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/starred/Starred.jsx"
    click DeleteIcon "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/svg/Delete.jsx"
    click EditIcon "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/components/svg/Edit.jsx"
    click Context "https://github.com/shubhamsharmayo/notes-app/blob/main/client/src/Context/Context.jsx"
    click PublicAssets "https://github.com/shubhamsharmayo/notes-app/tree/main/client/public"
    click VercelConfig "https://github.com/shubhamsharmayo/notes-app/blob/main/client/vercel.json"
    click ViteConfig "https://github.com/shubhamsharmayo/notes-app/blob/main/client/vite.config.js"

    %% Click Events for Backend
    click BE "https://github.com/shubhamsharmayo/notes-app/tree/main/server/"
    click API "https://github.com/shubhamsharmayo/notes-app/blob/main/server/api/index.js"
    click Routes "https://github.com/shubhamsharmayo/notes-app/blob/main/server/routes/auth.js"
    click Middleware "https://github.com/shubhamsharmayo/notes-app/blob/main/server/middleware/verifyToken.js"
    click Models "https://github.com/shubhamsharmayo/notes-app/tree/main/server/models/"
    click SignupModel "https://github.com/shubhamsharmayo/notes-app/blob/main/server/models/Signup.js"
    click TasksModel "https://github.com/shubhamsharmayo/notes-app/blob/main/server/models/tasks.js"

    %% Styling classes
    classDef frontend fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef db fill:#FFE0B2,stroke:#E65100,stroke-width:2px;
```
