# aasthachouksey18/email-writer-sb architecture

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

- Interactive diagram: https://gitdiagram.com/aasthachouksey18/email-writer-sb
- Repository: https://github.com/aasthachouksey18/email-writer-sb

## Overview

This Spring Boot backend accepts email content and an optional tone, builds a prompt, requests a draft from Google Gemini, and extracts the generated text. The README describes a REST API, but no production controller appears in the tree; its connection to the generation service is therefore unverified. Prompt construction and response parsing are shown as distinct stages within the service. The sampled sources show WebClient configuration and use, but not the framework’s bean-wiring step.

Main entry points: [`src/main/java/com/email/writer/EmailGeneratorService.java`](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java) (Email generator), [`src/main/java/com/email/writer`](https://github.com/aasthachouksey18/email-writer-sb/tree/main/src/main/java/com/email/writer) (REST API), [`src/main/java/com/email/writer/EmailRequest.java`](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailRequest.java) (Email request), [`src/main/java/Config/WebClientConfig.java`](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/Config/WebClientConfig.java) (WebClient setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Request workflow"]
  node_rest["REST API"]
  node_request["Email request<br/>[EmailRequest.java]"]
end

subgraph group_ai["AI generation"]
  node_service["Email generator"]
  node_prompt["Prompt builder"]
  node_gemini["Google Gemini"]
  node_parser["Response parser"]
end

subgraph group_runtime["Application runtime"]
  node_webclient["WebClient setup"]
  node_application["Spring Boot app"]
end

node_user(("API consumer"))

node_user -->|"submits request"| node_rest
node_rest -.->|"invokes"| node_service
node_request -->|"provides input"| node_service
node_service -->|"builds prompt"| node_prompt
node_service -->|"posts prompt"| node_gemini
node_gemini -->|"returns JSON"| node_service
node_service -->|"parses response"| node_parser
node_webclient -.->|"provides client"| node_service

click node_rest "https://github.com/aasthachouksey18/email-writer-sb/tree/main/src/main/java/com/email/writer"
click node_request "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailRequest.java"
click node_service "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java"
click node_prompt "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java"
click node_parser "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java"
click node_webclient "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/Config/WebClientConfig.java"
click node_application "https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailWriterSbApplication.java"

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_rest,node_request toneBlue
class node_service,node_prompt,node_gemini,node_parser toneAmber
class node_webclient,node_application,node_user toneMint
```

## Components

### Request workflow

- [REST API](https://github.com/aasthachouksey18/email-writer-sb/tree/main/src/main/java/com/email/writer): `src/main/java/com/email/writer`
- [Email request](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailRequest.java): `src/main/java/com/email/writer/EmailRequest.java`

### AI generation

- [Email generator](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java): `src/main/java/com/email/writer/EmailGeneratorService.java`
- [Prompt builder](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java): `src/main/java/com/email/writer/EmailGeneratorService.java`
- **Google Gemini**
- [Response parser](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailGeneratorService.java): `src/main/java/com/email/writer/EmailGeneratorService.java`

### Application runtime

- [WebClient setup](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/Config/WebClientConfig.java): `src/main/java/Config/WebClientConfig.java`
- [Spring Boot app](https://github.com/aasthachouksey18/email-writer-sb/blob/main/src/main/java/com/email/writer/EmailWriterSbApplication.java): `src/main/java/com/email/writer/EmailWriterSbApplication.java`

### Other components

- **API consumer**

## Connections

- API consumer → REST API: submits request (evidence: `README.md`)
- REST API → Email generator: invokes
- Email request → Email generator: provides input (evidence: `src/main/java/com/email/writer/EmailGeneratorService.java`)
- Email generator → Prompt builder: builds prompt (evidence: `src/main/java/com/email/writer/EmailGeneratorService.java`)
- Email generator → Google Gemini: posts prompt (evidence: `src/main/java/com/email/writer/EmailGeneratorService.java`)
- Google Gemini → Email generator: returns JSON (evidence: `src/main/java/com/email/writer/EmailGeneratorService.java`)
- Email generator → Response parser: parses response (evidence: `src/main/java/com/email/writer/EmailGeneratorService.java`)
- WebClient setup → Email generator: provides client
