Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gatomod/rain

An extremely minimalist video delivery platform made with Rust and React
https://github.com/gatomod/rain

ffmpeg gatomo hls http react rust video

Last synced: about 1 month ago
JSON representation

An extremely minimalist video delivery platform made with Rust and React

Awesome Lists containing this project

README

        

# Rain
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.

## Technologies
### Frontend
- **Language:** [TypeScript](https://www.typescriptlang.org/)
- **Libs:** [React](https://reactjs.org/), [Vite](https://vitejs.dev/), [React HLS Player](https://www.npmjs.com/package/react-hls-player)
- **Style:** [Tailwind](https://tailwindcss.com/)
- **HTTP:** [Axios](https://axios-http.com/)

### Backend
- **Language:** [Rust](https://www.rust-lang.org/)
- **Libs:** [Axum](https://github.com/tokio-rs/axum), [Tokio](https://tokio.rs/), [Tower HTTP](https://github.com/tower-rs/tower-http), [UUID](https://github.com/uuid-rs/uuid), [Serde](https://serde.rs/)
- **Protocols:** [HLS](https://www.rfc-editor.org/rfc/rfc8216), [HTTP 1.1](https://www.rfc-editor.org/rfc/rfc2616)
- **Video:** [FFMPEG](https://ffmpeg.org/), [FFMPEG Thumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer)

## Getting started
To start using Rain you need to install certain programs and build it.
### Configuration
Before build Rain, you need to configure `server.toml`

- In `server.toml` set the port and the file limit (in bytes)
```toml
ip = [0, 0, 0, 0]
port = 3000
file_limit = 10_000_000_000 # In bytes
```

### Docker
To use docker, run the following commands.
```sh
# 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
```

### Manual build
#### Prerequisites
- FFmpeg
- FFmpeg Thumbnailer
- Rust and Cargo
- Node.js and Yarn

If you have all installed, update all to latest versions (not required but recommended).

#### Building
Run the following command to build server and client
```sh
# build client
cd client && yarn build

# build server
cd server && cargo build --release
```

#### Run
Run the server
```sh
cd server && cargo run --release
```

## API Endpoints
* `/` - `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

## License
Rain is licensed under the [GPL-3 license](https://www.gnu.org/licenses/gpl-3.0.html).

## Usage
There are some security and performance issues, so is recommended to personal use at home or testing.

## Contribute
πŸ₯³ Any PR is welcome! Is a small project, so the guideline is to follow the code style and not make insane purposes.

## Links
- [Donate (via PayPal)](https://paypal.me/gatomooficial)

*GΓ‘tomo - AGPL-3 License*