# nanosof/rag-jira-confluence-using-ai architecture

> Architecture diagram of the GitHub repository nanosof/rag-jira-confluence-using-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nanosof/rag-jira-confluence-using-ai
- Repository: https://github.com/nanosof/rag-jira-confluence-using-ai

## Overview

#### Purpose and entry points
This is a containerizable enterprise RAG service for ingesting Confluence/Jira content, indexing it locally, and answering grounded questions through a FastAPI web/API interface. Runtime entry point is `main.py`; deployment is defined by `Dockerfile` and `docker-compose.yml`.

#### API and application orchestration
`main.py` hosts FastAPI/Uvicorn, serves the chat UI at `/`, accepts prompts at `POST /api/chat`, and triggers ingestion at `POST /api/sync`. It is the boundary between browser/API clients and the RAG/indexing subsystems.
- `main.py`
- `rag_engine.py`
- `scheduler.py`

#### Source synchronization and crawling
The crawler layer connects to Confluence and Jira APIs using configured service credentials, retrieves documentation and related content, and feeds normalized source material into indexing. There are two crawler-named modules, suggesting the `.p.py` variant may be an alternate/prototype implementation and should be reconciled before extending crawl behavior.
- `confluence_crawler.py`
- `confluence_crawler.p.py`
- `scheduler.py`

#### Content extraction and multimodal enrichment
Raw page content is transformed into retrieval-ready text. This includes preserving HTML tables as Markdown and processing attached/embedded media. Diagram and architecture-image analysis is delegated to Anthropic Claude Vision, producing searchable textual descriptions rather than storing only opaque image assets.
- `media_processor.py`
- `confluence_crawler.py`
- `chunker.py`

#### Chunking and embedding pipeline
Extracted text is segmented into chunks before embedding. SentenceTransformers with the local `all-MiniLM-L6-v2` model generates vectors, separating local semantic indexing from cloud LLM/vision calls. The sync pipeline should be treated as the write path into the knowledge base.
- `chunker.py`
- `rag_engine.py`
- `database.py`

#### Local vector persistence and retrieval
SQLite plus sqlite-vec is the embedded persistence and nearest-neighbor retrieval boundary. It provides durable local vector search, likely persisted via Docker volumes, and avoids an external vector database. Retrieval results are passed to the RAG engine as the only intended evidence base for answers.
- `database.py`
- `rag_engine.py`
- `docker-compose.yml`

#### Grounded answer generation
`rag_engine.py` implements the query path: embed the user prompt, retrieve relevant chunks, construct grounded context, and call Claude 3.5 Sonnet for the final response. The principal trust boundary is between retrieved internal content and the external Anthropic API: prompts should constrain generation to retrieved evidence.
- `rag_engine.py`
- `database.py`
- `main.py`

#### Background operation and infrastructure
APScheduler drives recurring refreshes so source changes can be reflected without user requests; `/api/sync` provides a manual equivalent. Material external services are Confluence/Jira APIs and Anthropic’s API. Python 3.11+, FastAPI/Uvicorn, SentenceTransformers, SQLite/sqlite-vec, and Docker Compose form the operational stack.
- `scheduler.py`
- `requirements.txt`
- `.env.example`

