Private PDF Exports in Next.js: Two Signed Storage Link Architectures
The article recommends generating PDFs in a Next.js API route or background job, storing them in a private bucket, and issuing short-lived signed download URLs only after confirming the object exists. It argues the choice between an app-mediated design and a provider-direct design concerns system shape rather than PDF libraries, with the app-mediated approach suited to strict per-tenant access rules. The author favors keeping authorization in the application, accepting an extra API hop in exchange for easier inspection. Key invariants include unguessable tenant-scoped object keys and re-checking user, tenant membership, and export status before every download link is issued. Links are kept short-lived and created on demand, since permanent direct links are inappropriate when storage lacks public ACLs.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in