2026-05-22backend

Cloudinary media upload pipeline introduced

  • Change: app/api/sign-upload/route.ts added as an admin-gated POST endpoint that returns a signed Cloudinary upload token. app/lib/post-actions.ts (createPost Server Action) stores the returned secure_url. app/add/page.tsx becomes the admin post-creation UI; it uploads files directly from the browser to Cloudinary and then calls createPost.
  • 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_URL in the environment; the signature pattern is HMAC-SHA1 which is Cloudinary-specific — any migration to a different storage provider requires rewriting this flow.