# nehathakur4/price-negotiator-ecommerce-chatbot-system architecture

> Architecture diagram of the GitHub repository nehathakur4/price-negotiator-ecommerce-chatbot-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nehathakur4/price-negotiator-ecommerce-chatbot-system
- Repository: https://github.com/nehathakur4/price-negotiator-ecommerce-chatbot-system

## Overview

##### Project Type and Purpose
- This is a full-stack e-commerce chatbot system that enables customers to negotiate product prices in natural language.
- Key features: user onboarding (signup/login), product browsing, NLP-driven chat interface, machine-learning-based price prediction, reinforcement-learning negotiation engine, and payment processing.
- Built with Python (Flask backend), HTML/CSS frontend, TensorFlow/Keras, NLTK, Scikit-learn, and an Anaconda-managed environment.

##### File Structure & README
- Top level:
- Price-Negotiator-Ecommerce-Chatbot-System.pdf (project docs)
- README.md (project overview, modules, screenshots)
- screenshots/ (UI flow images)
- “chatbot_code.py” (core logic orchestrating NLP, ML, RL)
- “negotiation_data.csv” (training dataset)
- Presence of Flask implies an HTTP API layer; HTML/CSS implies a client served by Flask; payment page indicates an external payment gateway integration.
- Likely a simple relational or key-value store (not explicitly shown) for users, products, and negotiation state.

##### Extract Insights from README
- Modules:
a. NLP Module (intent & entity extraction)
b. Price Prediction Module (historical-data ML model)
c. Negotiation Engine (reinforcement learning)
- UI Steps (screenshots): signup/login → product list → chat interface → checkout/payment → success.
- External dependencies: payment gateway; uses Flask for backend and NLTK/TensorFlow for AI.

##### Main Components & Interactions
- Frontend (Browser UI)
- Signup/Login Page
- Product Listing & Selection
- Chat Interface (negotiation)
- Payment & Confirmation Pages
- Backend (Flask App)
- REST/WS endpoint for authentication
- Product service (fetch product data)
- Chatbot controller that routes messages to NLP Module → Price Prediction → Negotiation Engine → response.
- Payment integration module calling external payment gateway API.
- Data Storage
- User Database (accounts, sessions)
- Product Database (pricing, inventory)
- Negotiation Data Store (conversation logs, training data in CSV)
- ML Model Store (serialized TensorFlow/Keras models)
- External Services
- Payment Gateway (e.g., Stripe/PayPal)
- (Optional) Third-party analytics or logging

##### Architectural Patterns & Design Principles
- Layered Architecture: Presentation (frontend) → Application (Flask controllers) → Business Logic (NLP/ML/Negotiation) → Data
- Loose coupling: each module exposes a clear interface
- Data flow: user message → NLP → intent/entities → price prediction → negotiation decision → JSON response → frontend display

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User((User)):::external

    %% User Interface Layer
    subgraph "User Interface"
        direction TB
        SignupPage["Signup/Login Page"]:::frontend
        ProductListUI["Product Listing & Selection"]:::frontend
        ChatInterface["Chat Interface"]:::frontend
        PaymentUI["Payment & Confirmation Pages"]:::frontend
    end

    %% Backend Services Layer
    subgraph "Backend Services"
        direction TB
        AuthService["Authentication Service"]:::backend
        ProductService["Product Service"]:::backend
        ChatController["Chatbot Controller"]:::backend
        PaymentIntegration["Payment Integration Module"]:::backend
    end

    %% AI Modules
    subgraph "AI Modules"
        direction TB
        NLP["NLP Module"]:::ai
        PricePred["Price Prediction Module"]:::ai
        NegotiationEngine["Negotiation Engine"]:::ai
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        UserDB[(User Database)]:::storage
        ProductDB[(Product Database)]:::storage
        NegotiationData[(Negotiation Data Store)]:::storage
        ModelStore[(ML Model Store)]:::storage
    end

    %% External Services
    subgraph "External Services"
        direction TB
        PaymentGateway["Payment Gateway"]:::external
    end

    %% Relationships
    User -->|HTTP GET| SignupPage
    SignupPage -->|Auth Request| AuthService
    AuthService -->|Token| SignupPage
    SignupPage -->|UI Flow| ProductListUI

    ProductListUI -->|GET Products| ProductService
    ProductService -->|Product Data| ProductListUI
    ProductListUI -->|Select Product| ChatInterface

    ChatInterface -->|HTTP POST/chat| ChatController
    ChatController -->|"intent/entities"| NLP
    NLP -->|"entities"| PricePred
    PricePred -->|"price suggestion"| NegotiationEngine
    NegotiationEngine -->|"negotiation decision"| ChatController
    ChatController -->|JSON response| ChatInterface

    ChatInterface -->|Proceed to Payment| PaymentUI
    PaymentUI -->|Payment Request| PaymentIntegration
    PaymentIntegration -->|HTTPS request| PaymentGateway
    PaymentGateway -->|Confirmation| PaymentIntegration
    PaymentIntegration -->|Payment Status| PaymentUI

    %% Data flow to/from stores
    AuthService -->|DB read/write| UserDB
    ProductService -->|DB read| ProductDB
    ChatController -->|log conversation| NegotiationData
    NLP -->|load model| ModelStore
    PricePred -->|load model| ModelStore
    NegotiationEngine -->|update policy| NegotiationData

    %% Click Events
    click Price-Negotiator-Ecommerce-Chatbot-System.pdf "https://github.com/nehathakur4/price-negotiator-ecommerce-chatbot-system/blob/main/Price-Negotiator-Ecommerce-Chatbot-System.pdf"
    click README.md "https://github.com/nehathakur4/price-negotiator-ecommerce-chatbot-system/blob/main/README.md"
    click screenshots/ "https://github.com/nehathakur4/price-negotiator-ecommerce-chatbot-system/tree/main/screenshots/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ai fill:#FFFF99,stroke:#333,stroke-width:1px
    classDef storage fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
