2026-05-22backend
Cloudinary media upload pipeline introduced
- Change:
app/api/sign-upload/route.tsadded as an admin-gated POST endpoint that returns a signed Cloudinary upload token.app/lib/post-actions.ts(createPostServer Action) stores the returnedsecure_url.app/add/page.tsxbecomes the admin post-creation UI; it uploads files directly from the browser to Cloudinary and then callscreatePost. - Why: Avoids routing large media files through the Next.js server; Cloudinary handles storage and CDN delivery.
- Affected Modules:
app/api/sign-upload/route.ts,app/lib/post-actions.ts,app/add/page.tsx,app/add/add-form.tsx - Trade-offs:
- Pro: Server never handles binary payloads; uploads scale independently of the app.
- Con: Requires
CLOUDINARY_URLin the environment; the signature pattern is HMAC-SHA1 which is Cloudinary-specific — any migration to a different storage provider requires rewriting this flow.