# sasitilak/blog-generation-system architecture

> Architecture diagram of the GitHub repository sasitilak/blog-generation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sasitilak/blog-generation-system
- Repository: https://github.com/sasitilak/blog-generation-system

## Overview

##### Project type and purpose
- This is a lightweight full‐stack “micro” application built with Streamlit (acts as both frontend and backend in a single Python process) whose sole purpose is to generate blog posts.
- It integrates two external services: the Wikipedia REST API (to fetch topic summaries) and the Groq-powered Langchain service (to generate natural language blog content).

##### File structure
- There is a single entry point: BlogAPP.py
- Contains Streamlit UI definitions (text area, button, display)
- Contains logic for calling Wikipedia API and Langchain API
- No separate directories for “frontend” vs “backend” – everything runs in one process invoked by Streamlit.

##### README for additional insights
- User flow: enter topic → optionally fetch Wikipedia summary → call Langchain model (mixtral‐8x7b‐32768) with both inputs → receive generated blog → render it.
- External dependencies: streamlit, langchain (Groq), wikipedia API, HTTP client.

##### Main components
a. Streamlit Application (Python process)
b. Wikipedia External API
c. Langchain (Groq) External API
d. End‐user (Browser)

##### Relationships and data flow
1. User (browser) → Streamlit UI: enters topic, clicks “Generate”
2. Streamlit logic branch:
- Call to Wikipedia API (GET summary) → returns context text
- Assemble prompt = “[user topic] + [wiki summary]”
- Call to Langchain/Groq API (POST prompt) → returns generated blog sections
3. Streamlit displays the returned blog to the user.

##### Architectural patterns and design principles
- Single‐process UI + business logic
- “API orchestration” pattern: this app orchestrates calls to two external services in sequence
- Minimal separation of concerns: UI rendering (Streamlit) vs data enrichment (Wikipedia) vs text generation (Langchain)

##### Key technologies/libraries
- Streamlit for UI and hosting
- requests (or httpx) for HTTP calls to Wikipedia API
- langchain SDK (Groq) for text generation
- Python 3.x as runtime

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors and Components
    User["End User (Browser)"]:::user
    subgraph "Internal System"
        App["Streamlit App\n(UI + Orchestration)"]:::internal
    end
    subgraph "External Services"
        Wiki["Wikipedia REST API"]:::external
        Lang["Langchain/Groq API\n(mixtral-8x7b-32768)"]:::external
    end
    Doc["Project Documentation\n(README.md)"]:::doc

    %% Data Flows
    User -->|"Enter topic & click Generate"| App
    App -->|"Fetch summary"| Wiki
    Wiki -->|"Return summary"| App
    App -->|"Submit prompt & context"| Lang
    Lang -->|"Return generated blog"| App
    App -->|"Render generated blog"| User

    %% Failure Path
    App -.->|"Display error"| User

    %% Click Events
    click App "https://github.com/sasitilak/blog-generation-system/blob/main/BlogAPP.py"
    click Doc "https://github.com/sasitilak/blog-generation-system/blob/main/README.md"

    %% Styles
    classDef user fill:#cccccc,stroke:#888888,color:#000000;
    classDef internal fill:#88ccff,stroke:#0055aa,color:#000000;
    classDef external fill:#99cc99,stroke:#228822,color:#000000;
    classDef doc fill:#ffffcc,stroke:#cccc00,color:#000000;
```
