Overview
Learn how AWS S3 provides file storage for Plainform.
Plainform uses AWS S3 for file storage, allowing you to upload and retrieve files like images, documents, and user avatars. The S3 client is configured in lib/amazon/s3.ts and validated by @t3-oss/env-nextjs.
What S3 Provides
AWS S3 offers scalable, secure file storage with:
- File Uploads: Upload files to S3 buckets via the AWS SDK
- Public URLs: Generate URLs to access uploaded files
- Secure Storage: IAM credentials and bucket policies control access
- Scalability: Handle any amount of files with automatic scaling
- Durability: 99.999999999% (11 9's) data durability
How Plainform Uses S3
Plainform uses S3 for:
- User Avatars: Placeholder avatars stored in
mockupUsers/prefix - Email Assets: Logo and images for email templates
- File Uploads: Any user-uploaded content (documents, images, etc.)
The S3 client is initialized in lib/amazon/s3.ts:
import { S3Client } from '@aws-sdk/client-s3';
import { env } from '@/env';
export const s3 = new S3Client({
region: env.AWS_S3_REGION,
credentials: {
accessKeyId: env.AWS_ACCESS_KEY_ID,
secretAccessKey: env.AWS_SECRET_ACCESS_KEY,
},
});Current Usage
Plainform currently uses S3 in:
- Orders API: Retrieves placeholder user avatars from
mockupUsers/folder - Email Templates: References logo images hosted on S3
Alternative Storage Providers
While Plainform uses AWS S3, you can switch to other storage providers:
- Cloudflare R2: S3-compatible API with zero egress fees
- DigitalOcean Spaces: S3-compatible object storage
- Backblaze B2: Cost-effective S3-compatible storage
- Supabase Storage: Built-in storage if using Supabase
- Vercel Blob: Integrated with Vercel deployments
Simply update the S3 client configuration to point to your chosen provider's endpoint.
Learn More
- Setup & Configuration - Configure AWS S3 credentials
- Usage & Integration - Upload and retrieve files
- AWS S3 Documentation - Complete S3 reference
How is this guide ?
Last updated on