An extremely minimalist video delivery platform made with React and Rust.
I made this project in order to improve my Rust skills, but the code is too messy and inefficient. Possibly at some time I'll do a rewrite with Warp and Solid (or Leptos), with a better base and using Libav rather than spawning FFmpeg commands. Anyway, I'm proud of it and the server can handle any kind of request without crashing.
- Language: TypeScript
- Libs: React, Vite, React HLS Player
- Style: Tailwind
- HTTP: Axios
- Language: Rust
- Libs: Axum, Tokio, Tower HTTP, UUID, Serde
- Protocols: HLS, HTTP 1.1
- Video: FFMPEG, FFMPEG Thumbnailer
To start using Rain you need to install certain programs and build it.
Before build Rain, you need to configure server.toml
- In
server.toml
set the port and the file limit (in bytes)
ip = [0, 0, 0, 0]
port = 3000
file_limit = 10_000_000_000 # In bytes
To use docker, run the following commands.
# Clone the repo
git clone https://github.com/gatomod/rain && cd rain
# Build Dockerfile
docker build -t gatomo/rain:latest .
# Run the container
# - Choose a port. 80 is the default one
# - Volumes are used to preserve data. Choose a path
docker run --name rain -p 80:80 -v /route/to/store/cdn:/server/cdn gatomo/rain
- FFmpeg
- FFmpeg Thumbnailer
- Rust and Cargo
- Node.js and Yarn
If you have all installed, update all to latest versions (not required but recommended).
Run the following command to build server and client
# build client
cd client && yarn build
# build server
cd server && cargo build --release
Run the server
cd server && cargo run --release
/
-GET
Web/assets/:asset
-GET
Web assets/api
- API endpoints/cdn
- Video delivery (HLS)/
-POST
upload multipart/:uuid/video.m3u8
-GET
M3U8 file/:uuid/video#.ts
-GET
Video segments
/data
- Video data (JSON)/
-GET
All UUID videos/:uuid
-GET
Video data
/thumbnail
- Get thumbnails (PNG)/lg/:uuid
-GET
Large/sm/:uuid
-GET
Small
Rain is licensed under the GPL-3 license.
There are some security and performance issues, so is recommended to personal use at home or testing.
🥳 Any PR is welcome! Is a small project, so the guideline is to follow the code style and not make insane purposes.
Gátomo - AGPL-3 License