# dylanvu6868/mkt_post_build architecture

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

- Interactive diagram: https://gitdiagram.com/dylanvu6868/mkt_post_build
- Repository: https://github.com/dylanvu6868/mkt_post_build

## Overview

Vitba.ai is a Vietnamese-focused AI marketing platform. Its user-facing capabilities span conversational and form-based content generation, marketing research, email and landing-page creation, image generation, strategy reports, and marketing study tools. The backend exposes these capabilities through FastAPI routes, with shared authentication, persistence, and LLM infrastructure. The README documents product workflows; sampled backend wiring confirms route registration and selected route-to-service calls. Several feature implementations were not sampled, so their internal links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/main.py) (API application), [`backend/app/api/chat.py`](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/chat.py) (Chat API), [`backend/app/api/generate.py`](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/generate.py) (Generation API), [`backend/app/api/deps.py`](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/deps.py) (Request identity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_chat_ui["AI chat<br/>[chat-panel.tsx]"]
  node_lab_ui["Vitba Lab<br/>[page.tsx]"]
  node_landing_ui["Landing builder<br/>[builder.tsx]"]
  node_email_ui["Email workspace<br/>[page.tsx]"]
  node_frame_ui["Vitba Frame<br/>[page.tsx]"]
  node_report_ui["Strategy report<br/>[page.tsx]"]
  node_study_ui["Vitba Study<br/>[page.tsx]"]
end

subgraph group_creation["AI creation"]
  node_chat_api["Chat API<br/>[chat.py]"]
  node_generation_api["Generation API<br/>[generate.py]"]
  node_lab_api["Lab API<br/>[lab.py]"]
  node_agents["AI agents"]
  node_llm["LLM provider<br/>[factory.py]"]
  node_rag["Document retrieval"]
end

subgraph group_marketing_ops["Marketing operations"]
  node_landing_service["Landing tools<br/>[tools.py]"]
  node_template_engine["Template renderer<br/>[template_engine.py]"]
  node_email_service["Email tools<br/>[tools.py]"]
  node_frame_api["Image generation API<br/>[frame.py]"]
  node_report_api["PDF report API<br/>[report_pdf.py]"]
  node_seo["SEO tools"]
  node_meta_routes["Meta integration<br/>[routes.py]"]
end

subgraph group_learning["Learning and insights"]
  node_study_api["Study routes<br/>[study.py]"]
  node_study_questions["Study questions<br/>[study_questions.py]"]
end

subgraph group_platform["Platform services"]
  node_frontend_auth["Account access<br/>[page.tsx]"]
  node_auth_api["Authentication API<br/>[auth.py]"]
  node_auth_deps["Request identity<br/>[deps.py]"]
  node_user_model[("User records<br/>[user.py]")]
  node_database[("Database sessions<br/>[db.py]")]
  node_app_entry["API application<br/>[main.py]"]
end

node_user(("Marketing user"))

node_user -->|"starts chat"| node_chat_ui
node_user -->|"submits tool forms"| node_lab_ui
node_user -->|"builds pages"| node_landing_ui
node_user -->|"creates campaigns"| node_email_ui
node_user -->|"requests images"| node_frame_ui
node_user -->|"requests report"| node_report_ui
node_user -->|"takes quizzes"| node_study_ui
node_app_entry -->|"registers route"| node_chat_api
node_app_entry -->|"registers route"| node_generation_api
node_app_entry -->|"registers route"| node_lab_api
node_app_entry -->|"registers route"| node_frame_api
node_app_entry -->|"registers route"| node_report_api
node_app_entry -->|"registers route"| node_study_api
node_app_entry -->|"registers route"| node_study_questions
node_app_entry -->|"registers router"| node_landing_service
node_app_entry -->|"registers router"| node_meta_routes
node_chat_api -->|"invokes agents"| node_agents
node_chat_api -->|"creates model client"| node_llm
node_chat_api -->|"retrieves context"| node_rag
node_generation_api -->|"creates model client"| node_llm
node_generation_api -->|"uses guard"| node_agents
node_landing_service -.->|"renders templates"| node_template_engine
node_frontend_auth -.->|"signs in"| node_auth_api
node_app_entry -->|"registers route"| node_auth_api
node_auth_api -->|"uses identity checks"| node_auth_deps
node_auth_deps -->|"loads user"| node_user_model
node_auth_deps -->|"gets session"| node_database
node_database -->|"provides ORM base"| node_user_model

click node_chat_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/components/chat-panel.tsx"
click node_lab_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/lab/page.tsx"
click node_landing_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/landing/builder.tsx"
click node_email_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/email/page.tsx"
click node_frame_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/frame/page.tsx"
click node_report_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/report/page.tsx"
click node_study_ui "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/study/page.tsx"
click node_chat_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/chat.py"
click node_generation_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/generate.py"
click node_lab_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/lab.py"
click node_agents "https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/agents"
click node_llm "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/llm/factory.py"
click node_rag "https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/rag"
click node_landing_service "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/landing/tools.py"
click node_template_engine "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/landing/template_engine.py"
click node_email_service "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/email/tools.py"
click node_frame_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/frame.py"
click node_report_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/report_pdf.py"
click node_seo "https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/mcp/seo"
click node_meta_routes "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/meta/routes.py"
click node_study_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/study.py"
click node_study_questions "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/study_questions.py"
click node_frontend_auth "https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/login/page.tsx"
click node_auth_api "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/auth.py"
click node_auth_deps "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/deps.py"
click node_user_model "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/models/user.py"
click node_database "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/core/db.py"
click node_app_entry "https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/main.py"

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_chat_ui,node_lab_ui,node_landing_ui,node_email_ui,node_frame_ui,node_report_ui,node_study_ui,node_user toneBlue
class node_chat_api,node_generation_api,node_lab_api,node_agents,node_llm,node_rag toneAmber
class node_landing_service,node_template_engine,node_email_service,node_frame_api,node_report_api,node_seo,node_meta_routes toneMint
class node_study_api,node_study_questions toneRose
class node_frontend_auth,node_auth_api,node_auth_deps,node_user_model,node_database,node_app_entry toneIndigo
```

## Components

### User experience

- [AI chat](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/components/chat-panel.tsx): `frontend/components/chat-panel.tsx`
- [Vitba Lab](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/lab/page.tsx): `frontend/app/hub/lab/page.tsx`
- [Landing builder](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/landing/builder.tsx): `frontend/app/hub/landing/builder.tsx`
- [Email workspace](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/email/page.tsx): `frontend/app/hub/email/page.tsx`
- [Vitba Frame](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/frame/page.tsx): `frontend/app/hub/frame/page.tsx`
- [Strategy report](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/report/page.tsx): `frontend/app/hub/report/page.tsx`
- [Vitba Study](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/hub/study/page.tsx): `frontend/app/hub/study/page.tsx`

### AI creation

- [Chat API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Generation API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/generate.py): `backend/app/api/generate.py`
- [Lab API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/lab.py): `backend/app/api/lab.py`
- [AI agents](https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/agents): `backend/app/agents`
- [LLM provider](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/llm/factory.py): `backend/app/llm/factory.py`
- [Document retrieval](https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/rag): `backend/app/rag`

### Marketing operations

- [Landing tools](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/landing/tools.py): `backend/app/mcp/landing/tools.py`
- [Template renderer](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/landing/template_engine.py): `backend/app/mcp/landing/template_engine.py`
- [Email tools](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/email/tools.py): `backend/app/mcp/email/tools.py`
- [Image generation API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/frame.py): `backend/app/api/frame.py`
- [PDF report API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/report_pdf.py): `backend/app/api/report_pdf.py`
- [SEO tools](https://github.com/dylanvu6868/mkt_post_build/tree/main/backend/app/mcp/seo): `backend/app/mcp/seo`
- [Meta integration](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/mcp/meta/routes.py): `backend/app/mcp/meta/routes.py`

### Learning and insights

- [Study routes](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/study.py): `backend/app/api/study.py`
- [Study questions](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/study_questions.py): `backend/app/api/study_questions.py`

### Platform services

- [Account access](https://github.com/dylanvu6868/mkt_post_build/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [Authentication API](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Request identity](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [User records](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Database sessions](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [API application](https://github.com/dylanvu6868/mkt_post_build/blob/main/backend/app/main.py): `backend/app/main.py`

### Other components

- **Marketing user**

## Connections

- Marketing user → AI chat: starts chat
- Marketing user → Vitba Lab: submits tool forms
- Marketing user → Landing builder: builds pages
- Marketing user → Email workspace: creates campaigns
- Marketing user → Vitba Frame: requests images
- Marketing user → Strategy report: requests report
- Marketing user → Vitba Study: takes quizzes
- API application → Chat API: registers route (evidence: `backend/app/main.py`)
- API application → Generation API: registers route (evidence: `backend/app/main.py`)
- API application → Lab API: registers route (evidence: `backend/app/main.py`)
- API application → Image generation API: registers route (evidence: `backend/app/main.py`)
- API application → PDF report API: registers route (evidence: `backend/app/main.py`)
- API application → Study routes: registers route (evidence: `backend/app/main.py`)
- API application → Study questions: registers route (evidence: `backend/app/main.py`)
- API application → Landing tools: registers router (evidence: `backend/app/main.py`)
- API application → Meta integration: registers router (evidence: `backend/app/main.py`)
- Chat API → AI agents: invokes agents (evidence: `backend/app/api/chat.py`)
- Chat API → LLM provider: creates model client (evidence: `backend/app/api/chat.py`)
- Chat API → Document retrieval: retrieves context (evidence: `backend/app/api/chat.py`)
- Generation API → LLM provider: creates model client (evidence: `backend/app/api/generate.py`)
- Generation API → AI agents: uses guard (evidence: `backend/app/api/generate.py`)
- Landing tools → Template renderer: renders templates
- Account access → Authentication API: signs in
- API application → Authentication API: registers route (evidence: `backend/app/main.py`)
- Authentication API → Request identity: uses identity checks (evidence: `backend/app/api/auth.py`)
- Request identity → User records: loads user (evidence: `backend/app/api/deps.py`)
- Request identity → Database sessions: gets session (evidence: `backend/app/api/deps.py`)
- Database sessions → User records: provides ORM base (evidence: `backend/app/models/user.py`)
