# yaksh-8055/narrator2.0 architecture

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

- Interactive diagram: https://gitdiagram.com/yaksh-8055/narrator2.0
- Repository: https://github.com/yaksh-8055/narrator2.0

## Overview

Narrator2.0 is an AI story-generation and narration app. The visible dashboard workflow authenticates a demo user, lets them generate a story and access a library; generated speech and Cloudant persistence are also advertised by the app’s routes and dashboard. The page excerpt confirms the dashboard’s AuthGuard, generator, library, and save-refresh handoff. The README provides no detail, and generated route.ts is only a Next.js type-check wrapper, so unshown API-to-provider and storage call paths are not asserted.

Main entry points: [`page.tsx`](https://github.com/yaksh-8055/narrator2.0/blob/main/page.tsx) (Story dashboard), [`ibmtts.ts`](https://github.com/yaksh-8055/narrator2.0/blob/main/ibmtts.ts) (IBM narration), [`cloudant.ts`](https://github.com/yaksh-8055/narrator2.0/blob/main/cloudant.ts) (Cloudant access), [`gemini.ts`](https://github.com/yaksh-8055/narrator2.0/blob/main/gemini.ts) (Gemini generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Story dashboard<br/>[page.tsx]"]
  node_generator["Story generator"]
  node_library["Story library"]
end

subgraph group_story["Story services"]
  node_generateapi["Generation API"]
  node_gemini["Gemini generation<br/>[gemini.ts]"]
  node_ttsapi["Speech API"]
  node_ibmtts["IBM narration<br/>[ibmtts.ts]"]
  node_moodconfig["Mood voices<br/>[index.ts]"]
  node_validator["Request validation<br/>[validator.ts]"]
end

subgraph group_persistence["Story persistence"]
  node_cloudantapi["Cloudant APIs"]
  node_cloudant["Cloudant access<br/>[cloudant.ts]"]
end

subgraph group_identity["Identity"]
  node_authguard["Auth guard"]
  node_auth["Demo auth<br/>[auth.ts]"]
end

node_user(("Narrator user"))
node_cloudantservice[("Cloudant")]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_authguard
node_authguard -.->|"validates session"| node_auth
node_dashboard -->|"renders"| node_generator
node_dashboard -->|"renders"| node_library
node_generator -.->|"requests story"| node_generateapi
node_generateapi -.->|"validates input"| node_validator
node_generateapi -.->|"generates text"| node_gemini
node_generator -.->|"requests narration"| node_ttsapi
node_ttsapi -.->|"synthesizes speech"| node_ibmtts
node_ibmtts -.->|"selects voice"| node_moodconfig
node_generator -.->|"saves story"| node_cloudantapi
node_library -.->|"loads stories"| node_cloudantapi
node_cloudantapi -.->|"delegates access"| node_cloudant
node_cloudant -.->|"reads and writes"| node_cloudantservice

click node_dashboard "https://github.com/yaksh-8055/narrator2.0/blob/main/page.tsx"
click node_auth "https://github.com/yaksh-8055/narrator2.0/blob/main/auth.ts"
click node_gemini "https://github.com/yaksh-8055/narrator2.0/blob/main/gemini.ts"
click node_ibmtts "https://github.com/yaksh-8055/narrator2.0/blob/main/ibmtts.ts"
click node_moodconfig "https://github.com/yaksh-8055/narrator2.0/blob/main/index.ts"
click node_cloudant "https://github.com/yaksh-8055/narrator2.0/blob/main/cloudant.ts"
click node_validator "https://github.com/yaksh-8055/narrator2.0/blob/main/validator.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_dashboard,node_generator,node_library,node_user toneBlue
class node_generateapi,node_gemini,node_ttsapi,node_ibmtts,node_moodconfig,node_validator,node_cloudantservice toneAmber
class node_cloudantapi,node_cloudant toneMint
class node_authguard,node_auth toneRose
```

## Components

### User experience

- [Story dashboard](https://github.com/yaksh-8055/narrator2.0/blob/main/page.tsx): `page.tsx`
- **Story generator**
- **Story library**

### Story services

- **Generation API**
- [Gemini generation](https://github.com/yaksh-8055/narrator2.0/blob/main/gemini.ts): `gemini.ts`
- **Speech API**
- [IBM narration](https://github.com/yaksh-8055/narrator2.0/blob/main/ibmtts.ts): `ibmtts.ts`
- [Mood voices](https://github.com/yaksh-8055/narrator2.0/blob/main/index.ts): `index.ts`
- [Request validation](https://github.com/yaksh-8055/narrator2.0/blob/main/validator.ts): `validator.ts`

### Story persistence

- **Cloudant APIs**
- [Cloudant access](https://github.com/yaksh-8055/narrator2.0/blob/main/cloudant.ts): `cloudant.ts`

### Identity

- **Auth guard**
- [Demo auth](https://github.com/yaksh-8055/narrator2.0/blob/main/auth.ts): `auth.ts`

### Other components

- **Narrator user**
- **Cloudant**

## Connections

- Narrator user → Story dashboard: uses (evidence: `page.tsx`)
- Story dashboard → Auth guard: renders (evidence: `page.tsx`)
- Auth guard → Demo auth: validates session
- Story dashboard → Story generator: renders (evidence: `page.tsx`)
- Story dashboard → Story library: renders (evidence: `page.tsx`)
- Story generator → Generation API: requests story
- Generation API → Request validation: validates input
- Generation API → Gemini generation: generates text
- Story generator → Speech API: requests narration
- Speech API → IBM narration: synthesizes speech
- IBM narration → Mood voices: selects voice
- Story generator → Cloudant APIs: saves story
- Story library → Cloudant APIs: loads stories
- Cloudant APIs → Cloudant access: delegates access
- Cloudant access → Cloudant: reads and writes
