feat: add S3 file upload support via pushduck - #2554
Open
abhay-ramesh wants to merge 1 commit into
Open
Conversation
- Add /api/upload route with image and document upload handlers - Add ImageUpload and DocumentUpload React components (DaisyUI styled) - Files upload browser-to-S3 directly via presigned URLs (no server bandwidth) - Auth-gated via NextAuth session in middleware - Add AWS S3 env vars to .env.example (Cloudflare R2 compatible)
|
@abhay-ramesh is attempting to deploy a commit to the BoxyHQ Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds authenticated file upload capability (images and documents) to the SaaS Starter Kit using pushduck (v0.4.0).
Files added/changed:
pages/api/upload/index.ts— upload API route withimageUploadanddocumentUploadhandlerscomponents/FileUpload.tsx—ImageUploadandDocumentUploadReact components (DaisyUI + Tailwind styled).env.example— AWS S3 environment variable stubs (Cloudflare R2 compatible)package.json— addspushduck@^0.4.0dependencyWhy
File upload is one of the most commonly needed features in SaaS applications (profile photos, attachments, documents). The starter kit currently has no file upload mechanism, so every team building on it has to wire this up from scratch.
How it works
pushduck uses the presigned URL pattern — the server generates a short-lived signed S3 URL, and the browser uploads directly to S3. This means:
userId/timestamp/filenameto avoid collisionsEnvironment variables required
Cloudflare R2 is also supported — change the provider to
"cloudflareR2"and addCLOUDFLARE_ACCOUNT_ID.Usage example
Test plan
AWS_S3_*env vars pointing to a real (or localstack) bucket<ImageUpload />— select a JPEG/PNG and confirm it uploads and returns a URL<DocumentUpload />— select a PDF and confirm upload/api/uploadwithout a session returns a 401uploads/<userId>/<timestamp>/<filename>