# parthjadhav85/stashbox architecture

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

- Interactive diagram: https://gitdiagram.com/parthjadhav85/stashbox
- Repository: https://github.com/parthjadhav85/stashbox

## Overview

StashBox is a full-stack bookmark workspace: users authenticate, save and enrich links, organize them in nested collections, then search and manage bookmarks in the responsive application. The graph follows the documented browser-to-REST-to-Supabase architecture and the sampled route/controller wiring. README-described UI capabilities are grouped under the workspace because their individual implementations were not sampled; database authorization and schema details are documented, but no schema source appears in the tree.

Main entry points: [`server/config/supabase.js`](https://github.com/parthjadhav85/stashbox/blob/main/server/config/supabase.js) (Supabase client), [`server/server.js`](https://github.com/parthjadhav85/stashbox/blob/main/server/server.js) (Express API), [`server/middleware/authMiddleware.js`](https://github.com/parthjadhav85/stashbox/blob/main/server/middleware/authMiddleware.js) (JWT authentication), [`client/src/App.jsx`](https://github.com/parthjadhav85/stashbox/blob/main/client/src/App.jsx) (React SPA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React application"]
  node_spa["React SPA<br/>[App.jsx]"]
  node_authui["Auth screens"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_workspace["Bookmark workspace"]
  node_apiclient["API client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_server["Express API<br/>[server.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_collectionroutes["Collection routes"]
  node_bookmarkroutes["Bookmark routes<br/>[bookmarkRoutes.js]"]
  node_authguard["JWT authentication<br/>[authMiddleware.js]"]
  node_authcontroller["Account operations<br/>[authController.js]"]
  node_collectioncontroller["Collection operations"]
  node_bookmarkcontroller["Bookmark operations"]
  node_scraper["Metadata scraper<br/>[metadataScraper.js]"]
  node_supabaseconfig["Supabase client<br/>[supabase.js]"]
end

subgraph group_services["External services"]
  node_supabase[("Supabase Auth and PostgreSQL")]
end

node_user(("Browser user"))
node_webpages(("Bookmark webpages"))

node_user -->|"uses"| node_spa
node_spa -->|"routes to"| node_authui
node_spa -->|"opens protected"| node_workspace
node_authui -->|"authenticates via"| node_authstate
node_authstate -->|"requests"| node_apiclient
node_workspace -->|"requests"| node_apiclient
node_apiclient -->|"sends REST"| node_server
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_collectionroutes
node_server -->|"mounts"| node_bookmarkroutes
node_authroutes -->|"guards protected routes"| node_authguard
node_collectionroutes -->|"guards routes"| node_authguard
node_bookmarkroutes -->|"guards routes"| node_authguard
node_authroutes -->|"dispatches"| node_authcontroller
node_collectionroutes -->|"dispatches"| node_collectioncontroller
node_bookmarkroutes -->|"dispatches"| node_bookmarkcontroller
node_authcontroller -->|"uses"| node_supabaseconfig
node_collectioncontroller -->|"uses"| node_supabaseconfig
node_bookmarkcontroller -->|"uses"| node_supabaseconfig
node_authguard -->|"validates token"| node_supabaseconfig
node_supabaseconfig -->|"accesses"| node_supabase
node_bookmarkcontroller -->|"extracts metadata"| node_scraper
node_scraper -->|"fetches page data"| node_webpages

click node_spa "https://github.com/parthjadhav85/stashbox/blob/main/client/src/App.jsx"
click node_authui "https://github.com/parthjadhav85/stashbox/tree/main/client/src/components/auth"
click node_authstate "https://github.com/parthjadhav85/stashbox/blob/main/client/src/context/AuthContext.jsx"
click node_workspace "https://github.com/parthjadhav85/stashbox/tree/main/client/src/components/layout"
click node_apiclient "https://github.com/parthjadhav85/stashbox/blob/main/client/src/api/api.js"
click node_server "https://github.com/parthjadhav85/stashbox/blob/main/server/server.js"
click node_authroutes "https://github.com/parthjadhav85/stashbox/blob/main/server/routes/authRoutes.js"
click node_collectionroutes "https://github.com/parthjadhav85/stashbox/blob/main/server/routes/collectionRoutes.js"
click node_bookmarkroutes "https://github.com/parthjadhav85/stashbox/blob/main/server/routes/bookmarkRoutes.js"
click node_authguard "https://github.com/parthjadhav85/stashbox/blob/main/server/middleware/authMiddleware.js"
click node_authcontroller "https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/authController.js"
click node_collectioncontroller "https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/collectionController.js"
click node_bookmarkcontroller "https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/bookmarkController.js"
click node_scraper "https://github.com/parthjadhav85/stashbox/blob/main/server/utils/metadataScraper.js"
click node_supabaseconfig "https://github.com/parthjadhav85/stashbox/blob/main/server/config/supabase.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_spa,node_authui,node_authstate,node_workspace,node_apiclient,node_user toneBlue
class node_server,node_authroutes,node_collectionroutes,node_bookmarkroutes,node_authguard,node_authcontroller,node_collectioncontroller,node_bookmarkcontroller,node_scraper,node_supabaseconfig toneAmber
class node_supabase toneMint
class node_webpages toneIndigo
```

## Components

### React application

- [React SPA](https://github.com/parthjadhav85/stashbox/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth screens](https://github.com/parthjadhav85/stashbox/tree/main/client/src/components/auth): `client/src/components/auth`
- [Auth state](https://github.com/parthjadhav85/stashbox/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Bookmark workspace](https://github.com/parthjadhav85/stashbox/tree/main/client/src/components/layout): `client/src/components/layout`
- [API client](https://github.com/parthjadhav85/stashbox/blob/main/client/src/api/api.js): `client/src/api/api.js`

### REST API

- [Express API](https://github.com/parthjadhav85/stashbox/blob/main/server/server.js): `server/server.js`
- [Auth routes](https://github.com/parthjadhav85/stashbox/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Collection routes](https://github.com/parthjadhav85/stashbox/blob/main/server/routes/collectionRoutes.js): `server/routes/collectionRoutes.js`
- [Bookmark routes](https://github.com/parthjadhav85/stashbox/blob/main/server/routes/bookmarkRoutes.js): `server/routes/bookmarkRoutes.js`
- [JWT authentication](https://github.com/parthjadhav85/stashbox/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`
- [Account operations](https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Collection operations](https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/collectionController.js): `server/controllers/collectionController.js`
- [Bookmark operations](https://github.com/parthjadhav85/stashbox/blob/main/server/controllers/bookmarkController.js): `server/controllers/bookmarkController.js`
- [Metadata scraper](https://github.com/parthjadhav85/stashbox/blob/main/server/utils/metadataScraper.js): `server/utils/metadataScraper.js`
- [Supabase client](https://github.com/parthjadhav85/stashbox/blob/main/server/config/supabase.js): `server/config/supabase.js`

### External services

- **Supabase Auth and PostgreSQL**

### Other components

- **Browser user**
- **Bookmark webpages**

## Connections

- Browser user → React SPA: uses
- React SPA → Auth screens: routes to
- React SPA → Bookmark workspace: opens protected
- Auth screens → Auth state: authenticates via
- Auth state → API client: requests
- Bookmark workspace → API client: requests
- API client → Express API: sends REST
- Express API → Auth routes: mounts
- Express API → Collection routes: mounts
- Express API → Bookmark routes: mounts
- Auth routes → JWT authentication: guards protected routes
- Collection routes → JWT authentication: guards routes
- Bookmark routes → JWT authentication: guards routes
- Auth routes → Account operations: dispatches
- Collection routes → Collection operations: dispatches
- Bookmark routes → Bookmark operations: dispatches
- Account operations → Supabase client: uses
- Collection operations → Supabase client: uses
- Bookmark operations → Supabase client: uses
- JWT authentication → Supabase client: validates token
- Supabase client → Supabase Auth and PostgreSQL: accesses
- Bookmark operations → Metadata scraper: extracts metadata
- Metadata scraper → Bookmark webpages: fetches page data
