Image Upload Handling
Images in the dashboard (article thumbnails and editor-inserted images) are uploaded directly to S3. The backend generates a short-lived signed URL, and the browser uploads directly to it.
Upload Flow
Section titled “Upload Flow”-
User selects or drops an image file.
-
Client-side validation —
src/lib/s3-upload.tschecks file type and size before making any network request. -
Request a signed URL — the upload helper calls
POST /api/v1/sign-s3(set inVITE_UPLOAD_URL) with the filename and MIME type. -
Backend returns the signed URL — a pre-signed S3
PUTURL that expires in 5 minutes, plus the final public object URL. -
Upload directly to S3 — the helper sends a
PUTrequest to the signed URL with the file as the body. The file goes straight to S3 — not through the Express server. -
Save the public URL — the returned public URL is stored in the article’s thumbnail field or inserted into the CKEditor body.
Key Files
Section titled “Key Files”| File | Purpose |
|---|---|
src/lib/s3-upload.ts | Upload helper with retry and progress tracking |
src/lib/s3-config.ts | S3 client configuration from Vite env vars |
src/components/ui/ckeditor.tsx | CKEditor with built-in S3 upload adapter |
In-Editor Uploads
Section titled “In-Editor Uploads”When you drop or paste an image into the CKEditor, the upload adapter inside ckeditor.tsx runs the same flow automatically. The image is uploaded and the public URL is inserted as an <img> tag in the article body.