# jaiswalbishal/docflow architecture

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

- Interactive diagram: https://gitdiagram.com/jaiswalbishal/docflow
- Repository: https://github.com/jaiswalbishal/docflow

## Overview

DocFlow is a collaborative document workspace. Users register or log in, then manage documents from the dashboard and open them in an editor to edit, share, export, or summarize; public links and search provide additional discovery paths. The backend routes requests through Express controllers to MongoDB models, with Socket.IO supporting real-time presence and collaboration. The README lists the broader feature set; some route/controller and client service implementations were not sampled, so their links are documented at subsystem level where possible.

Main entry points: [`server/src/controllers/documentController.js`](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/documentController.js) (Document operations), [`server/src/models/Document.js`](https://github.com/jaiswalbishal/docflow/blob/main/server/src/models/Document.js) (Document records), [`client/src/App.jsx`](https://github.com/jaiswalbishal/docflow/blob/main/client/src/App.jsx) (Route application), [`server/src/routes/documentRoutes.js`](https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/documentRoutes.js) (Document routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workspace client"]
  node_app["Route application<br/>[App.jsx]"]
  node_auth_ui["Login and registration<br/>[Login.jsx]"]
  node_auth_state["Session state<br/>[AuthContext.jsx]"]
  node_dashboard["Document dashboard<br/>[Dashboard.jsx]"]
  node_editor["Document editor<br/>[Editor.jsx]"]
  node_public_view["Public document view<br/>[PublicDocument.jsx]"]
  node_feedback["Toast and confirmation<br/>[ToastContext.jsx]"]
  node_doc_client["Document API client<br/>[documentService.js]"]
  node_auth_client["Authentication client<br/>[authService.js]"]
  node_api_config["API configuration<br/>[api.js]"]
end

subgraph group_api["API and domain"]
  node_express["HTTP application<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_document_routes["Document routes<br/>[documentRoutes.js]"]
  node_public_routes["Public routes<br/>[publicRoutes.js]"]
  node_search_routes["Search routes<br/>[searchRoutes.js]"]
  node_auth_controller["Authentication handlers<br/>[authController.js]"]
  node_document_controller["Document operations"]
  node_export_controller["Document exports"]
  node_search_controller["Document search"]
  node_user_controller["User profile<br/>[userController.js]"]
  node_auth_middleware["JWT authorization<br/>[authMiddleware.js]"]
  node_ai["AI summary service<br/>[aiService.js]"]
end

subgraph group_realtime["Live collaboration"]
  node_socket_client["Socket client<br/>[socket.js]"]
  node_socket_service["Socket collaboration<br/>[socketService.js]"]
end

subgraph group_persistence["Persistence"]
  node_document_model[("Document records<br/>[Document.js]")]
  node_user_model[("User records<br/>[User.js]")]
end

node_user(("Workspace user"))
node_mongo[("MongoDB")]

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_auth_ui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_editor
node_app -->|"routes to"| node_public_view
node_auth_ui -->|"submits credentials"| node_auth_client
node_auth_client -.->|"uses API"| node_api_config
node_auth_client -.->|"calls API"| node_auth_routes
node_auth_controller -->|"reads and writes"| node_user_model
node_auth_ui -.->|"sets session"| node_auth_state
node_dashboard -->|"manages documents"| node_doc_client
node_editor -->|"edits and shares"| node_doc_client
node_doc_client -->|"uses API"| node_api_config
node_doc_client -.->|"calls API"| node_document_routes
node_public_view -.->|"fetches shared view"| node_public_routes
node_document_routes -->|"requires auth"| node_auth_middleware
node_search_routes -->|"requires auth"| node_auth_middleware
node_auth_routes -->|"dispatches"| node_auth_controller
node_document_routes -->|"dispatches"| node_document_controller
node_document_routes -->|"dispatches exports"| node_export_controller
node_public_routes -->|"dispatches"| node_document_controller
node_search_routes -->|"dispatches"| node_search_controller
node_document_controller -->|"reads and writes"| node_document_model
node_document_controller -->|"looks up collaborators"| node_user_model
node_search_controller -->|"searches"| node_document_model
node_export_controller -->|"reads documents"| node_document_model
node_document_controller -->|"requests summary"| node_ai
node_document_controller -->|"stores summary"| node_document_model
node_express -->|"mounts"| node_auth_routes
node_express -->|"mounts"| node_document_routes
node_express -->|"mounts"| node_public_routes
node_express -->|"mounts"| node_search_routes
node_socket_client -.->|"exchanges events"| node_socket_service
node_socket_service -->|"uses document data"| node_document_model
node_document_model -.->|"persists"| node_mongo
node_user_model -.->|"persists"| node_mongo
node_feedback -.->|"supports actions"| node_editor

click node_app "https://github.com/jaiswalbishal/docflow/blob/main/client/src/App.jsx"
click node_auth_ui "https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Login.jsx"
click node_auth_state "https://github.com/jaiswalbishal/docflow/blob/main/client/src/contexts/AuthContext.jsx"
click node_dashboard "https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Dashboard.jsx"
click node_editor "https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Editor.jsx"
click node_public_view "https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/PublicDocument.jsx"
click node_feedback "https://github.com/jaiswalbishal/docflow/blob/main/client/src/contexts/ToastContext.jsx"
click node_doc_client "https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/documentService.js"
click node_auth_client "https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/authService.js"
click node_api_config "https://github.com/jaiswalbishal/docflow/blob/main/client/src/config/api.js"
click node_express "https://github.com/jaiswalbishal/docflow/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/authRoutes.js"
click node_document_routes "https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/documentRoutes.js"
click node_public_routes "https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/publicRoutes.js"
click node_search_routes "https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/searchRoutes.js"
click node_auth_controller "https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/authController.js"
click node_document_controller "https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/documentController.js"
click node_export_controller "https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/exportController.js"
click node_search_controller "https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/searchController.js"
click node_user_controller "https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/userController.js"
click node_auth_middleware "https://github.com/jaiswalbishal/docflow/blob/main/server/src/middleware/authMiddleware.js"
click node_ai "https://github.com/jaiswalbishal/docflow/blob/main/server/src/services/aiService.js"
click node_socket_client "https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/socket.js"
click node_socket_service "https://github.com/jaiswalbishal/docflow/blob/main/server/src/services/socketService.js"
click node_document_model "https://github.com/jaiswalbishal/docflow/blob/main/server/src/models/Document.js"
click node_user_model "https://github.com/jaiswalbishal/docflow/blob/main/server/src/models/User.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_app,node_auth_ui,node_auth_state,node_dashboard,node_editor,node_public_view,node_feedback,node_doc_client,node_auth_client,node_api_config,node_user toneBlue
class node_express,node_auth_routes,node_document_routes,node_public_routes,node_search_routes,node_auth_controller,node_document_controller,node_export_controller,node_search_controller,node_user_controller,node_auth_middleware,node_ai,node_mongo toneAmber
class node_socket_client,node_socket_service toneMint
class node_document_model,node_user_model toneRose
```

## Components

### Workspace client

- [Route application](https://github.com/jaiswalbishal/docflow/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Login and registration](https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Session state](https://github.com/jaiswalbishal/docflow/blob/main/client/src/contexts/AuthContext.jsx): `client/src/contexts/AuthContext.jsx`
- [Document dashboard](https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Document editor](https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/Editor.jsx): `client/src/pages/Editor.jsx`
- [Public document view](https://github.com/jaiswalbishal/docflow/blob/main/client/src/pages/PublicDocument.jsx): `client/src/pages/PublicDocument.jsx`
- [Toast and confirmation](https://github.com/jaiswalbishal/docflow/blob/main/client/src/contexts/ToastContext.jsx): `client/src/contexts/ToastContext.jsx`
- [Document API client](https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/documentService.js): `client/src/services/documentService.js`
- [Authentication client](https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/authService.js): `client/src/services/authService.js`
- [API configuration](https://github.com/jaiswalbishal/docflow/blob/main/client/src/config/api.js): `client/src/config/api.js`

### API and domain

- [HTTP application](https://github.com/jaiswalbishal/docflow/blob/main/server/src/app.js): `server/src/app.js`
- [Authentication routes](https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/authRoutes.js): `server/src/routes/authRoutes.js`
- [Document routes](https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/documentRoutes.js): `server/src/routes/documentRoutes.js`
- [Public routes](https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/publicRoutes.js): `server/src/routes/publicRoutes.js`
- [Search routes](https://github.com/jaiswalbishal/docflow/blob/main/server/src/routes/searchRoutes.js): `server/src/routes/searchRoutes.js`
- [Authentication handlers](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [Document operations](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/documentController.js): `server/src/controllers/documentController.js`
- [Document exports](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/exportController.js): `server/src/controllers/exportController.js`
- [Document search](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/searchController.js): `server/src/controllers/searchController.js`
- [User profile](https://github.com/jaiswalbishal/docflow/blob/main/server/src/controllers/userController.js): `server/src/controllers/userController.js`
- [JWT authorization](https://github.com/jaiswalbishal/docflow/blob/main/server/src/middleware/authMiddleware.js): `server/src/middleware/authMiddleware.js`
- [AI summary service](https://github.com/jaiswalbishal/docflow/blob/main/server/src/services/aiService.js): `server/src/services/aiService.js`

### Live collaboration

- [Socket client](https://github.com/jaiswalbishal/docflow/blob/main/client/src/services/socket.js): `client/src/services/socket.js`
- [Socket collaboration](https://github.com/jaiswalbishal/docflow/blob/main/server/src/services/socketService.js): `server/src/services/socketService.js`

### Persistence

- [Document records](https://github.com/jaiswalbishal/docflow/blob/main/server/src/models/Document.js): `server/src/models/Document.js`
- [User records](https://github.com/jaiswalbishal/docflow/blob/main/server/src/models/User.js): `server/src/models/User.js`

### Other components

- **Workspace user**
- **MongoDB**

## Connections

- Workspace user → Route application: opens (evidence: `client/src/App.jsx`)
- Route application → Login and registration: routes to (evidence: `client/src/App.jsx`)
- Route application → Document dashboard: routes to (evidence: `client/src/App.jsx`)
- Route application → Document editor: routes to (evidence: `client/src/App.jsx`)
- Route application → Public document view: routes to (evidence: `client/src/App.jsx`)
- Login and registration → Authentication client: submits credentials (evidence: `client/src/pages/Login.jsx`)
- Authentication client → API configuration: uses API
- Authentication client → Authentication routes: calls API
- Authentication handlers → User records: reads and writes (evidence: `server/src/controllers/authController.js`)
- Login and registration → Session state: sets session (evidence: `client/src/pages/Login.jsx`)
- Document dashboard → Document API client: manages documents (evidence: `client/src/pages/Dashboard.jsx`)
- Document editor → Document API client: edits and shares (evidence: `client/src/pages/Editor.jsx`)
- Document API client → API configuration: uses API (evidence: `client/src/services/documentService.js`)
- Document API client → Document routes: calls API
- Public document view → Public routes: fetches shared view
- Document routes → JWT authorization: requires auth (evidence: `server/src/routes/documentRoutes.js`)
- Search routes → JWT authorization: requires auth (evidence: `server/src/routes/searchRoutes.js`)
- Authentication routes → Authentication handlers: dispatches (evidence: `server/src/routes/authRoutes.js`)
- Document routes → Document operations: dispatches (evidence: `server/src/routes/documentRoutes.js`)
- Document routes → Document exports: dispatches exports (evidence: `server/src/routes/documentRoutes.js`)
- Public routes → Document operations: dispatches (evidence: `server/src/routes/publicRoutes.js`)
- Search routes → Document search: dispatches (evidence: `server/src/routes/searchRoutes.js`)
- Document operations → Document records: reads and writes (evidence: `server/src/controllers/documentController.js`)
- Document operations → User records: looks up collaborators (evidence: `server/src/controllers/documentController.js`)
- Document search → Document records: searches (evidence: `server/src/controllers/searchController.js`)
- Document exports → Document records: reads documents (evidence: `server/src/controllers/exportController.js`)
- Document operations → AI summary service: requests summary (evidence: `server/src/controllers/documentController.js`)
- Document operations → Document records: stores summary (evidence: `server/src/controllers/documentController.js`)
- HTTP application → Authentication routes: mounts (evidence: `server/src/app.js`)
- HTTP application → Document routes: mounts (evidence: `server/src/app.js`)
- HTTP application → Public routes: mounts (evidence: `server/src/app.js`)
- HTTP application → Search routes: mounts (evidence: `server/src/app.js`)
- Socket client → Socket collaboration: exchanges events
- Socket collaboration → Document records: uses document data (evidence: `server/src/services/socketService.js`)
- Document records → MongoDB: persists
- User records → MongoDB: persists
- Toast and confirmation → Document editor: supports actions (evidence: `client/src/pages/Editor.jsx`)
