An example video streaming app built with the @mux/convex component. It demonstrates how to sync Mux video assets into Convex and stream them in the browser using Video.js 10 with Mux's HLS playback.
@mux/convex— Convex component that syncs Muxassets,uploads,liveStreams, andeventsinto Convex tables, plusvideoMetadatafor app-level data (title, tags, visibility, etc.)- Mux webhook ingestion —
POST /mux/webhookendpoint that verifies and processes Mux webhook events to keep Convex in sync - Backfill migration — One-time action to import existing Mux assets into Convex
@videojs/reactwithMuxVideo— HLS video player that streams directly from Mux using playback IDs stored in Convex- Rsbuild + React 19 frontend with real-time Convex subscriptions
bun installnpx convex devThis will prompt you to create or connect a Convex project and start the dev server.
Set your Mux credentials in Convex:
npx convex env set MUX_TOKEN_ID <your_mux_token_id>
npx convex env set MUX_TOKEN_SECRET <your_mux_token_secret>
npx convex env set MUX_WEBHOOK_SECRET <your_mux_webhook_secret>Add the Convex deployment URL to .env.local for the frontend:
CONVEX_URL=https://<your-deployment>.convex.cloud
PUBLIC_CONVEX_URL=https://<your-deployment>.convex.cloud
In the Mux Dashboard, create a webhook endpoint pointing to:
https://<your-deployment>.convex.site/mux/webhook
If you already have assets in Mux, run the backfill migration to sync them into Convex:
npx convex run migrations:backfillMux '{}'bun run devThe app will be available at http://localhost:3000.
convex/
convex.config.ts # Registers the @mux/convex component
schema.ts # App-level schema
videos.ts # Public queries wrapping the Mux component catalog
http.ts # HTTP router (Mux webhook + test endpoint)
muxHttp.ts # Registers the POST /mux/webhook route
muxWebhook.ts # Verifies and processes Mux webhook events
migrations.ts # One-time backfill of existing Mux assets
src/
index.tsx # Entry point with ConvexProvider
App.tsx # Main app — video player + sidebar
components/
VideoPlayer.tsx # Video.js 10 player with MuxVideo media element
VideoList.tsx # Scrollable list of video thumbnails
| Command | Description |
|---|---|
bun run dev |
Start the dev server |
bun run build |
Build for production |
bun run preview |
Preview the production build |