# ayush859/memostack architecture

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

- Interactive diagram: https://gitdiagram.com/ayush859/memostack
- Repository: https://github.com/ayush859/memostack

## Overview

##### Project type and purpose
- MEMOSTACK is a full-stack web application for uploading, storing, searching and viewing PDF “notes.”
- The client is a React single-page application (SPA) with Redux for state management, Vite for bundling, Tailwind CSS for styling.
- The server is a Node.js/Express REST API using a Controllers-Models-Routes (MVC) pattern and MongoDB (via Mongoose) for data persistence. It also serves static files (PDFs) from the filesystem.

##### File structure
Top level:
- client/ – React frontend
– src/ (App.jsx, pages/, components/, Redux store & slices)
– public/, index.html, Vite & PostCSS configs, Tailwind config
- server/ – Express backend
– Controllers/ (AuthController.js, NotesController.js)
– Models/ (User.js, Notes.js)
– Routes/ (auth.js, notes.js)
– files/ (uploaded PDFs), images/, index.js (app entry)
Patterns & configs:
- MVC on server (Models/Controllers/Routes)
- Redux pattern on client (store + slices)
- Static asset serving (server/files + server/images)
- NPM scripts & nodemon for development

##### README
- Confirms a two-folder setup requiring separate `npm install` and start commands for server (nodemon index.js) and client (`npm run dev`).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        direction TB
        Main["main.jsx"]:::frontend
        App["App.jsx"]:::frontend
        Store["store.js"]:::frontend
        UserSlice["user-slice.js"]:::frontend
        subgraph "Pages" 
            direction TB
            Home["Home.jsx"]:::frontend
            Search["Search.jsx"]:::frontend
            Upload["Upload.jsx"]:::frontend
            Login["Login.jsx"]:::frontend
            Signup["Signup.jsx"]:::frontend
            Profile["Profile.jsx"]:::frontend
            About["About.jsx"]:::frontend
            FAQ["Faq.jsx"]:::frontend
        end
        subgraph "Components"
            direction TB
            Header["Header.jsx"]:::frontend
            Footer["Footer.jsx"]:::frontend
            Hero["Hero.jsx"]:::frontend
            SearchBar["SearchBar.jsx"]:::frontend
            UploadForm["UploadNote.jsx"]:::frontend
        end
        subgraph "Configs"
            direction TB
            Tailwind["tailwind.config.js"]:::config
            PostCSS["postcss.config.js"]:::config
            Vite["vite.config.js"]:::config
        end
    end

    %% Backend Layer
    subgraph "Backend (Express API)"
        direction TB
        Index["index.js"]:::backend
        subgraph "Routes"
            direction TB
            AuthRoutes["auth.js"]:::backend
            NotesRoutes["notes.js"]:::backend
        end
        subgraph "Controllers"
            direction TB
            AuthController["AuthController.js"]:::backend
            NotesController["NotesController.js"]:::backend
        end
        subgraph "Models"
            direction TB
            UserModel["User.js"]:::backend
            NotesModel["Notes.js"]:::backend
        end
        Files["server/files"]:::storage
        Images["server/images"]:::storage
    end

    %% External Systems
    MongoDB["MongoDB"]:::db

    %% Interactions
    User["User Browser"]:::external
    User -->|"loads SPA"| Main
    Main -->|renders| App
    App -->|dispatches actions| Store
    Store -->|includes slice| UserSlice
    App -->|uses| Home
    App -->|uses| Search
    App -->|uses| Upload
    App -->|uses| Login
    App -->|uses| Signup
    App -->|uses| Profile
    App -->|uses| About
    App -->|uses| FAQ
    App -->|renders| Header
    App -->|renders| Footer
    App -->|renders| Hero
    Search -->|uses| SearchBar
    Upload -->|uses| UploadForm

    App -->|"REST calls"| Index
    Index -->|routes to| AuthRoutes
    Index -->|routes to| NotesRoutes
    AuthRoutes -->|invokes| AuthController
    NotesRoutes -->|invokes| NotesController
    AuthController -->|uses| UserModel
    NotesController -->|uses| NotesModel
    AuthController -->|reads/writes| MongoDB
    NotesController -->|reads/writes| MongoDB
    NotesController -->|reads/writes| Files

    %% External DB and Storage
    UserModel -->|persists| MongoDB
    NotesModel -->|persists| MongoDB

    %% Click Events - Frontend
    click Main "https://github.com/ayush859/memostack/blob/master/client/src/main.jsx"
    click App "https://github.com/ayush859/memostack/blob/master/client/src/App.jsx"
    click Store "https://github.com/ayush859/memostack/blob/master/client/src/Redux/store.js"
    click UserSlice "https://github.com/ayush859/memostack/blob/master/client/src/Redux/slices/user-slice.js"
    click Home "https://github.com/ayush859/memostack/blob/master/client/src/pages/Home.jsx"
    click Search "https://github.com/ayush859/memostack/blob/master/client/src/pages/Search.jsx"
    click Upload "https://github.com/ayush859/memostack/blob/master/client/src/pages/Upload.jsx"
    click Login "https://github.com/ayush859/memostack/blob/master/client/src/pages/Login.jsx"
    click Signup "https://github.com/ayush859/memostack/blob/master/client/src/pages/Signup.jsx"
    click Profile "https://github.com/ayush859/memostack/blob/master/client/src/pages/Profile.jsx"
    click About "https://github.com/ayush859/memostack/blob/master/client/src/pages/About.jsx"
    click FAQ "https://github.com/ayush859/memostack/blob/master/client/src/pages/Faq.jsx"
    click Header "https://github.com/ayush859/memostack/blob/master/client/src/components/Header.jsx"
    click Footer "https://github.com/ayush859/memostack/blob/master/client/src/components/Footer.jsx"
    click Hero "https://github.com/ayush859/memostack/blob/master/client/src/components/Hero.jsx"
    click SearchBar "https://github.com/ayush859/memostack/blob/master/client/src/components/SearchBar.jsx"
    click UploadForm "https://github.com/ayush859/memostack/blob/master/client/src/components/UploadNote.jsx"
    click Tailwind "https://github.com/ayush859/memostack/blob/master/client/tailwind.config.js"
    click PostCSS "https://github.com/ayush859/memostack/blob/master/client/postcss.config.js"
    click Vite "https://github.com/ayush859/memostack/blob/master/client/vite.config.js"

    %% Click Events - Backend
    click Index "https://github.com/ayush859/memostack/blob/master/server/index.js"
    click AuthController "https://github.com/ayush859/memostack/blob/master/server/Controllers/AuthController.js"
    click NotesController "https://github.com/ayush859/memostack/blob/master/server/Controllers/NotesController.js"
    click AuthRoutes "https://github.com/ayush859/memostack/blob/master/server/Routes/auth.js"
    click NotesRoutes "https://github.com/ayush859/memostack/blob/master/server/Routes/notes.js"
    click UserModel "https://github.com/ayush859/memostack/blob/master/server/Models/User.js"
    click NotesModel "https://github.com/ayush859/memostack/blob/master/server/Models/Notes.js"
    click Files "https://github.com/ayush859/memostack/tree/master/server/files"
    click Images "https://github.com/ayush859/memostack/tree/master/server/images"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#DFFFE0,stroke:#28a745,color:#28a745;
    classDef db fill:#FFE8D0,stroke:#d2691e,color:#d2691e;
    classDef storage fill:#F0F0F0,stroke:#888888,color:#555555;
    classDef config fill:#F3E8FF,stroke:#8a2be2,color:#8a2be2;
    classDef external fill:#FFFFFF,stroke:#000000,color:#000000,stroke-dasharray: 5 5;
```
