# spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026 architecture

> Architecture diagram of the GitHub repository spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026
- Repository: https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026

## Overview

This is a Node.js/Express multi-user blogging API backed by MongoDB. A client reaches the server, which mounts authentication, post, and comment routes; route handlers apply JWT authentication where configured, use Mongoose models, and return API responses. The sampled implementation supports registration/login, post listing and creation, post likes, and comments. User profiles are represented in the User model, but no profile-management route appears in the repository tree. Relationships below follow the sampled calls and server wiring; MongoDB is the documented persistence service.

Main entry points: [`server.js`](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/server.js) (Express server), [`routes/auth.js`](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/auth.js) (Authentication routes), [`routes/posts.js`](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/posts.js) (Post routes), [`routes/comments.js`](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/comments.js) (Comment routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_server["Express server<br/>[server.js]"]
end

subgraph group_features["API features"]
  node_auth_route["Authentication routes<br/>[auth.js]"]
  node_posts_route["Post routes<br/>[posts.js]"]
  node_comments_route["Comment routes<br/>[comments.js]"]
  node_auth_middleware["JWT middleware<br/>[auth.js]"]
end

subgraph group_data["Data layer"]
  node_user_model["User model<br/>[User.js]"]
  node_post_model["Post model<br/>[Post.js]"]
  node_comment_model["Comment model<br/>[Comment.js]"]
  node_db_connection["DB connection<br/>[db.js]"]
end

node_client(("API client"))
node_mongodb[("MongoDB")]
node_bcrypt["Password hashing"]
node_jwt["JWT library"]

node_client -->|"sends requests"| node_server
node_server -->|"connects database"| node_db_connection
node_db_connection -->|"opens connection"| node_mongodb
node_server -->|"mounts routes"| node_auth_route
node_server -->|"mounts routes"| node_posts_route
node_server -->|"mounts routes"| node_comments_route
node_auth_route -->|"queries and saves"| node_user_model
node_auth_route -->|"hashes passwords"| node_bcrypt
node_auth_route -->|"signs tokens"| node_jwt
node_posts_route -->|"guards writes"| node_auth_middleware
node_posts_route -->|"queries and saves"| node_post_model
node_comments_route -->|"guards creation"| node_auth_middleware
node_comments_route -->|"queries and saves"| node_comment_model
node_auth_middleware -->|"verifies tokens"| node_jwt

click node_server "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/server.js"
click node_auth_route "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/auth.js"
click node_posts_route "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/posts.js"
click node_comments_route "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/comments.js"
click node_auth_middleware "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/middleware/auth.js"
click node_user_model "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/User.js"
click node_post_model "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/Post.js"
click node_comment_model "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/Comment.js"
click node_db_connection "https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/config/db.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_server,node_client toneBlue
class node_auth_route,node_posts_route,node_comments_route,node_auth_middleware,node_mongodb toneAmber
class node_user_model,node_post_model,node_comment_model,node_db_connection toneMint
class node_bcrypt,node_jwt toneIndigo
```

## Components

### API entry

- [Express server](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/server.js): `server.js`

### API features

- [Authentication routes](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/auth.js): `routes/auth.js`
- [Post routes](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/posts.js): `routes/posts.js`
- [Comment routes](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/routes/comments.js): `routes/comments.js`
- [JWT middleware](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/middleware/auth.js): `middleware/auth.js`

### Data layer

- [User model](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/User.js): `models/User.js`
- [Post model](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/Post.js): `models/Post.js`
- [Comment model](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/models/Comment.js): `models/Comment.js`
- [DB connection](https://github.com/spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026/blob/main/config/db.js): `config/db.js`

### Other components

- **API client**
- **MongoDB**
- **Password hashing**
- **JWT library**

## Connections

- API client → Express server: sends requests (evidence: `server.js`)
- Express server → DB connection: connects database (evidence: `server.js`)
- DB connection → MongoDB: opens connection (evidence: `config/db.js`)
- Express server → Authentication routes: mounts routes (evidence: `server.js`)
- Express server → Post routes: mounts routes (evidence: `server.js`)
- Express server → Comment routes: mounts routes (evidence: `server.js`)
- Authentication routes → User model: queries and saves (evidence: `routes/auth.js`)
- Authentication routes → Password hashing: hashes passwords (evidence: `routes/auth.js`)
- Authentication routes → JWT library: signs tokens (evidence: `routes/auth.js`)
- Post routes → JWT middleware: guards writes (evidence: `routes/posts.js`)
- Post routes → Post model: queries and saves (evidence: `routes/posts.js`)
- Comment routes → JWT middleware: guards creation (evidence: `routes/comments.js`)
- Comment routes → Comment model: queries and saves (evidence: `routes/comments.js`)
- JWT middleware → JWT library: verifies tokens (evidence: `middleware/auth.js`)