Main entry points: [`rag_engine.py`](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/rag_engine.py) (RAG engine), [`confluence_crawler.py`](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/confluence_crawler.py) (Confluence/Jira crawler), [`main.py`](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/main.py) (FastAPI service), [`.env.example`](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/.env.example) (Service credentials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API &amp; orchestration"]
  node_client(("Browser / API client"))
  node_main["FastAPI service<br/>api entry point<br/>[main.py]"]
  node_scheduler["Recurring sync scheduler<br/>APScheduler job<br/>[scheduler.py]"]
end

subgraph group_sync["Sync write path"]
  node_crawler["Confluence/Jira crawler<br/>source connector"]
  node_crawler_alt["Alternate crawler<br/>prototype connector"]
  node_media["Media enrichment<br/>content processor<br/>[media_processor.py]"]
  node_chunker["Text chunker<br/>indexing stage<br/>[chunker.py]"]
end

subgraph group_knowledge["Local knowledge base"]
  node_embeddings{{"MiniLM embeddings<br/>local embedding model"}}
  node_database[("SQLite + sqlite-vec<br/>vector store<br/>[database.py]")]
  node_compose["Docker Compose<br/>deployment<br/>[docker-compose.yml]"]
end

subgraph group_answer["Grounded answer path"]
  node_rag["RAG engine<br/>query and indexing orchestration<br/>[rag_engine.py]"]
end

subgraph group_external["External services"]
  node_sources{{"Confluence &amp; Jira<br/>content APIs"}}
  node_vision{{"Claude Vision<br/>external vision API"}}
  node_claude{{"Claude 3.5 Sonnet<br/>external LLM API"}}
  node_env["Service credentials<br/>environment configuration<br/>[.env.example]"]
end

node_client -->|"chat and sync requests"| node_main
node_main -->|"starts recurring refresh"| node_scheduler
node_main -->|"manual /api/sync"| node_crawler
node_scheduler -->|"scheduled sync"| node_crawler
node_crawler -->|"fetches content"| node_sources
node_crawler_alt -.->|"alternate implementation"| node_sources
node_crawler -->|"embedded media"| node_media
node_media -->|"image analysis"| node_vision
node_media -->|"enriched text"| node_chunker
node_crawler -->|"normalized pages"| node_chunker
node_chunker -->|"chunks for indexing"| node_rag
node_rag -->|"embeds chunks and prompts"| node_embeddings
node_rag -->|"writes chunks and vectors"| node_database
node_database -->|"retrieved evidence"| node_rag
node_main -->|"chat prompt"| node_rag
node_rag -->|"grounded context and prompt"| node_claude
node_rag -->|"answer"| node_main
node_compose -->|"persistent volume"| node_database
node_env -.->|"source credentials"| node_crawler
node_env -.->|"API credential"| node_vision
node_env -.->|"API credential"| node_claude

click node_main "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/main.py"
click node_scheduler "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/scheduler.py"
click node_crawler "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/confluence_crawler.py"
click node_crawler_alt "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/confluence_crawler.p.py"
click node_media "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/media_processor.py"
click node_chunker "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/chunker.py"
click node_database "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/database.py"
click node_rag "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/rag_engine.py"
click node_compose "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/docker-compose.yml"
click node_env "https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/.env.example"

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_client,node_main,node_scheduler toneBlue
class node_crawler,node_crawler_alt,node_media,node_chunker toneAmber
class node_embeddings,node_database,node_compose toneMint
class node_rag toneRose
class node_sources,node_vision,node_claude,node_env toneIndigo
```

## Components

### API & orchestration

- **Browser / API client**: client
- [FastAPI service](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/main.py): api entry point · Serves chat UI plus chat and manual-sync endpoints. · `main.py`
- [Recurring sync scheduler](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/scheduler.py): APScheduler job · `scheduler.py`

### Sync write path

- [Confluence/Jira crawler](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/confluence_crawler.py): source connector · `confluence_crawler.py`
- [Alternate crawler](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/confluence_crawler.p.py): prototype connector · Crawler variant that should be reconciled before extension. · `confluence_crawler.p.py`
- [Media enrichment](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/media_processor.py): content processor · Converts diagrams and architecture images into searchable text. · `media_processor.py`
- [Text chunker](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/chunker.py): indexing stage · Preserves tables as Markdown and segments extracted content. · `chunker.py`

### Local knowledge base

- **MiniLM embeddings**: local embedding model · SentenceTransformers all-MiniLM-L6-v2.
- [SQLite + sqlite-vec](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/database.py): vector store · Durable local chunk and nearest-neighbor index. · `database.py`
- [Docker Compose](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/docker-compose.yml): deployment · Provides container runtime and persistent local storage. · `docker-compose.yml`

### Grounded answer path

- [RAG engine](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/rag_engine.py): query and indexing orchestration · Indexes chunks and answers only from retrieved evidence. · `rag_engine.py`

### External services

- **Confluence & Jira**: content APIs
- **Claude Vision**: external vision API
- **Claude 3.5 Sonnet**: external LLM API · Generates final grounded responses.
- [Service credentials](https://github.com/nanosof/rag-jira-confluence-using-ai/blob/main/.env.example): environment configuration · Credentials for source systems and Anthropic. · `.env.example`

## Connections

- Browser / API client → FastAPI service: chat and sync requests
- FastAPI service → Recurring sync scheduler: starts recurring refresh
- FastAPI service → Confluence/Jira crawler: manual /api/sync
- Recurring sync scheduler → Confluence/Jira crawler: scheduled sync
- Confluence/Jira crawler → Confluence & Jira: fetches content
- Alternate crawler → Confluence & Jira: alternate implementation
- Confluence/Jira crawler → Media enrichment: embedded media
- Media enrichment → Claude Vision: image analysis
- Media enrichment → Text chunker: enriched text
- Confluence/Jira crawler → Text chunker: normalized pages
- Text chunker → RAG engine: chunks for indexing
- RAG engine → MiniLM embeddings: embeds chunks and prompts
- RAG engine → SQLite + sqlite-vec: writes chunks and vectors
- SQLite + sqlite-vec → RAG engine: retrieved evidence
- FastAPI service → RAG engine: chat prompt
- RAG engine → Claude 3.5 Sonnet: grounded context and prompt
- RAG engine → FastAPI service: answer
- Docker Compose → SQLite + sqlite-vec: persistent volume
- Service credentials → Confluence/Jira crawler: source credentials
- Service credentials → Claude Vision: API credential
- Service credentials → Claude 3.5 Sonnet: API credential
