# muhammadabyaz/summarizer-ai architecture

> Architecture diagram of the GitHub repository muhammadabyaz/summarizer-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/muhammadabyaz/summarizer-ai
- Repository: https://github.com/muhammadabyaz/summarizer-ai

## Overview

##### Main Components

a) AWS Infrastructure Layer:
- AWS Lambda Functions (identify 3 distinct Lambda functions)
- S3 Storage (implied by s3 package)
- CloudFormation (as this is a CDK project)

b) Application Components:
- Main CDK Infrastructure Stack
- Lambda Function Groups:
- Primary Lambda (in /lambda directory)
- Python Lambda (in /python-lambda directory)
- Summary Lambda (in /summary-lambda directory)

**┌─ Infrastructure Layer (CDK/CloudFormation) ─┐**

- ┌─ Service Layer ─┐                       │
- Lambda Functions                       │
- S3 Buckets                            │
- ┘                       │

- ┌─ Application Layer ─┐                   │
- API Handler                            │
- Summarizer Logic                       │
- ┘                    │
- ┘

##### Component Relationships

- CDK Stack → CloudFormation (deployment flow)
- API Gateway → Lambda Functions (based on api.go)
- Lambda Functions → S3 (based on s3.go)
- Inter-Lambda communication (if any exists)

##### Specific Implementation Details

Key elements:
- API Gateway endpoints (from api.go)
- S3 interaction flows (from s3.go)
- Lambda function purposes:
- Python Lambda (likely for ML/summarization)
- Main Lambda (API handling)
- Summary Lambda (processing summaries)

##### Technical Details to Highlight

- Go-based Lambda functions
- Python-based Lambda function
- API interfaces and contracts
- S3 bucket interactions
- Build and deployment pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Infrastructure
        CDK["CDK Stack"]
        CF["CloudFormation"]
        CDK --> CF
    end

    subgraph "Service Layer"
        API["API Gateway"]
        S3[(S3 Storage)]:::storage
        
        subgraph "Lambda Functions"
            ML["Main Lambda"]:::lambda
            PL["Python Lambda"]:::lambda
            SL["Summary Lambda"]:::lambda
        end
        
        API --> ML
        ML --> S3
        ML --> PL
        PL --> S3
        PL --> SL
        SL --> S3
    end

    subgraph "Application Layer"
        APIHandler["API Handler"]:::code
        S3Handler["S3 Integration"]:::code
        Types["Data Types"]:::code
        SumLogic["Summarization Logic"]:::code
        HandlerLogic["Handler Logic"]:::code
    end

    ML --> APIHandler
    ML --> S3Handler
    ML --> Types
    PL --> SumLogic
    SL --> HandlerLogic

    %% Component Mappings
    click CDK "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/summarizer-ai.go"
    click CF "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/cdk.json"
    click ML "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/lambda/main.go"
    click APIHandler "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/lambda/api/api.go"
    click S3Handler "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/lambda/s3/s3.go"
    click Types "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/lambda/types/types.go"
    click PL "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/python-lambda/summarize.py"
    click SumLogic "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/python-lambda/requirements.txt"
    click SL "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/summary-lambda/main.go"
    click HandlerLogic "https://github.com/MuhammadAbyaz/summarizer-ai/blob/main/summary-lambda/handler/handler.go"

    %% Styling
    classDef lambda fill:#f9f,stroke:#333,stroke-width:2px
    classDef storage fill:#ffd,stroke:#333,stroke-width:2px
    classDef code fill:#dff,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Lambda Function"]:::lambda
        L2[(Storage)]:::storage
        L3["Code Component"]:::code
    end
```
