Advanced configuration and customization options for nJukebox
nJukebox uses several configuration files to customize behavior and settings:
The main configuration file contains core application settings:
{
"app": {
"port": 3000,
"host": "localhost",
"adminPin": "1234",
"sessionTimeout": 3600,
"maxPlaylistSize": 100
},
"audio": {
"defaultVolume": 0.8,
"fadeTime": 3000,
"trackLockTime": 10,
"autoDJ": true
},
"spotify": {
"clientId": "",
"clientSecret": "",
"redirectUri": "http://localhost:3000/spotify-callback"
},
"library": {
"musicPath": "./music",
"supportedFormats": [".mp3", ".flac", ".m4a", ".ogg"],
"autoScan": true,
"scanInterval": 300000
},
"visualization": {
"enabled": true,
"effects": ["space", "fire", "particles", "circles"],
"switchInterval": 30
},
"reporting": {
"enabled": true,
"gemaCompliance": true,
"logDetail": "detailed"
}
}
| Setting | Default | Description |
|---|---|---|
port |
3000 | Web server port |
host |
localhost | Bind address (use 0.0.0.0 for network access) |
adminPin |
1234 | Admin panel access code |
sessionTimeout |
3600 | Admin session timeout (seconds) |
maxPlaylistSize |
100 | Maximum tracks in playlist |
| Setting | Default | Description |
|---|---|---|
defaultVolume |
0.8 | Default audio volume (0.0-1.0) |
fadeTime |
3000 | Crossfade duration (milliseconds) |
trackLockTime |
10 | Minutes to lock recently played tracks |
autoDJ |
true | Automatically add tracks when playlist is empty |
| Setting | Default | Description |
|---|---|---|
musicPath |
./music | Path to music directory |
supportedFormats |
[".mp3", ".flac", ".m4a", ".ogg"] | Supported audio file formats |
autoScan |
true | Automatically scan for new music |
scanInterval |
300000 | Auto-scan interval (milliseconds) |
You can override configuration settings using environment variables:
# Server Configuration
NJUKEBOX_PORT=3000
NJUKEBOX_HOST=0.0.0.0
NJUKEBOX_ADMIN_PIN=secretpin123
# Spotify Configuration
SPOTIFY_CLIENT_ID=your_spotify_client_id
SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
# Database Configuration
DATABASE_PATH=./data/custom_location.db
MUSIC_DATABASE_PATH=./data/custom_music.db
# Audio Configuration
DEFAULT_VOLUME=0.8
TRACK_LOCK_TIME=15
AUTO_DJ=true
# Development Mode
DEBUG=true
NODE_ENV=development
To allow access from other devices on your network:
host to 0.0.0.0 in config.jsonhttp://192.168.1.100:3000If port 3000 is in use, change it in multiple places:
port settingFor production deployment behind nginx:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}
nJukebox uses SQLite databases for data storage:
Regular backups are recommended:
# Windows
copy "data\*.db" "backup\%date%\"
# Linux/macOS
cp data/*.db backup/$(date +%Y%m%d)/
When moving between systems:
data/ directoryOptimize for different system sizes:
| System Size | Library Size | Recommended Settings |
|---|---|---|
| Small (Raspberry Pi) | < 1,000 tracks | Disable auto-scan, lower scan interval |
| Medium (Home PC) | 1,000 - 10,000 tracks | Default settings work well |
| Large (Server) | > 10,000 tracks | Enable caching, optimize database |
To add a new language:
locales/en.json to locales/[language].json{
"app": {
"title": "nJukebox",
"subtitle": "Your Digital Music Experience"
},
"navigation": {
"library": "Library",
"playlist": "Playlist",
"search": "Search"
},
"admin": {
"login": "Admin Login",
"settings": "Settings",
"reports": "Reports"
}
}
Override default styles by creating custom.css:
/* Custom color scheme */
:root {
--primary-color: #ff6b35;
--background-dark: #1a1a2e;
--text-primary: #ffffff;
}
/* Custom font */
body {
font-family: 'Your Custom Font', sans-serif;
}
/* Hide admin button for kiosk mode */
.admin-lock {
display: none !important;
}
Add custom visualizations by extending the effects system:
// Custom effect in js/visualizations/custom.js
class CustomEffect {
constructor(canvas, audioData) {
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.audioData = audioData;
}
render() {
// Your custom visualization code
}
}
Extend the API by adding custom routes:
// In jukebox_server.js
app.get('/api/custom/stats', (req, res) => {
// Custom statistics endpoint
res.json({
totalPlays: getTotalPlays(),
topGenres: getTopGenres()
});
});
{
"app": {
"port": 3000,
"host": "localhost",
"adminPin": "1234"
},
"audio": {
"trackLockTime": 1
},
"debug": true
}
{
"app": {
"port": 8080,
"host": "0.0.0.0",
"adminPin": "secure_pin_here"
},
"audio": {
"trackLockTime": 10
},
"reporting": {
"enabled": true,
"logDetail": "essential"
},
"debug": false
}
{
"audio": {
"trackLockTime": 30,
"autoDJ": true,
"maxPlaylistSize": 50
},
"visualization": {
"enabled": true,
"switchInterval": 15
},
"reporting": {
"gemaCompliance": true
}
}