# temkin236/aura-ai architecture

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

- Interactive diagram: https://gitdiagram.com/temkin236/aura-ai
- Repository: https://github.com/temkin236/aura-ai

## Overview

AURA AI is an editorial chat companion: users choose a persona and submit a prompt, then read a streamed or fallback response in a conversation. The main flow is visible from the workspace through the Express server to Gemini and back; the server also persists authenticated conversation messages. Auth, conversation APIs, PostgreSQL access, persona configuration, markdown rendering, settings, and the prototype admin console are distinct supporting capabilities. Some client/server and endpoint wiring is only partially excerpted, so unverified links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/temkin236/aura-ai/blob/main/src/App.tsx) (App shell), [`src/components/chat/ChatWorkspace.tsx`](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatWorkspace.tsx) (Chat workspace), [`server.ts`](https://github.com/temkin236/aura-ai/blob/main/server.ts) (API server), [`src/routes/auth.ts`](https://github.com/temkin236/aura-ai/blob/main/src/routes/auth.ts) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_workspace["Chat workspace<br/>[ChatWorkspace.tsx]"]
  node_composer["Prompt composer<br/>[ChatComposer.tsx]"]
  node_modes["AI personas<br/>[modes.ts]"]
  node_messages["Message display<br/>[ChatMessage.tsx]"]
  node_markdown["Markdown renderer"]
  node_sidebar["Conversation sidebar<br/>[ChatSidebar.tsx]"]
  node_welcome["Welcome screen<br/>[WelcomeScreen.tsx]"]
end

subgraph group_server["AI service"]
  node_server["API server<br/>[server.ts]"]
  node_gemini["Gemini model"]
  node_fallback["Local fallback<br/>[server.ts]"]
end

subgraph group_identity["Identity and data"]
  node_authroutes["Auth routes<br/>[auth.ts]"]
  node_convroutes["Conversation routes<br/>[conversations.ts]"]
  node_middleware["Auth middleware<br/>[auth.ts]"]
  node_authservice["Session and roles<br/>[service.ts]"]
  node_convdata["Conversation storage<br/>[conversations.ts]"]
  node_pool["PostgreSQL pool<br/>[index.ts]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_product["Product surfaces"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_settings["User settings<br/>[SettingsModal.tsx]"]
  node_admin["Admin prototype<br/>[AdminDashboard.tsx]"]
  node_authmodal["Sign-in UI<br/>[AuthModal.tsx]"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"renders"| node_workspace
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_admin
node_app -->|"renders"| node_authmodal
node_workspace -->|"renders"| node_composer
node_workspace -->|"renders"| node_messages
node_workspace -->|"renders"| node_sidebar
node_workspace -->|"renders"| node_welcome
node_workspace -->|"requests stream"| node_server
node_workspace -->|"reads persona data"| node_modes
node_composer -->|"selects persona"| node_modes
node_messages -->|"renders content"| node_markdown
node_server -->|"streams generation"| node_gemini
node_server -->|"uses on failure"| node_fallback
node_server -->|"mounts routes"| node_convroutes
node_server -->|"mounts routes"| node_authroutes
node_server -->|"persists messages"| node_convdata
node_authroutes -->|"guards identity route"| node_middleware
node_convroutes -->|"uses authorization"| node_middleware
node_middleware -->|"validates session"| node_authservice
node_authroutes -->|"creates sessions"| node_authservice
node_authservice -->|"queries database"| node_pool
node_convdata -->|"queries database"| node_pool
node_pool -->|"opens connection"| node_postgres
node_convroutes -->|"reads and writes"| node_convdata
node_app -->|"checks session"| node_authroutes
node_landing -->|"renders markdown"| node_markdown

click node_app "https://github.com/temkin236/aura-ai/blob/main/src/App.tsx"
click node_workspace "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatWorkspace.tsx"
click node_composer "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatComposer.tsx"
click node_modes "https://github.com/temkin236/aura-ai/blob/main/src/data/modes.ts"
click node_messages "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatMessage.tsx"
click node_markdown "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/MarkdownContent.tsx"
click node_sidebar "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatSidebar.tsx"
click node_welcome "https://github.com/temkin236/aura-ai/blob/main/src/components/chat/WelcomeScreen.tsx"
click node_landing "https://github.com/temkin236/aura-ai/blob/main/src/components/landing/LandingPage.tsx"
click node_settings "https://github.com/temkin236/aura-ai/blob/main/src/components/settings/SettingsModal.tsx"
click node_admin "https://github.com/temkin236/aura-ai/blob/main/src/components/admin/AdminDashboard.tsx"
click node_authmodal "https://github.com/temkin236/aura-ai/blob/main/src/components/auth/AuthModal.tsx"
click node_server "https://github.com/temkin236/aura-ai/blob/main/server.ts"
click node_fallback "https://github.com/temkin236/aura-ai/blob/main/server.ts"
click node_authroutes "https://github.com/temkin236/aura-ai/blob/main/src/routes/auth.ts"
click node_convroutes "https://github.com/temkin236/aura-ai/blob/main/src/routes/conversations.ts"
click node_middleware "https://github.com/temkin236/aura-ai/blob/main/src/middleware/auth.ts"
click node_authservice "https://github.com/temkin236/aura-ai/blob/main/src/auth/service.ts"
click node_convdata "https://github.com/temkin236/aura-ai/blob/main/src/db/conversations.ts"
click node_pool "https://github.com/temkin236/aura-ai/blob/main/src/db/index.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_app,node_workspace,node_composer,node_modes,node_messages,node_markdown,node_sidebar,node_welcome,node_user toneBlue
class node_server,node_gemini,node_fallback toneAmber
class node_authroutes,node_convroutes,node_middleware,node_authservice,node_convdata,node_pool,node_postgres toneMint
class node_landing,node_settings,node_admin,node_authmodal toneRose
```

## Components

### Chat experience

- [App shell](https://github.com/temkin236/aura-ai/blob/main/src/App.tsx): `src/App.tsx`
- [Chat workspace](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatWorkspace.tsx): `src/components/chat/ChatWorkspace.tsx`
- [Prompt composer](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatComposer.tsx): `src/components/chat/ChatComposer.tsx`
- [AI personas](https://github.com/temkin236/aura-ai/blob/main/src/data/modes.ts): `src/data/modes.ts`
- [Message display](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatMessage.tsx): `src/components/chat/ChatMessage.tsx`
- [Markdown renderer](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/MarkdownContent.tsx): `src/components/chat/MarkdownContent.tsx`
- [Conversation sidebar](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/ChatSidebar.tsx): `src/components/chat/ChatSidebar.tsx`
- [Welcome screen](https://github.com/temkin236/aura-ai/blob/main/src/components/chat/WelcomeScreen.tsx): `src/components/chat/WelcomeScreen.tsx`

### AI service

- [API server](https://github.com/temkin236/aura-ai/blob/main/server.ts): `server.ts`
- **Gemini model**
- [Local fallback](https://github.com/temkin236/aura-ai/blob/main/server.ts): `server.ts`

### Identity and data

- [Auth routes](https://github.com/temkin236/aura-ai/blob/main/src/routes/auth.ts): `src/routes/auth.ts`
- [Conversation routes](https://github.com/temkin236/aura-ai/blob/main/src/routes/conversations.ts): `src/routes/conversations.ts`
- [Auth middleware](https://github.com/temkin236/aura-ai/blob/main/src/middleware/auth.ts): `src/middleware/auth.ts`
- [Session and roles](https://github.com/temkin236/aura-ai/blob/main/src/auth/service.ts): `src/auth/service.ts`
- [Conversation storage](https://github.com/temkin236/aura-ai/blob/main/src/db/conversations.ts): `src/db/conversations.ts`
- [PostgreSQL pool](https://github.com/temkin236/aura-ai/blob/main/src/db/index.ts): `src/db/index.ts`
- **PostgreSQL**

### Product surfaces

- [Landing page](https://github.com/temkin236/aura-ai/blob/main/src/components/landing/LandingPage.tsx): `src/components/landing/LandingPage.tsx`
- [User settings](https://github.com/temkin236/aura-ai/blob/main/src/components/settings/SettingsModal.tsx): `src/components/settings/SettingsModal.tsx`
- [Admin prototype](https://github.com/temkin236/aura-ai/blob/main/src/components/admin/AdminDashboard.tsx): `src/components/admin/AdminDashboard.tsx`
- [Sign-in UI](https://github.com/temkin236/aura-ai/blob/main/src/components/auth/AuthModal.tsx): `src/components/auth/AuthModal.tsx`

### Other components

- **User**

## Connections

- User → App shell: opens (evidence: `src/App.tsx`)
- App shell → Chat workspace: renders (evidence: `src/App.tsx`)
- App shell → Landing page: renders (evidence: `src/App.tsx`)
- App shell → User settings: renders (evidence: `src/App.tsx`)
- App shell → Admin prototype: renders (evidence: `src/App.tsx`)
- App shell → Sign-in UI: renders (evidence: `src/App.tsx`)
- Chat workspace → Prompt composer: renders (evidence: `src/components/chat/ChatWorkspace.tsx`)
- Chat workspace → Message display: renders (evidence: `src/components/chat/ChatWorkspace.tsx`)
- Chat workspace → Conversation sidebar: renders (evidence: `src/components/chat/ChatWorkspace.tsx`)
- Chat workspace → Welcome screen: renders (evidence: `src/components/chat/ChatWorkspace.tsx`)
- Chat workspace → API server: requests stream (evidence: `README.md`)
- Chat workspace → AI personas: reads persona data (evidence: `src/components/chat/ChatWorkspace.tsx`)
- Prompt composer → AI personas: selects persona (evidence: `src/components/chat/ChatComposer.tsx`)
- Message display → Markdown renderer: renders content (evidence: `src/components/chat/ChatMessage.tsx`)
- API server → Gemini model: streams generation (evidence: `README.md`)
- API server → Local fallback: uses on failure (evidence: `README.md`)
- API server → Conversation routes: mounts routes (evidence: `server.ts`)
- API server → Auth routes: mounts routes (evidence: `server.ts`)
- API server → Conversation storage: persists messages (evidence: `server.ts`)
- Auth routes → Auth middleware: guards identity route (evidence: `src/routes/auth.ts`)
- Conversation routes → Auth middleware: uses authorization (evidence: `src/routes/conversations.ts`)
- Auth middleware → Session and roles: validates session (evidence: `src/middleware/auth.ts`)
- Auth routes → Session and roles: creates sessions (evidence: `src/routes/auth.ts`)
- Session and roles → PostgreSQL pool: queries database (evidence: `src/auth/service.ts`)
- Conversation storage → PostgreSQL pool: queries database (evidence: `src/db/conversations.ts`)
- PostgreSQL pool → PostgreSQL: opens connection (evidence: `src/db/index.ts`)
- Conversation routes → Conversation storage: reads and writes (evidence: `src/routes/conversations.ts`)
- App shell → Auth routes: checks session (evidence: `src/App.tsx`)
- Landing page → Markdown renderer: renders markdown (evidence: `src/components/landing/LandingPage.tsx`)
