parent
26a59e419c
commit
055ed3e86d
9 changed files with 665 additions and 122 deletions
@ -1,3 +1,4 @@ |
|||||||
node_modules |
node_modules |
||||||
client/node_modules |
client/node_modules |
||||||
server/node_modules |
server/node_modules |
||||||
|
server/dev.sqlite3 |
@ -1,13 +1,18 @@ |
|||||||
Started from: https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/ |
# MuDBase |
||||||
|
|
||||||
|
MuDBase is a self-hosted database for music. |
||||||
|
|
||||||
TODO: |
It is made for those who use streaming services such as Spotify for keeping track of their music library and tastes, but don't want to rely solely on them for storing this information. |
||||||
|
It is also for power users who would like to organize their music tastes with more powerful tools than only a storage of playlists, albums, artists and songs. MuDBase will offer more rich power features such as tagging and ranking music, and a powerful music querying system. |
||||||
|
|
||||||
- Ranking system |
# Deployment |
||||||
- Have "ranking contexts". These can be stored in the database. |
|
||||||
- Per artist (this removes need for "per album", which can be a subset) |
The easiest deployment is by getting it off of Docker Hub. |
||||||
- Per tag |
The following env variables need to be set for MuDBase to work: |
||||||
- Per playlist |
|
||||||
- Have a linking table between contexts <-> artists/songs. This linking table should include an optional ranking score. |
- MUDBASE_DB_CONFIG: This env variable should contain a JSON struct with MuDBase's database configuration. The JSON should hold a valid Knex.js config struct. In principle, all dialects supported by Knex are supported (postgresql, mysql, mssql, sqlite3, oracledb), but only sqlite3 and postgresql are tested. |
||||||
- The ranking score allows ranking songs per query or per query element. It is a floating point so we can always insert stuff in between. |
|
||||||
- Visually, the system shows ranked items in a table and unranked items in another. User can drag to rank. |
# Architecture |
||||||
|
|
||||||
|
A Node.js Express back-end with a React front-end. |
||||||
|
Started from: https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/ |
@ -0,0 +1,12 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
MUDBASE_DB_CONFIG=$(printenv MUDBASE_DB_CONFIG) |
||||||
|
if [ -z "$MUDBASE_DB_CONFIG" ]; then |
||||||
|
echo "Cannot start MuDBase without a database configuration." >&2 |
||||||
|
echo "Please set the MUDBASE_DB_CONFIG env variable to a valid" >&2 |
||||||
|
echo "Knex.js config JSON object." >&2 |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
echo "Starting MuDBase..." |
||||||
|
cd server && npm start |
@ -1,3 +1,23 @@ |
|||||||
const environment = process.env.ENVIRONMENT || 'development' |
const environment = process.env.ENVIRONMENT || 'development' |
||||||
import config from '../knexfile'; |
import config from '../knexfile'; |
||||||
export default require('knex')(config[environment]); |
import Knex from 'knex'; |
||||||
|
|
||||||
|
if (!Object.keys(config).includes(environment)) { |
||||||
|
throw "No Knex database configuration was found for environment '" + |
||||||
|
environment + "'. Please check your configuration."; |
||||||
|
} |
||||||
|
|
||||||
|
var _knex = undefined; |
||||||
|
|
||||||
|
try { |
||||||
|
_knex = require('knex')(config[environment]); |
||||||
|
} catch (e) { |
||||||
|
throw [ |
||||||
|
"Failed to initialize Knex database connection with config: " |
||||||
|
+ JSON.stringify(config[environment]), |
||||||
|
e |
||||||
|
]; |
||||||
|
} |
||||||
|
|
||||||
|
const knex:Knex = _knex; |
||||||
|
export default knex; |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue