
smart-file-sorter
Tired of spending 20-30 minutes every week manually organizing downloaded files? Smart File Sorter is a serverless web application that uses Amazon Bedrock's Nova AI model to automatically analyze, categorize, and sort your files into organized folders the moment you upload them. Built with AWS Lambda, S3, DynamoDB, and API Gateway — all on Free Tier. Simply drag and drop your files, and AI intelligently classifies them into categories like Documents, Invoices, Code, Images, Spreadsheets, and more.
Weekend Annoying Task Challenge: Smart File Sorter
#productivity
Vision & What the App Does
Every week, I deal with dozens of downloaded files cluttering my computer — invoices, screenshots, code snippets, PDFs, spreadsheets — all dumped into one messy folder. Manually sorting them eats up 20-30 minutes of my week. It's tedious, repetitive, and exactly the kind of task that should be automated.
Smart File Sorter is an AI-powered file organization app that automatically categorizes and sorts your files the moment you upload them. Simply drag and drop files into the web interface, and the app uses Amazon Bedrock's Nova AI model to analyze file content and intelligently classify them into categories like Documents, Invoices, Code, Images, Spreadsheets, and more.
The problem it solves is simple: no more manually organizing files. Upload once, and AI handles the rest — placing each file into its proper category folder automatically.
Key Features
- AI-Powered Classification: Uses Amazon Bedrock Nova to understand file content, not just extensions
- Instant Organization: Files are sorted within seconds of upload
- Smart Fallbacks: Extension-based sorting for obvious file types, AI for ambiguous ones
- Dashboard View: See all your files organized by category at a glance
- Drag & Drop Interface: Clean, simple UI that anyone can use
- Serverless Architecture: No servers to manage, scales automatically, costs nearly nothing
How I Built It
I started by identifying the core workflow: upload → classify → sort → display. I wanted to keep it simple but intelligent.
Key Decisions:
- Serverless-first: I chose AWS Lambda + API Gateway to avoid managing servers and keep costs at zero for my usage level.
- Two-stage classification: First, I check file extensions for obvious categorization (
.py→ Code,.jpg→ Images). For ambiguous files, I invoke Amazon Bedrock Nova to read the first 2KB of content and make an intelligent decision.
- S3 event-driven sorting: Rather than sorting synchronously during upload, I used S3 event notifications to trigger the sorter Lambda. This keeps uploads fast and processing asynchronous.
Challenges & Solutions:
- Challenge: Getting Bedrock to return consistent category names. Solution: I constrained the prompt to return ONLY from a predefined list of categories, with temperature set to 0.1 for deterministic outputs.
- Challenge: Handling binary files (images, PDFs) that can't be read as text. Solution: For known binary extensions, I skip the AI step entirely and classify by extension. For unknown binaries, the AI uses the filename pattern.
- Challenge: CORS issues between S3-hosted frontend and API Gateway. Solution: Added proper CORS headers in both the SAM template and Lambda responses.
Development Timeline:
- Hour 1: Set up SAM template and basic Lambda functions
- Hour 2: Implemented Bedrock integration and classification logic
- Hour 3: Built the frontend with drag-and-drop upload
- Hour 4: Testing, debugging, and deployment
AWS Services Used / Architecture Overview
Architecture Diagram
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Frontend │────▶│ API Gateway │────▶│ Lambda │
│ (S3/Amplify)│ └──────────────┘ │ (API) │
└─────────────┘ └──────┬──────┘
│ │
│ Upload via DynamoDB│(metadata)
│ Presigned URL │
▼ ▼
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ S3 Bucket │────▶│ Lambda │────▶│ Amazon │
│ (uploads/) │ event│ (Sorter) │ │ Bedrock │
└─────────────┘ └──────┬───────┘ │ (Nova) │
│ └─────────────┘
▼
┌─────────────┐
│ S3 Bucket │
│(sorted/cat/)│
└─────────────┘Services Used:
Service | Role | Why I Chose It |
|---|---|---|
Amazon S3 | File storage & static hosting | Durable, cheap, event-driven triggers |
AWS Lambda | Compute for sorting & API | Serverless, pay-per-use, Free Tier |
Amazon Bedrock (Nova Lite) | AI file classification | Fast, accurate, no model management |
Amazon DynamoDB | File metadata storage | Serverless NoSQL, Free Tier generous |
Amazon API Gateway | REST API | Managed, scalable, integrates with Lambda |
AWS SAM | Infrastructure as Code | Easy deployment and reproducibility |
How the Agent is Triggered:
The sorting agent (Lambda function) is triggered automatically by an S3 Event Notification whenever a new file is uploaded to the
uploads/ prefix in the S3 bucket. This event-driven architecture means no polling, no cron jobs — files are sorted the instant they arrive.What I Learned
- Amazon Bedrock is surprisingly easy to integrate: The API is straightforward, and Nova models respond quickly. Constraining outputs with specific prompts and low temperature gives reliable, consistent results.
- Event-driven architecture simplifies everything: By using S3 events to trigger sorting, I decoupled the upload experience from the classification process. Users get instant upload confirmation while AI works in the background.
- SAM makes serverless deployment painless: Writing one
template.yamlthat defines all my infrastructure — Lambda functions, S3 buckets, DynamoDB tables, API Gateway — and deploying with a single command is incredibly productive.
- Presigned URLs are the way to go for file uploads: Instead of routing file data through Lambda (size limits, slow), presigned URLs let the browser upload directly to S3. Faster and cheaper.
- Start with the simplest version that works: My first iteration was just extension-based sorting. Adding AI classification on top was an enhancement, not a requirement. This "make it work, then make it smart" approach kept me shipping.
Link to App or Repo
Built for the AWS Weekend Challenge: Turn One Annoying Task Into an App
Powered by Amazon Bedrock, Lambda, S3, DynamoDB, and API Gateway
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article