Free and Open-source video streaming suite.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4.4 KiB

Miracle TV

MIRACLE IS CURRENTLY NOT PRODUCTION READY (as I hope is evident from this repository)

Backend portion of the MiracleTV Streaming Suite.

Uses PostgreSQL, TypeScript, Express and Nix

Streaming is supported by Nginx RTMP and OSSRS

This package is intended to work with

MiracleTV Frontend and

MiracleTV Shared


v1.0.0 Coming when it's done

Running in produciton

Nix / NixOS

You can run this with nix / nixos as a package

As a user package

  1. Download default.nix and save it, i.e. as miracle-tv.nix;
  2. Run nix-env -i -f miracle-tv.nix to install locally;
  3. Use miracle-tv-server binary, i.e. miracle-tv-server --configPath=/path/to/your/config.json (See /config/local.json for examples)

As a system module

  1. Import a module declaration into your configuration.nix from git or using fetchfile, i.e.
    imports = [
        "${builtins.fetchurl {
            url = "";
            sha256 = "0k04z1w6yrr3f9g7g5dpdrdkx9lazf273nsb23zq1zp0mgd4dd71";


[Be mindful!] This example uses a version of the module fixed to a commit.

While this is a good practice, this particular example might be outdated.

It is recommended to find a more recent commit and use nix-prefetch-url to get sha256 value;

$ nix-prefetch-url

path is '/nix/store/zvsjjia6ppb35icywvgl9ljcn41q7svh-module.nix'


  1. In your config further, enable miracle-tv service
  services.miracle-tv = {
    enable = true;
    settings = {
      database.connection = {
        database = "miracle";
        user = "miracle";
  1. Run nixos-rebuild switch (or sudo nixos-rebuild switch) to rebuild your system and start the service.
  2. Check local connection availability with curl http://localhost:8080/api/v1/channels, if response is {"data":[], "status": "ok"}, then you're all set!

Other Distros

  1. Have node > 14.0 installed and yarn
  2. Checkout project dir
  3. yarn && yarn build:server
  4. node ./dist/server/server.js --configPath=/path/to/config.json (check /config/local.json for examples)
  5. (Optional) Use process manager of your choice (Built-in process manager coming some time later!)



Simply use nix-shell inside project folder (or use a tool like direnv) to drop into development environment already set up

  1. nix-build in project folder builds default derivation and dumps it into result/. Make sure to check the executable before pushing final commits and do not commit result/ in!
  2. Make sure to run rm yarn.nix && yarn2nix > yarn.nix after adding new yarn packages before you commit

Other Distos

Make sure you have node >14.0 and yarn installed, as well as all necessary tools to build node packages.

Common procedure

  1. Install dependencies with yarn
  2. Use yarn watch:server to continously watch and restart yarn
  3. Use yarn build:server to produce a working build into dist/ directory
  4. Use yarn test to run a test suite on the server

Contribution Checklist

Nix / NixOS

  • Make sure that nix-build produces usable output.
    1. An output is considered usable if it's runnable via ./result/bin/miracle-tv-server --configPath=./config/local.json
  • If adding a new package, do not forget to generate new yarn.nix by running yarn2nix > yarn.nix
    1. yarn2nix should be available inside nix-shell
    2. A good idea is to run nix-collect-garbage && nix-build after that to make sure project builds

Other Distros

  • Make sure that yarn build:server produces usable output
    1. An output is considered usable if it's runnable via node ./dist/server/server.js --configPath=./config/local.json;
  • If adding a new package, mention that you cannot update yarn.nix when opening a pull-request
    1. Somebody should be able to update it and commit it into your pull-request or otherwise help you out