# bishti04062005/future_pe_02 architecture

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

- Interactive diagram: https://gitdiagram.com/bishti04062005/future_pe_02
- Repository: https://github.com/bishti04062005/future_pe_02

## Overview

AI UGC Ad Engine is a web app for account-based generation of short-form ad scripts, with refinement and saved campaign history. Users enter campaign details, receive a hook/bridge/close script, and can revisit or showcase results. The backend implements authentication, generation, refinement, history, and profile statistics in server.js. The HTML pages are named in the repository tree, but their source was not sampled; frontend-to-API links are therefore shown as unverified. The supplied excerpts do not show the database schema contents.

Main entry points: [`prisma/schema.prisma`](https://github.com/bishti04062005/future_pe_02/blob/main/prisma/schema.prisma) (Application database), [`server.js`](https://github.com/bishti04062005/future_pe_02/blob/main/server.js) (Script generation), [`login.html`](https://github.com/bishti04062005/future_pe_02/blob/main/login.html) (Login), [`campaigns.html`](https://github.com/bishti04062005/future_pe_02/blob/main/campaigns.html) (Campaign input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_landing["Landing page<br/>[landing_page.html]"]
  node_login["Login<br/>[login.html]"]
  node_campaigns["Campaign input<br/>[campaigns.html]"]
  node_showcase["Script showcase"]
  node_historyui["History view<br/>[history.html]"]
  node_profile["Profile view<br/>[profile.html]"]
end

subgraph group_api["Application API"]
  node_auth["Authentication routes<br/>[server.js]"]
  node_generate["Script generation<br/>[server.js]"]
  node_refine["Script refinement<br/>[server.js]"]
  node_historyapi["History endpoint<br/>[server.js]"]
  node_stats["Profile statistics<br/>[server.js]"]
end

subgraph group_ai["AI generation"]
  node_gemini{{"Google Gemini"}}
end

subgraph group_data["Persistence"]
  node_store[("Application database<br/>[schema.prisma]")]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_landing
node_visitor -->|"opens"| node_login
node_visitor -.->|"submits details"| node_campaigns
node_visitor -.->|"views output"| node_showcase
node_visitor -.->|"views history"| node_historyui
node_visitor -.->|"views profile"| node_profile
node_login -.->|"authenticates"| node_auth
node_campaigns -.->|"requests script"| node_generate
node_generate -->|"generates script"| node_gemini
node_generate -->|"saves campaign and script"| node_store
node_refine -->|"rewrites script"| node_gemini
node_refine -->|"saves version"| node_store
node_historyui -.->|"requests history"| node_historyapi
node_historyapi -->|"reads campaigns"| node_store
node_profile -.->|"requests statistics"| node_stats
node_stats -->|"reads user counts"| node_store

click node_landing "https://github.com/bishti04062005/future_pe_02/blob/main/landing_page.html"
click node_login "https://github.com/bishti04062005/future_pe_02/blob/main/login.html"
click node_campaigns "https://github.com/bishti04062005/future_pe_02/blob/main/campaigns.html"
click node_showcase "https://github.com/bishti04062005/future_pe_02/blob/main/showcase_output.html"
click node_historyui "https://github.com/bishti04062005/future_pe_02/blob/main/history.html"
click node_profile "https://github.com/bishti04062005/future_pe_02/blob/main/profile.html"
click node_auth "https://github.com/bishti04062005/future_pe_02/blob/main/server.js"
click node_generate "https://github.com/bishti04062005/future_pe_02/blob/main/server.js"
click node_refine "https://github.com/bishti04062005/future_pe_02/blob/main/server.js"
click node_historyapi "https://github.com/bishti04062005/future_pe_02/blob/main/server.js"
click node_stats "https://github.com/bishti04062005/future_pe_02/blob/main/server.js"
click node_store "https://github.com/bishti04062005/future_pe_02/blob/main/prisma/schema.prisma"

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_landing,node_login,node_campaigns,node_showcase,node_historyui,node_profile toneBlue
class node_auth,node_generate,node_refine,node_historyapi,node_stats toneAmber
class node_gemini toneMint
class node_store toneRose
class node_visitor toneIndigo
```

## Components

### Web experience

- [Landing page](https://github.com/bishti04062005/future_pe_02/blob/main/landing_page.html): `landing_page.html`
- [Login](https://github.com/bishti04062005/future_pe_02/blob/main/login.html): `login.html`
- [Campaign input](https://github.com/bishti04062005/future_pe_02/blob/main/campaigns.html): `campaigns.html`
- [Script showcase](https://github.com/bishti04062005/future_pe_02/blob/main/showcase_output.html): `showcase_output.html`
- [History view](https://github.com/bishti04062005/future_pe_02/blob/main/history.html): `history.html`
- [Profile view](https://github.com/bishti04062005/future_pe_02/blob/main/profile.html): `profile.html`

### Application API

- [Authentication routes](https://github.com/bishti04062005/future_pe_02/blob/main/server.js): `server.js`
- [Script generation](https://github.com/bishti04062005/future_pe_02/blob/main/server.js): `server.js`
- [Script refinement](https://github.com/bishti04062005/future_pe_02/blob/main/server.js): `server.js`
- [History endpoint](https://github.com/bishti04062005/future_pe_02/blob/main/server.js): `server.js`
- [Profile statistics](https://github.com/bishti04062005/future_pe_02/blob/main/server.js): `server.js`

### AI generation

- **Google Gemini**

### Persistence

- [Application database](https://github.com/bishti04062005/future_pe_02/blob/main/prisma/schema.prisma): `prisma/schema.prisma`

### Other components

- **Visitor**

## Connections

- Visitor → Landing page: opens (evidence: `README.md`)
- Visitor → Login: opens (evidence: `README.md`)
- Visitor → Campaign input: submits details
- Visitor → Script showcase: views output
- Visitor → History view: views history
- Visitor → Profile view: views profile
- Login → Authentication routes: authenticates
- Campaign input → Script generation: requests script
- Script generation → Google Gemini: generates script (evidence: `server.js`)
- Script generation → Application database: saves campaign and script (evidence: `server.js`)
- Script refinement → Google Gemini: rewrites script (evidence: `server.js`)
- Script refinement → Application database: saves version (evidence: `server.js`)
- History view → History endpoint: requests history
- History endpoint → Application database: reads campaigns (evidence: `server.js`)
- Profile view → Profile statistics: requests statistics
- Profile statistics → Application database: reads user counts (evidence: `server.js`)
