Use streaming RPCs
Move file data as chunks instead of requiring the whole file in memory.
Case Study · Deep Backend Engineering
A gRPC file service designed around reliable streaming, storage integrity, and production observability rather than simple upload and download endpoints.
My role
Backend development & reliability engineering
Stack
NestJS · gRPC · S3 / MinIO · Node.js Streams · SHA-256 · Redis · SigNoz · Sentry · Docker
The service had to move potentially large files between clients and storage while supporting both object storage and direct filesystem modes. A simple buffer-based upload was not enough: the system needed ordering checks, integrity verification, safe overwrite behavior, and useful production telemetry.
I implemented the file workflow around gRPC streaming. Reads use server streaming, while uploads use client streaming so file data arrives in chunks. The service routes storage through S3/MinIO or the local filesystem and applies validation, checksums, atomic writes, cleanup, and observability around the workflow.
The same gRPC contract supports two storage paths. DIRECT mode streams bytes into local storage; S3 mode uses multipart upload for writes and presigned URLs for reads so large binary payloads do not need to pass through the service on download.
Move file data as chunks instead of requiring the whole file in memory.
Write to .tmp, fsync the completed file, then swap it into place so incomplete uploads are not exposed as the final file.
Re-hash the file on disk and compare it with the upload checksum; S3 uploads also verify the final object size.
Return a presigned URL for S3 reads instead of streaming the object bytes through the backend.
Chunked gRPC streaming keeps the workflow bounded instead of loading an entire file into memory.
DIRECT uploads use temporary files and atomic replacement, followed by a read-back SHA-256 verification.
A rolling buffer accumulates chunks into valid multipart sizes and sends the final remainder as the last part.
Telemetry covers request lifecycle, success/error paths, latency, chunk information, and upload/read attributes for investigation in SigNoz.
The service provides a reusable file-transfer layer with explicit streaming semantics, two storage backends, integrity checks, safer overwrite behavior, and production telemetry. The engineering focus is on making file operations predictable and recoverable when things go wrong.