# deepanshi-gupta/ai-powered-itinerary-generator architecture

> Architecture diagram of the GitHub repository deepanshi-gupta/ai-powered-itinerary-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/deepanshi-gupta/ai-powered-itinerary-generator
- Repository: https://github.com/deepanshi-gupta/ai-powered-itinerary-generator

## Overview

##### Project type and purpose
- This is a lightweight, full‑stack “single‑page” web application built in Python using Streamlit.
- Purpose: let users specify travel preferences, then call Google’s Gemini (PaLM 2.2) AI to generate a personalized itinerary, and finally produce a downloadable iCalendar (ICS) file.

##### File structure
- Top‑level files:
- app.py          → main Streamlit app (UI + business logic)
- requirements.txt→ Python dependencies
- Dockerfile, .dockerignore → containerization
- .gitignore, README.md → project metadata
- No separate “frontend” or “backend” directories: everything is bundled into app.py, indicating a monolithic service pattern.
- Presence of Dockerfile shows it’s intended to run inside a container in production or testing.

##### Read the README for additional insights
- Confirms the use of Streamlit for UI, Google Generative AI for text, and ICS library for calendar export.
- No database or persistent storage—data flows purely in memory per user session.

a. Main components:
- User’s Browser (Streamlit UI in the browser)
- Streamlit Server (app.py running in Docker)
- Google Gemini AI Service (external API)
- ICS Generator Module (part of app.py)
- Docker Container (deployment unit)

b. Relationships & data flow:
1. User opens the Streamlit page → selects destination & preferences.
2. Streamlit Server receives input → formats a request for Gemini.
3. Streamlit Server calls Google Gemini API → receives generated itinerary data.
4. Server processes the JSON response → builds on‑page display and invokes the ICS library to render a .ics file.
5. Streamlit sends the final itinerary and a download link for the ICS file back to the browser.

c. Architectural patterns & principles:
- Monolithic service: UI and business logic co‑located in one Python process.
- External API integration: clear separation of core logic vs. AI service.
- Stateless per session: no database, no persistence beyond session scope.
- Containerized deployment: isolates dependencies and runtime.

d. Relevant technologies
- Streamlit: UI framework, hosted by app.py
- Python libraries: google-generativeai (Gemini), ics, json, datetime, base64
- Docker: for packaging the Streamlit service

##### Detail without over‑splitting
- Major process step and third‑party interaction is represented.
- Call out the Docker container boundary to show the runtime environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        Browser["Browser (Streamlit UI)"]:::ui
    end

    subgraph "Application Layer"
        subgraph "Docker Container"
            Streamlit["Streamlit Server (app.py)"]:::application
            Input["Input Form"]:::application
            Handler["AI Request Handler"]:::application
            Parser["Response Parser"]:::application
            ICS["ICS Generator Module"]:::application
        end
    end

    subgraph "External Services"
        Gemini["Google Gemini AI API"]:::external
    end

    subgraph "Infrastructure Files"
        Req["requirements.txt"]:::infrastructure
        DF["Dockerfile"]:::infrastructure
        DIgnore[".dockerignore"]:::infrastructure
        README["README.md"]:::infrastructure
        GIT[".gitignore"]:::infrastructure
    end

    Browser -->|inputs preferences| Input
    Input -->|formats request| Handler
    Handler -->|calls API| Gemini
    Gemini -->|returns itinerary data| Handler
    Handler -->|parses response| Parser
    Parser -->|generates .ics data| ICS
    ICS -->|sends itinerary+download link| Browser

    click Streamlit "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/app.py"
    click Input "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/app.py"
    click Handler "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/app.py"
    click Parser "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/app.py"
    click ICS "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/app.py"
    click DF "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/tree/main/Dockerfile"
    click DIgnore "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/.dockerignore"
    click Req "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/requirements.txt"
    click README "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/README.md"
    click GIT "https://github.com/deepanshi-gupta/ai-powered-itinerary-generator/blob/main/.gitignore"

    classDef ui fill:#D6EAF8,stroke:#2980B9,color:#1B4F72
    classDef application fill:#A9DFBF,stroke:#27AE60,color:#1E8449
    classDef external fill:#F9E79F,stroke:#D68910,color:#7E5109
    classDef infrastructure fill:#D5D8DC,stroke:#7B7D7D,color:#2C3E50
```
