Skip to content

Upload Engine

The Upload Engine is the core component that handles file uploads in Uploadista. It manages the complete upload lifecycle: creating uploads, receiving file data in chunks, tracking progress, and storing files in your configured storage backend.

You don’t interact with the Upload Engine directly - instead, you configure the Uploadista Server which uses the Upload Engine internally. However, understanding how it works helps you:

  • Debug upload issues
  • Optimize for large files
  • Understand why resumable uploads are reliable
  • Know what happens when a flow processes uploaded files

Every file upload goes through these stages:

┌─────────────────────────────────────────────────────────────────────┐
│ UPLOAD LIFECYCLE │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ 1. CREATE 2. UPLOAD CHUNKS 3. COMPLETE │
│ ──────── ──────────────── ──────────── │
│ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ Client │ │ Client │ │ Upload │ │
│ │ Request │ │ Sends │ │ Ready │ │
│ │ Upload │ ──► │ Data │ ──► │ for Use │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
│ │ KV Store│ │ Data │ │ Flow │ │
│ │Metadata │ │ Store │ │ Trigger │ │
│ └─────────┘ └─────────┘ └─────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────┘

When an upload starts, the engine:

  1. Generates a unique upload ID
  2. Stores metadata in the KV Store (file name, size, type)
  3. Returns the upload ID to the client

At this point, no file data has been transferred yet.

The client sends file data, either:

  • All at once - For small files (< 10MB)
  • In chunks - For larger files (recommended)

The engine:

  1. Receives each chunk
  2. Writes it to the Data Store
  3. Updates the offset in the KV Store
  4. Emits progress events via Event System

When all bytes are received:

  1. The upload is marked as complete
  2. A completion event is emitted
  3. If the upload was initiated by a Flow, the flow execution resumes to continue processing

One of the Upload Engine’s key features is resumable uploads. If a connection drops mid-upload, the client can resume from where it left off.

Initial upload attempt:
────────────────────────────────────────────────►
[████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░]
Connection lost at 25%
Resume upload:
────────────────────────────────────►
[████████████████████████████████████████████████]
▲ ▲
Resume from offset 25% Complete!
  1. Offset tracking - The KV Store records how many bytes have been received
  2. Client queries offset - Before resuming, the client asks “where did we leave off?”
  3. Resume from offset - The client sends only the remaining data
  4. No re-upload needed - Already-received data is preserved
ScenarioWithout ResumableWith Resumable
100MB file, connection drops at 90%Re-upload all 100MBUpload remaining 10MB
Mobile user on flaky networkFrequent failuresGraceful recovery
Large video uploadFrustrating experienceReliable upload

The Upload Engine can be used in two different ways:

For simple file storage without processing, use the Upload Engine directly:

User uploads file
┌───────────────┐
│ Upload Engine │ ──► Stores file in Data Store
└───────────────┘
File ready for use

This is ideal when you just need to store files without any transformations.

When you need to process files (resize, optimize, transform), the Flows Engine orchestrates the upload:

User triggers flow
┌───────────────┐
│ Flows Engine │ ──► Creates a job
└───────────────┘
┌───────────────┐
│ Input Node │ ──► Initiates upload via Upload Engine
└───────────────┘
┌───────────────┐
│ Upload Engine │ ──► Stores file in Data Store
└───────────────┘ (flow paused during upload)
┌───────────────┐
│ Flows Engine │ ──► Resumes after upload completes
└───────────────┘
Processing nodes
(resize, optimize...)
Output nodes save
processed files

When a flow executes:

  1. The flow creates a job and starts executing
  2. Input nodes use the Upload Engine to receive files
  3. The flow pauses while waiting for uploads to complete
  4. Once uploads finish, the flow resumes processing
  5. Processing nodes transform the files
  6. Output nodes save results to storage

The Upload Engine exposes these HTTP endpoints (mounted by the Uploadista Server):

MethodEndpointDescription
POST/uploadista/api/uploadCreate a new upload
HEAD/uploadista/api/upload/:idGet upload offset (for resume)
PATCH/uploadista/api/upload/:idUpload file data/chunk
GET/uploadista/api/upload/:idGet upload status and metadata
DELETE/uploadista/api/upload/:idCancel/delete an upload
POST /uploadista/api/upload
Content-Type: application/json
{
"fileName": "photo.jpg",
"size": 5242880,
"type": "image/jpeg"
}

Response:

{
"id": "upload_abc123",
"offset": 0,
"metadata": {
"fileName": "photo.jpg",
"size": 5242880,
"type": "image/jpeg"
}
}
PATCH /uploadista/api/upload/upload_abc123
Content-Type: application/offset+octet-stream
Upload-Offset: 0
[binary data]

Response:

{
"id": "upload_abc123",
"offset": 1048576
}
HEAD /uploadista/api/upload/upload_abc123

Response header:

Upload-Offset: 1048576

While you can use these endpoints directly, we recommend using the official clients which handle chunking, resumability, and progress tracking for you:

The Upload Engine emits events via WebSocket for real-time progress tracking:

EventWhenPayload
upload_startedUpload createduploadId, fileName, size
upload_progressChunk receiveduploadId, progress, bytesUploaded
upload_completeAll bytes receiveduploadId, url
upload_errorUpload faileduploadId, error

See Event System for how to subscribe to these events.