Skip to content
Switch branches/tags
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time

Black candy logo

Black candy

Test Lint Ruby Style Guide Docker Pulls

Black candy is a self hosted music streaming server built with Rails and Stimulus. The goal of the project is to create a real personal music center.


screenshot theme dark

screenshot theme light

Getting started

Black candy use docker for simplify deployment, development and test process. So you should install docker and docker-compose first.

Black candy support mp3, m4a, ogg, oga, opus, flac, wma and wav formats now.


Black candy has built docker images. You can use docker compose to run all services.

First, you should ensure your music files stored under "/media_data"

Then run:

$ curl > docker-compose.yml
$ docker-compose up -d

That's all. Now, you can use initial admin user to login (email:, password: foobar).

You can also change the docker-compose.yml for your own needs.

Note: When the SECRET_KEY_BASE environment variable is not set, Black candy will generate SECRET_KEY_BASE environment variable every time when service start up. This will cause old sessions invalid, You can set your own SECRET_KEY_BASE environment variable on docker service to avoid it.

Try in PWD

You can try black candy on Play with Docker

Try in PWD

When the service is ready, access black candy from port 80. Then use initial admin user to login (email:, password: foobar). This demo already contains some sample music file. You can go to the setting page and click the sync button of the media path to import the sample music into the database.

And feel free to try it.

List for all sample music for the demo:

If like their music, you can buy their albums to support them.


Pull new image from remote

$ docker pull blackcandy/blackcandy

Restart services:

$ docker-compose restart 



  • Ruby 2.7
  • Postgres 11
  • Redis 6.0
  • Nodejs 12
  • Yarn 1.22
  • Imagemagick 7
  • ffmpeg 4.3

You can use nix to setup dev environment easily.

# First, install nix. You can check out the nix doc for more details.
$ curl -L | sh

# Then clone the repo.
$ git clone

# Change to the directory.
$ cd black_candy

# Go into nix shell, the nix shell will auto setup all dev requirements you need.
$ nix-shell 

# Install foreman.
$ gem install foreman 

# Install requirement gems.
$ bundle

# Install npm packages.
$ yarn

# Setup database.
$ rails db:setup

# Finally, start all services.
$ foreman start -f 


# Runing test
$ rails test RAILS_ENV=test 

# Runing lint
$ rails lint:all 


Black candy support get artist and album image from Discogs API. You can create a API token from Discogs and set Discogs token on Setting page to enable it.