Skip to content

muxinc/truckload

Repository files navigation

Truckload

Truckload

Migrate your video collection to a new platform with ease.

Getting started

First, clone the repository and install dependencies:

git clone https://github.com/muxinc/truckload.git
cd truckload
npm install

Next, create a .env.local file in the root directory with your API keys and other configuration settings:

cp .env.example .env.local

Finally, start the app:

npm run start:dev

This will start server instances for the Next.js app, Inngest, PartyKit, and ngrok.

Truckload stack

About the Inngest server

Inngest makes serverless queues, background jobs, and workflows effortless. Truckload uses a local Inngest development server to facilitate the loading and migrating of each video.

About the PartyKit server

PartyKit is a comprehensive solution for real-time sync within your application.

In this app, we're really only using it to receive status updates from the video migration background jobs and destination webhooks. Truckload uses a local PartyKit server on port 1999 to receive these notifications and pipe them back to the front-end for status updates.

How it works

Truckload uses a simple workflow to migrate videos from one platform to another. Here's a high-level overview of the process:

Truckload map

Authentication requirements

When using this app to migrate videos to a new platform, you'll need to authenticate with both the source and destination services to ensure that you have the necessary permissions to perform the desired actions (e.g. fetching video metadata, creating master files, uploading videos, etc.)

Here's a list of the authentication requirements for each service:

Provider Requirements Resources
Amazon S3 Access Key and Secret, bucket name, region AWS SDK v3 API docs
Api.video API Key API docs
Cloudflare Stream API Token, Account ID API docs
Mux Token ID and Secret API docs

Handling webhooks

Some destinations (like Mux) use webhooks to communicate migration progress to your application.

This presents a challenge when you're running this app locally, as you'll need a public URL that can be reached by an HTTP request issued by your destination service.

To solve this, you can stand up a free, publicly-accessible tunnel URL using ngrok. Here's how:

  1. Visit https://ngrok.com
  2. Sign in with your existing account or with GitHub
  3. Follow the instructions to install and authenticate ngrok on your machine
  4. Create an ngrok endpoint for your local app by running ngrok http http://localhost:3000
  5. Grab the resulting URL for use as your webhook destination, and append /api/webhooks/[provider]:

Ngrok URL