# oliviatoratti/ai-project architecture

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

- Interactive diagram: https://gitdiagram.com/oliviatoratti/ai-project
- Repository: https://github.com/oliviatoratti/ai-project

## Overview

Nexus is a personal publishing app. Readers browse articles, while authors register or log in, draft posts, optionally request an AI summary, publish, and view their posts. The React router connects these screens to an Express API; that API handles authentication and post operations using Mongoose models, and can call OpenAI for summaries. The excerpts show the main routes and client requests; the README documents MongoDB and the broader product scope. The graph does not infer unshown client behavior or treat JWT handling as a separate service.

Main entry points: [`server/server.js`](https://github.com/oliviatoratti/ai-project/blob/main/server/server.js) (API routes), [`client/src/App.jsx`](https://github.com/oliviatoratti/ai-project/blob/main/client/src/App.jsx) (App routing), [`client/src/pages/CreatePost.jsx`](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/CreatePost.jsx) (Post editor), [`client/src/pages/Register.jsx`](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Register.jsx) (Registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React client"]
  node_app["App routing<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_create["Post editor<br/>[CreatePost.jsx]"]
  node_my_posts["Personal posts<br/>[MyPosts.jsx]"]
  node_article["Article view<br/>[Article.jsx]"]
end

subgraph group_api["Express API"]
  node_api_server["API routes<br/>[server.js]"]
end

subgraph group_data["Mongoose models"]
  node_user_model[("User model<br/>[User.js]")]
  node_post_model[("Post model<br/>[Post.js]")]
end

subgraph group_ai["AI summaries"]
end

node_author(("Author / reader"))
node_mongodb[("MongoDB")]
node_openai{{"OpenAI API"}}

node_author -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_login
node_app -->|"protects route"| node_create
node_app -->|"protects route"| node_my_posts
node_app -->|"routes to"| node_article
node_register -->|"registers via"| node_api_server
node_login -->|"logs in via"| node_api_server
node_create -->|"publishes via"| node_api_server
node_create -->|"requests summary"| node_api_server
node_my_posts -->|"loads posts"| node_api_server
node_article -->|"loads article"| node_api_server
node_api_server -->|"reads and writes"| node_user_model
node_api_server -->|"reads and writes"| node_post_model
node_api_server -->|"connects to"| node_mongodb
node_api_server -->|"requests summary"| node_openai

click node_app "https://github.com/oliviatoratti/ai-project/blob/main/client/src/App.jsx"
click node_home "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Home.jsx"
click node_register "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Register.jsx"
click node_login "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Login.jsx"
click node_create "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/CreatePost.jsx"
click node_my_posts "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/MyPosts.jsx"
click node_article "https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Article.jsx"
click node_api_server "https://github.com/oliviatoratti/ai-project/blob/main/server/server.js"
click node_user_model "https://github.com/oliviatoratti/ai-project/blob/main/server/models/User.js"
click node_post_model "https://github.com/oliviatoratti/ai-project/blob/main/server/models/Post.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_home,node_register,node_login,node_create,node_my_posts,node_article toneBlue
class node_api_server,node_mongodb toneAmber
class node_user_model,node_post_model,node_openai toneMint
class node_author toneIndigo
```

## Components

### React client

- [App routing](https://github.com/oliviatoratti/ai-project/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Home](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Home.jsx): `client/src/pages/Home.jsx`
- [Registration](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Register.jsx): `client/src/pages/Register.jsx`
- [Login](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Post editor](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/CreatePost.jsx): `client/src/pages/CreatePost.jsx`
- [Personal posts](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/MyPosts.jsx): `client/src/pages/MyPosts.jsx`
- [Article view](https://github.com/oliviatoratti/ai-project/blob/main/client/src/pages/Article.jsx): `client/src/pages/Article.jsx`

### Express API

- [API routes](https://github.com/oliviatoratti/ai-project/blob/main/server/server.js): `server/server.js`

### Mongoose models

- [User model](https://github.com/oliviatoratti/ai-project/blob/main/server/models/User.js): `server/models/User.js`
- [Post model](https://github.com/oliviatoratti/ai-project/blob/main/server/models/Post.js): `server/models/Post.js`

### Other components

- **Author / reader**
- **MongoDB**
- **OpenAI API**

## Connections

- Author / reader → App routing: uses (evidence: `client/src/App.jsx`)
- App routing → Home: routes to (evidence: `client/src/App.jsx`)
- App routing → Registration: routes to (evidence: `client/src/App.jsx`)
- App routing → Login: routes to (evidence: `client/src/App.jsx`)
- App routing → Post editor: protects route (evidence: `client/src/App.jsx`)
- App routing → Personal posts: protects route (evidence: `client/src/App.jsx`)
- App routing → Article view: routes to (evidence: `client/src/App.jsx`)
- Registration → API routes: registers via (evidence: `client/src/pages/Register.jsx`)
- Login → API routes: logs in via (evidence: `client/src/pages/Login.jsx`)
- Post editor → API routes: publishes via (evidence: `client/src/pages/CreatePost.jsx`)
- Post editor → API routes: requests summary (evidence: `client/src/pages/CreatePost.jsx`)
- Personal posts → API routes: loads posts (evidence: `client/src/pages/MyPosts.jsx`)
- Article view → API routes: loads article (evidence: `client/src/pages/Article.jsx`)
- API routes → User model: reads and writes (evidence: `server/server.js`)
- API routes → Post model: reads and writes (evidence: `server/server.js`)
- API routes → MongoDB: connects to (evidence: `server/server.js`)
- API routes → OpenAI API: requests summary (evidence: `server/server.js`)
