# hossain8078/serverless-image-processing-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/hossain8078/serverless-image-processing-pipeline
- Repository: https://github.com/hossain8078/serverless-image-processing-pipeline

## Overview

This application turns an image in the originals bucket into a thumbnail in the resized bucket. Users can start processing by uploading an image, which triggers EventBridge, or by calling the API; both routes start the Step Functions workflow, which invokes the Lambda handler. The handler validates and reads the image, uses Pillow to resize it, then writes the thumbnail. The workflow records success or failure, and CloudWatch receives logs. Infrastructure relationships and workflow details are documented in the README; source excerpts show the handler’s processing steps.

Main entry points: [`src/resize_image/app.py`](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/src/resize_image/app.py) (Resize Lambda), [`statemachine/image_processing.asl.json`](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json) (Resize Task), [`template.yaml`](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml) (Originals Bucket)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_triggers["Entry Triggers"]
  node_api_gateway["API Gateway<br/>[template.yaml]"]
  node_eventbridge["EventBridge Rule<br/>[template.yaml]"]
end

subgraph group_workflow["Workflow Orchestration"]
  node_state_machine["Step Functions"]
  node_resize_task["Resize Task"]
  node_error_pass["Unexpected Error"]
  node_result_choice{{"Result Choice"}}
  node_success_state(("Success State"))
  node_failure_state["Failure State"]
end

subgraph group_processing["Image Processing"]
  node_lambda_handler["Resize Lambda<br/>[app.py]"]
  node_pillow_resize["Pillow Resize<br/>[app.py]"]
end

subgraph group_storage_observability["Storage and Monitoring"]
  node_originals[("Originals Bucket<br/>[template.yaml]")]
  node_resized[("Resized Bucket<br/>[template.yaml]")]
  node_cloudwatch[("CloudWatch Logs<br/>[template.yaml]")]
end

node_client(("API Client"))
node_uploader(("Image Uploader"))

node_client -->|"POST request"| node_api_gateway
node_uploader -->|"uploads image"| node_originals
node_originals -->|"object created"| node_eventbridge
node_api_gateway -->|"starts execution"| node_state_machine
node_eventbridge -->|"starts execution"| node_state_machine
node_state_machine -->|"runs task"| node_resize_task
node_resize_task -->|"invokes"| node_lambda_handler
node_lambda_handler -->|"reads image"| node_originals
node_lambda_handler -->|"resizes image"| node_pillow_resize
node_lambda_handler -->|"writes thumbnail"| node_resized
node_resize_task -->|"handles errors"| node_error_pass
node_resize_task -->|"returns result"| node_result_choice
node_error_pass -->|"records failure"| node_result_choice
node_result_choice -->|"on success"| node_success_state
node_result_choice -->|"otherwise fails"| node_failure_state
node_lambda_handler -.->|"writes logs"| node_cloudwatch
node_state_machine -.->|"logs executions"| node_cloudwatch

click node_api_gateway "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml"
click node_eventbridge "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml"
click node_originals "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml"
click node_state_machine "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_resize_task "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_error_pass "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_result_choice "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_success_state "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_failure_state "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json"
click node_lambda_handler "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/src/resize_image/app.py"
click node_pillow_resize "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/src/resize_image/app.py"
click node_resized "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml"
click node_cloudwatch "https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml"

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_api_gateway,node_eventbridge,node_client toneBlue
class node_state_machine,node_resize_task,node_error_pass,node_result_choice,node_success_state,node_failure_state toneAmber
class node_lambda_handler,node_pillow_resize toneMint
class node_originals,node_resized,node_cloudwatch toneRose
class node_uploader toneIndigo
```

## Components

### Entry Triggers

- [API Gateway](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml): `template.yaml`
- [EventBridge Rule](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml): `template.yaml`

### Workflow Orchestration

- [Step Functions](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`
- [Resize Task](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`
- [Unexpected Error](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`
- [Result Choice](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`
- [Success State](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`
- [Failure State](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/statemachine/image_processing.asl.json): `statemachine/image_processing.asl.json`

### Image Processing

- [Resize Lambda](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/src/resize_image/app.py): `src/resize_image/app.py`
- [Pillow Resize](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/src/resize_image/app.py): `src/resize_image/app.py`

### Storage and Monitoring

- [Originals Bucket](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml): `template.yaml`
- [Resized Bucket](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml): `template.yaml`
- [CloudWatch Logs](https://github.com/hossain8078/serverless-image-processing-pipeline/blob/main/template.yaml): `template.yaml`

### Other components

- **API Client**
- **Image Uploader**

## Connections

- API Client → API Gateway: POST request (evidence: `README.md`)
- Image Uploader → Originals Bucket: uploads image (evidence: `README.md`)
- Originals Bucket → EventBridge Rule: object created (evidence: `README.md`)
- API Gateway → Step Functions: starts execution (evidence: `README.md`)
- EventBridge Rule → Step Functions: starts execution (evidence: `README.md`)
- Step Functions → Resize Task: runs task (evidence: `README.md`)
- Resize Task → Resize Lambda: invokes (evidence: `README.md`)
- Resize Lambda → Originals Bucket: reads image (evidence: `src/resize_image/app.py`)
- Resize Lambda → Pillow Resize: resizes image (evidence: `src/resize_image/app.py`)
- Resize Lambda → Resized Bucket: writes thumbnail (evidence: `src/resize_image/app.py`)
- Resize Task → Unexpected Error: handles errors (evidence: `README.md`)
- Resize Task → Result Choice: returns result (evidence: `README.md`)
- Unexpected Error → Result Choice: records failure (evidence: `README.md`)
- Result Choice → Success State: on success (evidence: `README.md`)
- Result Choice → Failure State: otherwise fails (evidence: `README.md`)
- Resize Lambda → CloudWatch Logs: writes logs (evidence: `README.md`)
- Step Functions → CloudWatch Logs: logs executions (evidence: `README.md`)
