AI prompts
base on Rust library for Media over QUIC 
[](https://discord.gg/FCYF3p99mr)
[](https://crates.io/crates/moq-lite)
[](https://www.npmjs.com/package/@kixelated/moq)
<p align="center">
<img height="128px" src="https://github.com/kixelated/moq/blob/main/.github/logo.svg" alt="Media over QUIC">
</p>
# Media over QUIC
[Media over QUIC](https://quic.video) (MoQ) is a next-generation live media delivery protocol that provides **real-time latency** at **massive scale**.
Built on modern web technologies like [WebTransport](https://developer.mozilla.org/en-US/docs/Web/API/WebTransport_API) and [WebCodecs](https://developer.mozilla.org/en-US/docs/Web/API/WebCodecs_API), MoQ delivers WebRTC-like latency with CDN-like distribution.
**Key Features:**
- š **Real-time latency** via QUIC stream priotization and partial reliability.
- š **Massive scale** via edge caching, fanout, and multi-region clustering.
- š **Browser support** via WebTransport and WebCodecs.
- š§ **Generic transport** for any live data, not just media
- šÆ **Simple API** with both Rust and TypeScript implementations
> **Note:** This project is a [fork](https://quic.video/blog/transfork) of the [IETF MoQ specification](https://datatracker.ietf.org/group/moq/documents/). The focus is narrower, focusing on simplicity and deployability.
## Architecture
MoQ is designed as a layered protocol stack.
**Rule 1**: The CDN MUST NOT know anything about your application, media codecs, or even the available tracks.
Everything could be fully E2EE and the CDN wouldn't care. **No business logic allowed**.
Instead, [`moq-relay`](rs/moq-relay) operates on rules encoded in the [`moq-lite`](https://docs.rs/moq-lite) header.
These rules are based on video encoding but are generic enough to be used for any live data.
The goal is to keep the server as dumb as possible while supporting a wide range of use-cases.
The media logic is split into another protocol called [`hang`](https://docs.rs/hang).
It's pretty simple and only intended to be used by clients or media servers.
If you want to do something more custom, then you can always extend it or replace it entirely.
Think of `hang` as like HLS/DASH, while `moq-lite` is like HTTP.
```
āāāāāāāāāāāāāāāāāāā
ā Application ā š¢ Your business logic
ā ā - authentication, non-media tracks, etc.
āāāāāāāāāāāāāāāāāāā¤
ā hang ā š¬ Media-specific encoding/streaming
ā ā - codecs, containers, catalog
āāāāāāāāāāāāāāāāāāā
ā moq-lite ā š Generic pub/sub transport
ā ā - broadcasts, tracks, groups, frames
āāāāāāāāāāāāāāāāāāā¤
ā WebTransport ā š Browser-compatible QUIC
ā QUIC ā - HTTP/3 handshake, multiplexing, etc.
āāāāāāāāāāāāāāāāāāā
```
## Setup
### Easy Mode
- [Nix](https://nixos.org/download.html)
```sh
# Runs a relay, demo media, and the web server
nix shell -c just all
```
Then visit [https://localhost:8080](https://localhost:8080) to see the demo.
### Easier Mode
- [Direnv](https://direnv.net/)
```sh
# Applies the nix shell within the repo.
just all
```
### Hard Mode
Or if you don't like Nix, you can install dependencies manually.
- [Rust](https://www.rust-lang.org/tools/install)
- [Node.js](https://nodejs.org/)
- [Just](https://github.com/casey/just)
- [pnpm](https://pnpm.io/)
- [FFmpeg](https://ffmpeg.org/download.html)
- [GStreamer](https://gstreamer.freedesktop.org/documentation/installing/index.html) (optional)
- ...probably some other stuff
**Run it:**
```sh
# Install some additional dependencies
just setup
# Runs a relay, demo media, and the web server
just all
```
Then visit [https://localhost:8080](https://localhost:8080) to see the demo.
## Libraries
This repository provides both [Rust](/rs) and [TypeScript](/js) libraries with similar APIs but language-specific optimizations.
### Rust
| Crate | Description | Docs |
|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [moq-lite](rs/moq) | The core pub/sub transport protocol. Has built-in concurrency and deduplication. | [](https://docs.rs/moq-lite) |
| [moq-relay](rs/moq-relay) | A clusterable relay server. This relay performs fan-out connecting multiple clients and servers together. | |
| [moq-token](rs/moq-token) | An authentication scheme supported by `moq-relay`. Can be used as a library or as [a CLI](rs/moq-token-cli) to authenticate sessions. | |
| [moq-native](rs/moq-native) | Opinionated helpers to configure a Quinn QUIC endpoint. It's harder than it should be. | [](https://docs.rs/moq-native) |
| [hang](rs/hang) | Media-specific encoding/streaming layered on top of `moq-lite`. Can be used as a library or [a CLI](rs/hang-cli). | [](https://docs.rs/hang) |
| [hang-gst](rs/hang-gst) | A simple gstreamer plugin for publishing or consuming hang broadcasts. | |
| [hang-wasm](rs/hang-wasm) | A deprecated web player using WASM. Use the Typescript implementation instead. | |
### TypeScript
| Package | Description | NPM |
|------------------------------------------|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
| **[@kixelated/moq](js/moq)** | The core pub/sub transport protocol. Has built-in concurrency and deduplication. | [](https://www.npmjs.com/package/@kixelated/moq) |
| **[@kixelated/hang](js/hang)** | Media-specific encoding/streaming layered on top of `moq-lite`. Provides both a Javascript API and Web Components. | [](https://www.npmjs.com/package/@kixelated/hang) |
| **[@kixelated/hang-demo](js/hang-demo)** | Examples using `@kixelated/hang`. | |
## Protocol
Read the specifications:
- [moq-lite](https://kixelated.github.io/moq-drafts/draft-lcurley-moq-lite.html)
- [hang](https://kixelated.github.io/moq-drafts/draft-lcurley-hang.html)
- [use-cases](https://kixelated.github.io/moq-drafts/draft-lcurley-moq-use-cases.html)
## Development
```sh
# See all available commands
just
# Build everything
just build
# Run tests and linting
just check
# Automatically fix some linting errors
just fix
# Run the demo manually
just relay # Terminal 1: Start relay server
just pub tos # Terminal 2: Publish a demo video using ffmpeg
just web # Terminal 3: Start web server
```
There are more commands: check out the [Justfile](Justfile), [rs/Justfile](rs/Justfile), and [js/Justfile](js/Justfile).
## License
Licensed under either:
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
", Assign "at most 3 tags" to the expected json: {"id":"4391","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"