# helloworldbyprince/ai-projects-nodejs architecture

> Architecture diagram of the GitHub repository helloworldbyprince/ai-projects-nodejs, 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/helloworldbyprince/ai-projects-nodejs
- Repository: https://github.com/helloworldbyprince/ai-projects-nodejs

## Overview

This repository’s implemented product is a Node.js PDF question-answering backend. A client uploads a PDF and question; the server extracts and chunks the text, embeds the chunks, stores them in Qdrant, searches for a matching chunk, and asks Gemini to answer from that context. A separate endpoint creates the Qdrant collection. These responsibilities are implemented in one server file, so the graph distinguishes runtime stages rather than implying separate modules. The source excerpt supports the shown calls; it does not show a client or additional product subsystems.

Main entry points: [`chat-with-pdf/server/index.js`](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js) (PDF upload route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_server["Express server<br/>[index.js]"]
  node_upload["PDF upload route<br/>[index.js]"]
  node_collection["Collection route<br/>[index.js]"]
end

subgraph group_rag["PDF RAG"]
  node_extract["PDF extraction<br/>[index.js]"]
  node_chunks["Text chunking<br/>[index.js]"]
  node_embedding["Embedding helper<br/>[index.js]"]
  node_search["Vector retrieval<br/>[index.js]"]
  node_answer["Answer generation<br/>[index.js]"]
end

subgraph group_services["External services"]
  node_gemini["Gemini API"]
  node_qdrant[("Qdrant vector store")]
end

node_client(("Client"))

node_client -->|"sends requests"| node_server
node_server -->|"routes upload"| node_upload
node_server -->|"routes creation"| node_collection
node_upload -->|"parses PDF"| node_extract
node_extract -->|"provides text"| node_chunks
node_upload -->|"embeds chunks"| node_embedding
node_embedding -->|"requests embeddings"| node_gemini
node_upload -->|"upserts points"| node_qdrant
node_upload -->|"embeds question"| node_embedding
node_upload -->|"searches vectors"| node_search
node_search -->|"queries store"| node_qdrant
node_search -->|"supplies matching text"| node_answer
node_upload -->|"provides question"| node_answer
node_answer -->|"generates answer"| node_gemini
node_upload -->|"sends answer"| node_client
node_collection -->|"creates collection"| node_qdrant

click node_server "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_upload "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_collection "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_extract "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_chunks "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_embedding "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_search "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js"
click node_answer "https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.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_upload,node_collection,node_client toneBlue
class node_extract,node_chunks,node_embedding,node_search,node_answer toneAmber
class node_gemini,node_qdrant toneMint
```

## Components

### HTTP API

- [Express server](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [PDF upload route](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [Collection route](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`

### PDF RAG

- [PDF extraction](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [Text chunking](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [Embedding helper](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [Vector retrieval](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`
- [Answer generation](https://github.com/helloworldbyprince/ai-projects-nodejs/blob/main/chat-with-pdf/server/index.js): `chat-with-pdf/server/index.js`

### External services

- **Gemini API**
- **Qdrant vector store**

### Other components

- **Client**

## Connections

- Client → Express server: sends requests (evidence: `chat-with-pdf/server/index.js`)
- Express server → PDF upload route: routes upload (evidence: `chat-with-pdf/server/index.js`)
- Express server → Collection route: routes creation (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → PDF extraction: parses PDF (evidence: `chat-with-pdf/server/index.js`)
- PDF extraction → Text chunking: provides text (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Embedding helper: embeds chunks (evidence: `chat-with-pdf/server/index.js`)
- Embedding helper → Gemini API: requests embeddings (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Qdrant vector store: upserts points (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Embedding helper: embeds question (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Vector retrieval: searches vectors (evidence: `chat-with-pdf/server/index.js`)
- Vector retrieval → Qdrant vector store: queries store (evidence: `chat-with-pdf/server/index.js`)
- Vector retrieval → Answer generation: supplies matching text (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Answer generation: provides question (evidence: `chat-with-pdf/server/index.js`)
- Answer generation → Gemini API: generates answer (evidence: `chat-with-pdf/server/index.js`)
- PDF upload route → Client: sends answer (evidence: `chat-with-pdf/server/index.js`)
- Collection route → Qdrant vector store: creates collection (evidence: `chat-with-pdf/server/index.js`)
