MediaKit Documentation
Self-hosted video streaming + image optimization. The open-source Mux + Cloudinary alternative.
What is MediaKit?
MediaKit is a complete media infrastructure platform you deploy on your own servers. It handles:
- Video uploads — Presigned URL uploads directly to S3/R2 (bypasses your server)
- HLS transcoding — FFmpeg pipeline creates 360p/480p/720p/1080p renditions with adaptive bitrate
- Image transforms — On-demand resize, crop, format conversion with CDN caching
- React SDK — Drop-in components for video players, uploaders, and galleries
- Embed script — Single
<script>tag to embed videos anywhere - Analytics — Play counts, watch time, viewer insights
- AI analysis — Video summaries, chapter generation, content moderation
- Webhooks — HMAC-signed event delivery for integration
Architecture
text
┌─────────────┐ ┌──────────────┐ ┌───────────┐
│ React SDK │────▶│ Go API │────▶│ PostgreSQL│
│ or Embed │ │ (Gin+GORM) │ └───────────┘
└─────────────┘ │ │ ┌───────────┐
│ FFmpeg jobs │────▶│ Redis │
┌─────────────┐ │ Image proxy │ └───────────┘
│ Admin Panel │────▶│ Webhooks │ ┌───────────┐
│ (Next.js) │ │ Analytics │────▶│ R2 / S3 │
└─────────────┘ └──────────────┘ └───────────┘Tech Stack
| Layer | Technology |
|---|---|
| API | Go 1.24 + Gin + GORM |
| Database | PostgreSQL 16 |
| Cache & Jobs | Redis 7 + asynq |
| Storage | Cloudflare R2 / AWS S3 / Backblaze B2 |
| Video | FFmpeg (HLS transcoding) |
| Frontend | Next.js 16 + React 19 + Tailwind CSS |
| React SDK | Vite library mode → npm package |
| Embed | Vite IIFE → single script |
| Monorepo | Turborepo + pnpm workspaces |
| AI | Vercel AI Gateway (Claude) |
API Base URL
All API endpoints are prefixed with your API domain. Throughout these docs we use:
text
https://mediakitapi.gritcms.comReplace with your own domain when self-hosting.