# ogacu/lexis-agent architecture

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

- Interactive diagram: https://gitdiagram.com/ogacu/lexis-agent
- Repository: https://github.com/ogacu/lexis-agent

## Overview

Lexis is a personal AI platform whose implemented workflow is vocabulary capture, optional AI enrichment, editing and filtering, and persistent storage. The frontend calls a gateway, which proxies vocabulary requests to the service; the service can also sync changes to Notion. Investment research is documented and has API client and gateway surfaces, but its UI and service implementation are not present in the supplied tree. Connections reflect the excerpts and README; unsampled investment internals are not inferred.

Main entry points: [`frontend/src/app/vocab/page.tsx`](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/app/vocab/page.tsx) (Vocabulary page), [`services/vocab-service/main.py`](https://github.com/ogacu/lexis-agent/blob/main/services/vocab-service/main.py) (Vocabulary service), [`services/api-gateway/main.py`](https://github.com/ogacu/lexis-agent/blob/main/services/api-gateway/main.py) (API gateway), [`frontend/src/lib/api.ts`](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_vocab_page["Vocabulary page<br/>[page.tsx]"]
  node_add_form["Add word form<br/>[AddWordForm.tsx]"]
  node_word_list["Word list<br/>[WordList.tsx]"]
  node_word_card["Word card<br/>[WordCard.tsx]"]
end

subgraph group_api["API layer"]
  node_api_client["API client<br/>[api.ts]"]
  node_gateway["API gateway<br/>[main.py]"]
  node_investment_api["Investment API surface<br/>[api.ts]"]
end

subgraph group_vocab["Vocabulary domain"]
  node_vocab_service["Vocabulary service<br/>[main.py]"]
end

subgraph group_integrations["Data and integrations"]
  node_database[("PostgreSQL<br/>[init.sql]")]
  node_anthropic{{"Anthropic API"}}
  node_notion_sync["Notion sync<br/>[notion_sync.py]"]
  node_notion{{"Notion"}}
  node_investment_service["Investment service"]
end

node_user(("User"))

node_user -->|"uses"| node_vocab_page
node_vocab_page -->|"renders"| node_add_form
node_vocab_page -->|"renders"| node_word_list
node_word_list -->|"renders"| node_word_card
node_vocab_page -->|"loads words"| node_api_client
node_word_card -->|"updates words"| node_api_client
node_add_form -.->|"adds words"| node_api_client
node_api_client -->|"HTTP requests"| node_gateway
node_gateway -->|"proxies vocab"| node_vocab_service
node_vocab_service -->|"reads and writes"| node_database
node_vocab_service -->|"generates definitions"| node_anthropic
node_vocab_service -->|"queues sync"| node_notion_sync
node_notion_sync -->|"syncs pages"| node_notion
node_user -.->|"uses"| node_investment_api
node_investment_api -->|"HTTP requests"| node_gateway
node_gateway -->|"proxies invest"| node_investment_service

click node_vocab_page "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/app/vocab/page.tsx"
click node_add_form "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/AddWordForm.tsx"
click node_word_list "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/WordList.tsx"
click node_word_card "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/WordCard.tsx"
click node_api_client "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/lib/api.ts"
click node_gateway "https://github.com/ogacu/lexis-agent/blob/main/services/api-gateway/main.py"
click node_vocab_service "https://github.com/ogacu/lexis-agent/blob/main/services/vocab-service/main.py"
click node_database "https://github.com/ogacu/lexis-agent/blob/main/db/init.sql"
click node_notion_sync "https://github.com/ogacu/lexis-agent/blob/main/services/vocab-service/notion_sync.py"
click node_investment_api "https://github.com/ogacu/lexis-agent/blob/main/frontend/src/lib/api.ts"

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_vocab_page,node_add_form,node_word_list,node_word_card,node_user toneBlue
class node_api_client,node_gateway,node_investment_api toneAmber
class node_vocab_service toneMint
class node_database,node_anthropic,node_notion_sync,node_notion,node_investment_service toneRose
```

## Components

### Web app

- [Vocabulary page](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/app/vocab/page.tsx): `frontend/src/app/vocab/page.tsx`
- [Add word form](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/AddWordForm.tsx): `frontend/src/components/vocab/AddWordForm.tsx`
- [Word list](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/WordList.tsx): `frontend/src/components/vocab/WordList.tsx`
- [Word card](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/components/vocab/WordCard.tsx): `frontend/src/components/vocab/WordCard.tsx`

### API layer

- [API client](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [API gateway](https://github.com/ogacu/lexis-agent/blob/main/services/api-gateway/main.py): `services/api-gateway/main.py`
- [Investment API surface](https://github.com/ogacu/lexis-agent/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Vocabulary domain

- [Vocabulary service](https://github.com/ogacu/lexis-agent/blob/main/services/vocab-service/main.py): `services/vocab-service/main.py`

### Data and integrations

- [PostgreSQL](https://github.com/ogacu/lexis-agent/blob/main/db/init.sql): `db/init.sql`
- **Anthropic API**
- [Notion sync](https://github.com/ogacu/lexis-agent/blob/main/services/vocab-service/notion_sync.py): `services/vocab-service/notion_sync.py`
- **Notion**
- **Investment service**

### Other components

- **User**

## Connections

- User → Vocabulary page: uses
- Vocabulary page → Add word form: renders (evidence: `frontend/src/app/vocab/page.tsx`)
- Vocabulary page → Word list: renders (evidence: `frontend/src/app/vocab/page.tsx`)
- Word list → Word card: renders (evidence: `frontend/src/components/vocab/WordList.tsx`)
- Vocabulary page → API client: loads words (evidence: `frontend/src/app/vocab/page.tsx`)
- Word card → API client: updates words (evidence: `frontend/src/components/vocab/WordCard.tsx`)
- Add word form → API client: adds words
- API client → API gateway: HTTP requests (evidence: `frontend/src/lib/api.ts`)
- API gateway → Vocabulary service: proxies vocab (evidence: `services/api-gateway/main.py`)
- Vocabulary service → PostgreSQL: reads and writes (evidence: `services/vocab-service/main.py`)
- Vocabulary service → Anthropic API: generates definitions (evidence: `services/vocab-service/main.py`)
- Vocabulary service → Notion sync: queues sync (evidence: `services/vocab-service/main.py`)
- Notion sync → Notion: syncs pages (evidence: `services/vocab-service/notion_sync.py`)
- User → Investment API surface: uses
- Investment API surface → API gateway: HTTP requests (evidence: `frontend/src/lib/api.ts`)
- API gateway → Investment service: proxies invest (evidence: `services/api-gateway/main.py`)
