Simple cloud music Library / music Player
musica is a simple cloud-compatible music library and player.
-
Stateless express.js server to handle metadata and (tbd) social listening functionality.
-
Media storage and delivery delegated to an S3 (or S3-like) CDN.
-
Media upload and application management implemented in a separate command-line tool.
-
Front-end built using React, Material-UI, Redux, Howler.
The basic music player functionality is in place, but needs further work to reach parity with other players.
The backend could be improved in several areas:
- Using the 'notification' feature in S3/Minio to capture any changes to the stored audio files or metadata.
(eg updating the index incrementally for each new or changed file) - Choosing a different location for metadata, to better support user interaction like searching.
- Caching the index rather than fetching it anew for each request.
- Including the upload/management features in the same API, rather than with a separate tool.
- More tests.
Missing features:
- Session support - keep the current track (and position) open across reloads
- Shuffle feature
- Search / filtering feature
- Sort by columns
- Seek within a song
- Volume control
- VU meter or visualisation
- Playlists, different track views
- Support for thumbnails
- Automatically reload if new songs are added to the backend
- More tests!
git clone https://github.com/MrTrick/musica.git
cd musica
npm install
musica uses environment variables for configuration, particularly for connecting to the S3 storage.
At minimum, you need to set the following storage server configuration:
(with the appropriate values for your setup)
MUSICA_STORAGE_SERVER=localhost
MUSICA_STORAGE_PORT=9000
MUSICA_ACCESS_KEY=SOMETHINGSOMETHINGEXAMPLE
MUSICA_SECRET_KEY=SOMETHINGSOMETHIGNSOMETHINGSECRETEXAMPLE
MUSICA_BUCKET_NAME=musica
These values could alternatively be written in an .env
file within the top-level musica/
directory.
You can configure musica to use AWS S3, or run your own storage server. See the Minio section further ahead.
musica's default configuration requires an AWS S3-compatible storage server. This can be AWS S3, or there are other options available:
Minio is an S3-compatible object storage server. It can be built and run using Docker:
docker pull minio/minio
docker run -p 9000:9000 --name minio1 -e "MINIO_ACCESS_KEY=SOMETHINGSOMETHINGEXAMPLE" -e "MINIO_SECRET_KEY=SOMETHINGSOMETHIGNSOMETHINGSECRETEXAMPLE" minio/minio server /data
Ensure that the details passed to the Docker instance match those configured in your musica environmental variables.
(For more information see https://docs.minio.io/ )
As a fallback, the app can store media and metadata in a filesystem.
Set the server configuration as:
MUSICA_STORAGE_TYPE=fs
MUSICA_STORAGE_PATH=/var/media
MUSICA_STORAGE_MEDIALOCATION=https://cdn.example.com/media
MUSICA_STORAGE_PATH
is the filesystem location where media and metadata will be stored.MUSICA_STORAGE_MEDIALOCATION
is the URL where the media and metadata can be reached. (Separately from the server process - should run in a static server likenpx http-server
or Nginx.)
The musica bucket needs to be created and the access policies set to allow public read access.
This can be done automatically with:
node musica init
Audio files can be uploaded into musica using the command-line tool:
node musica insert file1.mp3 file2.aac file3.ogg file4.opus...
(Any format supported by both ffmpeg and the npm 'music-metadata' package can be used)
npm start
The integrated react.js client will auto-launch in your browser.