# Handling large images & files in a real time chat application — retained record

> Retained reddit record from reddit:webdev.

Canonical: https://highsignal.app/data/records/2e4a704f427f7390

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:webdev)  published 2026-05-31 19:56 ingested 2026-06-01 11:13

[original source ↗](https://www.reddit.com/r/webdev/comments/1tt5n6a/handling_large_images_files_in_a_real_time_chat/)

## extract

<!-- SC_OFF --><div class="md"><p>Hey guys, </p> <p>would love to get some feedback on whether my approach here makes sense. </p> <p>I’m building a real-time chat application where users can upload and receive images/files. Files can be fairly large (up to ~100MB). </p> <p>Current stack is: fastapi, websockets, tanstack, postgres and redis. I use GCP as my cloud provider. </p> <p>My current flow is: </p> <ol> <li><p>Backend generates a signed URL </p></li> <li><p>Frontend uploads directly to a GCS bucket </p></li> <li><p>A Cloud Function handles post-upload processing </p></li> </ol> <p>For downloads, the frontend fetches directly from GCS using redirects/signed URLs so the backend doesn’t become a bottleneck </p> <p>This architecture works great for smaller files (&lt;30MB), but once I started testing larger uploads (100MB images/videos), I noticed very high memory consumption during processing (btw pagination &amp; virtualization is used throughout the project).</p> <p>I’m trying to figure out what’s considered best practice here for large media uploads in chat systems: Should compression/downscaling happen client-side or server-side (currently there is not compression at all)? </p> <p>Also, Is it common to generate thumbnails/previews (for images) separately while keeping the original untouched? </p> <p>Should I stream uploads instead of buffering them? Are Cloud Functions even the right choice for heavy file processing?</p> <p>For images specifically, I’m considering: client-side compression before upload, automatic thumbnail generation, storing multiple resolutions, converting to formats like WebP/AVIF.</p> <p>Would love to hear how you guys handle this in production systems. Thanks!</p> </div><!-- SC_ON --> &#32; submitted by &#32; <a href="https://www.reddit.com/user/omry8880"> /u/omry8880 </a> <br /> <span><a href="https://www.reddit.com/r/webdev/comments/1tt5n6a/handling_large_images_files_in_a_real_time_chat/">[link]</a></span> &#32; <span><a href="https://www.reddit.com/r/webdev/comments/1tt5n6a/handling_large_images_files_in_a_real_time_chat/">[comments]</a></span>

## retained text

No document body was retained for this record — only its metadata was stored.
