world 8B, 10% users from pop = 0.8B
system DAU will be 10% of users = 80M
R:W = 10:1
W DAU
All APIs require JWT-based authentication. The token is validated by the API Gateway before requests are routed to backend services.
In addition to authentication, the system enforces authorization checks to ensure that users can only upload, download, or read metadata for files they own or are explicitly allowed to access.
I would separate security into authentication, authorization, and storage protection. JWT proves user identity, but the backend still needs to verify ownership before returning file metadata or chunk URLs. All traffic should use TLS, objects should stay in private buckets, and downloads should use signed URLs or authenticated CDN access. I’d also add malware scanning and audit logging.
1x1
POST /v1/file {file info}-> return {status, error code, location url}
batch
POST /v1/files {files info}-> return {status, error code, location url}
download a file
GET /v1/file/id
GET /v1/files/id={id1, id2,..}
POST /v1/files/{fileId}/finalize
{
"checksum": "sha256-xxx",
"size": 1048576
} request example,
return example: {
"fileId": "f123",
"status": "processing"
}
uploading to processingGET /v1/files/{fileId}/metadata
all above API using JWT as user security token to access endpoints
fileInfo: fileId, name, author, chunkIds:[], updated, created
chunkInfo: fileId, chunkId, chunkUrl
upload(fileId)
👉 Design intent
👉 Why first write to S3?
POST upload(fileInfo)
fileInfo {
fileId,
name,
author,
created,
updated
}
👉 Design intent
topic: file-uploaded
👉 This triggers downstream processing pipeline
A dedicated Object Handler Service consumes Kafka events:
Raw S3 Object
↓
Split into chunks
↓
Fraud Detection
↓
Compression Service
👉 Why pipeline?
👉 Guarantees:
topic: chunk-created
chunkInfo {
fileId,
chunkId,
chunkUrl
}
👉 Design intent
👉 If hit → return immediately
👉 If miss → go backend
[
{chunkId, chunkUrl},
...
]
👉 Why client-side merge?
Failover / Replication Design
For example:
Then:
3. Failover strategy
During failover, the system promotes the most up-to-date replica as the new primary, typically the one with the smallest replication lag or the latest committed log position.