11# SST Integration with Flyt
22
3- This example demonstrates how to integrate Flyt workflows with SST v3 to build a serverless image text extraction service.
3+ This example demonstrates how to integrate Flyt workflows with SST v3 to build a serverless handwritten note transcription service.
44
55## Overview
66
7- This application processes images uploaded to S3 by :
8- 1 . Triggering a Lambda function on image upload
9- 2 . Using Flyt's node-based workflow to orchestrate the process
10- 3 . Extracting text from images using Anthropic's Claude Vision API
11- 4 . Saving the extracted text to a separate S3 bucket
7+ Upload handwritten notes as images to S3 and automatically :
8+ 1 . Extract and transcribe text using Claude Vision
9+ 2 . Generate descriptive titles for the notes
10+ 3 . Save transcriptions as markdown files
11+ 4 . Clean up processed images
1212
1313## Architecture
1414
15- The application uses:
16- - ** SST v3 ** for infrastructure and resource management
17- - ** Flyt ** for workflow orchestration with three nodes:
18- - ` DownloadNode ` : Downloads the image from S3
19- - ` ExtractTextNode ` : Calls Claude Vision API to extract text
20- - ` SaveTextNode ` : Saves the extracted text to S3
21- - ** AWS Lambda** for serverless compute
22- - ** S3** for storage (source images and extracted text)
23- - ** Anthropic Claude** for AI-powered text extraction
15+ - ** SST v3 ** - Infrastructure as code and resource management
16+ - ** Flyt ** - Workflow orchestration with four nodes:
17+ - ` DownloadNode ` - Downloads image and detects MIME type
18+ - ` ExtractTextNode ` - Transcribes using Claude Vision (with retry)
19+ - ` SaveTextNode ` - Saves markdown with generated title
20+ - ` CleanupNode ` - Deletes processed image
21+ - ** AWS Lambda** - Serverless compute
22+ - ** S3** - Image storage and markdown output
23+ - ** Claude Sonnet 4 ** - AI-powered transcription
2424
2525## Prerequisites
2626
@@ -81,15 +81,16 @@ aws s3 cp /path/to/images/ s3://sst-integration-sourceimages-xxxxx/ --recursive
8181
8282### Check Results
8383
84- List the extracted text files:
84+ List the transcribed markdown files:
8585``` bash
8686aws s3 ls s3://sst-integration-extractedtext-xxxxx/
8787```
8888
89- Download and view the extracted text :
89+ Download and view a transcription :
9090``` bash
91- aws s3 cp s3://sst-integration-extractedtext-xxxxx/image.txt ./
92- cat image.txt
91+ # Files are named based on the content, e.g., "Meeting_Notes_Q4_Planning.md"
92+ aws s3 cp s3://sst-integration-extractedtext-xxxxx/Your_Note_Title.md ./
93+ cat Your_Note_Title.md
9394```
9495
9596### Monitor Execution
@@ -136,11 +137,11 @@ This will delete:
136137
137138## Key Features
138139
139- - ** Resource Linking ** : Uses SST v3's resource linking to access S3 buckets and secrets without environment variables
140- - ** Type-Safe Configuration ** : Leverages SST's type-safe configuration
141- - ** Node-Based Workflow ** : Demonstrates Flyt's composable node architecture
142- - ** Error Handling ** : Each node can handle errors independently
143- - ** Scalable ** : Automatically scales with Lambda
140+ - ** Smart Transcription ** : Claude generates both content and descriptive titles
141+ - ** Automatic Cleanup ** : Processed images are deleted to save storage
142+ - ** Error Recovery ** : Retries failed transcriptions up to 3 times
143+ - ** Format Support ** : Handles PNG and JPEG images (skips unsupported formats)
144+ - ** SST Resource Linking ** : Clean access to S3 and secrets without env vars
144145
145146## Project Structure
146147
@@ -157,12 +158,16 @@ cookbook/sst-integration/
157158
158159## How It Works
159160
160- 1 . ** S3 Event Trigger** : When an image is uploaded to the source bucket, S3 sends an event to the Lambda function
161- 2 . ** Flyt Workflow** : The Lambda handler creates a Flyt flow with three connected nodes
162- 3 . ** Download** : The first node downloads the image from S3 using the AWS SDK
163- 4 . ** Extract Text** : The second node sends the image to Claude Vision API for text extraction
164- 5 . ** Save Result** : The final node saves the extracted text to the destination S3 bucket
165-
166- ## Monitoring
167-
168- View Lambda logs in CloudWatch to monitor the workflow execution and debug any issues.
161+ 1 . ** Upload** an image to the source bucket
162+ 2 . ** Download** node fetches the image and detects its type
163+ 3 . ** Extract** node sends to Claude with this prompt:
164+ - Transcribe the handwritten note with markdown formatting
165+ - Generate a descriptive title
166+ - Return as JSON with "content" and "title" fields
167+ 4 . ** Save** node creates a markdown file named after the title
168+ 5 . ** Cleanup** node deletes the original image
169+
170+ The workflow includes:
171+ - ** Retry Logic** : Failed transcriptions retry up to 3 times
172+ - ** Fallback Handling** : Gracefully skips to cleanup on permanent failures
173+ - ** Format Validation** : Only processes PNG and JPEG images
0 commit comments