When a healthtech app serves an AI-generated report image to an authenticated customer, large-file throughput changes the design. The useful pattern is to keep the PNG write on the server, store it in a private regional bucket, and return a short-lived signed download link. The API route should return metadata, not a base64 image stuffed into JSON.
Short answer: use a Next.js API route as the authorization boundary, stream or pass the generated PNG to object storage, then sign a GET for the customer. Record the object key and region beside the report record so an evaluator can find the exact artifact later.
That choice is about bytes and control. It keeps storage credentials away from the browser, avoids a second full copy inside a JSON response, and lets the download path use HTTP cache policy deliberately.…