What problem does it solve?
Prevents unsafe, server-mediated file uploads and fragile URL/key handling by providing a secure S3 storage pattern that uses pre-signed browser uploads, stores only object keys, and generates signed downloads on demand.
Core Features & Use Cases
- Presigned direct uploads & downloads: Generates pre-signed PUT URLs for client uploads and pre-signed GET URLs for controlled retrieval, with MIME allowlisting before signing to reduce abuse.
- Key-first storage strategy: Saves the S3 object key (e.g. uploads/uuid.ext) in your database and creates signed URLs when serving, enabling bucket/CDN changes without data migrations.
- Secure upload confirmation + testability: Requires a post-upload confirmation endpoint that validates object existence in S3 (e.g. HeadObjectRequest) before persisting the key, and supports unit tests by mocking S3Client/S3Presigner.
Quick Start
Ask your AI agent to implement services/StorageService.java and config/S3Config.java for S3 presigning and to add an upload confirmation controller that validates the uploaded object in S3 before saving the object key to your database.