KatInterview

Design a Resumable, Token-Secured File Transfer Platform

System DesignModel answer
HardModel answerSystem Designdistributed-systemssecuritystorage

Last updated

Design a high-throughput file transfer service that handles multi-gigabyte uploads and downloads with scoped token auth, revocation, chunk integrity, and bounded proxy memory.

Context

A regulated data exchange platform needs to move large files — compliance reports, audit archives, and bulk transaction exports — between internal services and external partners. Files range from a few hundred megabytes to 50 GB. Transfers happen over public internet connections that are occasionally unreliable, and every access must be auditable and revocable.

You are asked to design this system end to end.

What You Need to Support

Transfer capabilities

  • Clients must be able to upload and download files up to 50 GB.
  • If a transfer drops mid-way, the client must be able to pick up from the last successfully transferred chunk rather than restarting from the beginning.
  • Chunks are typically 8–64 MB each.

Access control

  • Issue short-lived, cryptographically signed tokens that encode who the caller is, which resource path they can access, what actions they can take (read / write), and when the token expires.
  • Support rotating signing keys without dropping live traffic.
  • Support immediate revocation of a specific token or all tokens for a given user.

Integrity

  • Detect corruption or tampering at both the chunk level and the whole-file level using checksums (e.g., SHA-256).

Memory discipline

  • Any API gateway or proxy that carries bytes must operate with O(1) memory per active connection, not buffer entire files or chunks.

Non-Functional Targets

DimensionTarget
Concurrent active streams5,000
Availability99.99%
Token validation overhead< 5 ms per request
EncryptionTLS 1.3 in transit, AES-256 at rest
Audit logsImmutable, covering every access and policy decision

Scale Assumptions

  • 100,000 file transfers per day, average size 500 MB, peak 50 GB.
  • Aggregate peak bandwidth: ~40 Gbps.

What Is Expected

Walk through your design covering:

  1. Token format, validation, and revocation — how you keep auth fast while still supporting immediate revocation.
  2. Transfer workflow and API shape — how a client initiates, uploads chunks, resumes after failure, and finalizes.
  3. Data plane architecture — direct-to-storage (pre-signed URLs) vs. proxy streaming, and when you would choose each.
  4. Integrity verification — chunk-level and file-level, including what happens asynchronously after the final chunk lands.
  5. Failure handling — idempotent retries, out-of-order chunk arrival, and mid-transfer revocation.

Call out trade-offs and explain the choices you would make and why.

Hints

Hint 1

Start by sizing the system — compute daily byte volume, per-stream bandwidth, and what happens to proxy memory if you buffer an entire chunk per connection. The numbers will motivate most of your architectural choices.

Hint 2

Token validation latency under 5 ms rules out a round-trip to a central auth server on every request. Think about what you can verify locally and what state you absolutely must check remotely, then design the revocation path around that constraint.

Hint 3

The pre-signed URL and streaming proxy approaches are not mutually exclusive. Consider what property of a tenant's policy should determine which path their traffic takes, and make that a first-class configuration option.