# vyshnavi536/laurus-agent architecture

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

- Interactive diagram: https://gitdiagram.com/vyshnavi536/laurus-agent
- Repository: https://github.com/vyshnavi536/laurus-agent

## Overview

Laurus is a pharmaceutical intelligence chat application. Users sign up or log in, then submit a drug question or two-drug interaction query; the backend identifies the drugs, retrieves FDA label data or checks interaction sources, and returns a formatted AI-assisted response. Authenticated chat history is presented in the UI and can be deleted or cleared. The README documents these capabilities; sampled source confirms the query and integration logic, while route implementation details and some frontend screens were not sampled, so uncertain internal wiring is omitted.

Main entry points: [`frontend/src/pages/Chat.jsx`](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/pages/Chat.jsx) (Chat page), [`backend/services/langchain_service.py`](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/langchain_service.py) (Query processing), [`frontend/src/services/api.js`](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/App.jsx) (App routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_login["Login and signup<br/>[Login.jsx]"]
  node_chatui["Chat page<br/>[Chat.jsx]"]
  node_chatbox["Message display<br/>[ChatBox.jsx]"]
  node_sidebar["History sidebar<br/>[Sidebar.jsx]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_apiapp["FastAPI app<br/>[main.py]"]
  node_auth["Auth routes<br/>[auth.py]"]
  node_chatroute["Chat and history routes<br/>[chat.py]"]
  node_models["User and history models<br/>[models.py]"]
end

subgraph group_intelligence["Drug intelligence"]
  node_processor["Query processing"]
  node_fda["Drug label lookup<br/>[openfda_service.py]"]
  node_interaction["Interaction analysis"]
end

subgraph group_data["Data and integrations"]
  node_database[("SQLite database<br/>[database.py]")]
  node_dataset["Kaggle DDI data"]
  node_gemini{{"Google Gemini"}}
  node_openfda{{"OpenFDA service"}}
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes"| node_login
node_app -->|"routes"| node_chatui
node_chatui -->|"displays"| node_chatbox
node_chatui -->|"renders"| node_sidebar
node_login -->|"submits credentials"| node_client
node_chatui -->|"sends queries"| node_client
node_chatui -->|"requests history"| node_client
node_client -->|"HTTP requests"| node_apiapp
node_apiapp -->|"registers routes"| node_auth
node_apiapp -->|"registers routes"| node_chatroute
node_auth -->|"reads and writes users"| node_database
node_chatroute -->|"stores history"| node_database
node_chatroute -->|"processes query"| node_processor
node_processor -->|"looks up drug"| node_fda
node_processor -->|"checks pair"| node_interaction
node_fda -->|"normalizes names"| node_interaction
node_fda -->|"fetches label"| node_openfda
node_interaction -->|"reads interactions"| node_dataset
node_processor -->|"extracts and summarizes"| node_gemini

click node_app "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/pages/Login.jsx"
click node_chatui "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/pages/Chat.jsx"
click node_chatbox "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/components/ChatBox.jsx"
click node_sidebar "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/components/Sidebar.jsx"
click node_client "https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/services/api.js"
click node_apiapp "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/main.py"
click node_auth "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/routes/auth.py"
click node_chatroute "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/routes/chat.py"
click node_models "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/models.py"
click node_database "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/database.py"
click node_processor "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/langchain_service.py"
click node_fda "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/openfda_service.py"
click node_interaction "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/interaction_service.py"
click node_dataset "https://github.com/vyshnavi536/laurus-agent/blob/main/backend/kaggle_interactions.csv"

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_login,node_chatui,node_chatbox,node_sidebar,node_client,node_user toneBlue
class node_apiapp,node_auth,node_chatroute,node_models toneAmber
class node_processor,node_fda,node_interaction toneMint
class node_database,node_dataset,node_gemini,node_openfda toneRose
```

## Components

### Web application

- [App routing](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login and signup](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Chat page](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Message display](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/components/ChatBox.jsx): `frontend/src/components/ChatBox.jsx`
- [History sidebar](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/components/Sidebar.jsx): `frontend/src/components/Sidebar.jsx`
- [API client](https://github.com/vyshnavi536/laurus-agent/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and identity

- [FastAPI app](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/main.py): `backend/main.py`
- [Auth routes](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Chat and history routes](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/routes/chat.py): `backend/routes/chat.py`
- [User and history models](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/models.py): `backend/models.py`

### Drug intelligence

- [Query processing](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/langchain_service.py): `backend/services/langchain_service.py`
- [Drug label lookup](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/openfda_service.py): `backend/services/openfda_service.py`
- [Interaction analysis](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/services/interaction_service.py): `backend/services/interaction_service.py`

### Data and integrations

- [SQLite database](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/database.py): `backend/database.py`
- [Kaggle DDI data](https://github.com/vyshnavi536/laurus-agent/blob/main/backend/kaggle_interactions.csv): `backend/kaggle_interactions.csv`
- **Google Gemini**
- **OpenFDA service**

### Other components

- **User**

## Connections

- User → App routing: uses
- App routing → Login and signup: routes
- App routing → Chat page: routes
- Chat page → Message display: displays
- Chat page → History sidebar: renders
- Login and signup → API client: submits credentials
- Chat page → API client: sends queries
- Chat page → API client: requests history
- API client → FastAPI app: HTTP requests
- FastAPI app → Auth routes: registers routes
- FastAPI app → Chat and history routes: registers routes
- Auth routes → SQLite database: reads and writes users
- Chat and history routes → SQLite database: stores history
- Chat and history routes → Query processing: processes query
- Query processing → Drug label lookup: looks up drug
- Query processing → Interaction analysis: checks pair
- Drug label lookup → Interaction analysis: normalizes names
- Drug label lookup → OpenFDA service: fetches label
- Interaction analysis → Kaggle DDI data: reads interactions
- Query processing → Google Gemini: extracts and summarizes
