Skip to content


Switch branches/tags

Latest commit


Git stats


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

De Tijdloze Website API

The Tijdloze Website API is built using the Scala programming language and the Play Framework.

The Tijdloze Website API is available as a Docker image: stijnvermeeren/tijdloze-api. Instructions on how to use this Docker image together with the frontend of the Tijdloze Website can be found in the README for the frontend project.

Running in development mode

Database setup

The Tijdloze Website API uses a MySQL database.

Using Docker image

The simplest way to set up the database is by using the Docker image stijnvermeeren/tijdloze-db.

The Docker image has a database tijdloze with

  • The structure of all tables used by the API.
  • All data about artists, albums, songs and list entries.
  • Four dummy users from the Auth0 domain, all with password "secret":
    • (Admin user)
    • (Admin user)

To start this database using docker-compose, simply run the command docker-compose up. By default, the MySQL will be running on port 3306 and the password for the root user will be secret (only use this for local development, obviously). This can be changed by using environment variables (see docker-compose.yml).

The default database configuration for Play (see conf/application.conf) should work out-of-the-box when using the provided docker-compose file.

Manual database setup

Alternatively, to use a different database server, adjust the slick.dbs.default configuration values for Play accordingly (see Configuration section below). The database host can also be configured using the DB_HOST environment variable.

An SQL file to fill a database with the same structure and data as in the Docker image, can be found at docker/db/init.sql.


The Tijdloze Website is designed to work with Auth0 for authentication and authorization.

An Auth0 domain has been set up that can be used for development purposes (though without the ability to create new users beyond the ones listed above under Database setup). The public key for this Auth0 domain can be found at docker/stijnvermeeren-tijdloze-dev.pem.

To use your own Auth0 domain, the API must have access to the public key, so that it can verify the JWT that is sent with each authenticated request. You must point the tijdloze.auth0.publickey.path configuration value for Play to the .pem certificate file containing this public key (see Configuration section below).


Some admin endpoints call the Spotify API. In order for these endpoints to work, you must create your own Spotify keys. The configuration values tijdloze.spotify.clientId and tijdloze.spotify.clientSecret should be set using the personal keys you obtained from Spotify (see Configuration section below). The Tijdloze API only makes use of the client credentials flow.

Starting the API in development mode

sbt run

Building and deploying

sbt dist produces a zip file in target/universal. To run the application, unzip this package and execute bash bin/de-tijdloze-website-api.


To set specific config values, use java system properties: -Dsetting=value

To use a specific config file, use the config.file system property, for example:

  • (in development) sbt -J-Dconfig.file=local/application.conf run
  • (in production) bash bin/de-tijdloze-website-api -Dconfig.file=/path/to/application.conf

To get started, copy the default configuration file at conf/application.conf to local/application.conf, fill in the missing values, and run while specifying local/application.conf as the config file (as described above).

Nginx proxy configuration example

In /etc/nginx/sites-available/tijdloze-api.conf:

server {
  listen 443 ssl;
  listen [::]:443 ssl;

  ssl_certificate /etc/letsencrypt/live/;
  ssl_certificate_key /etc/letsencrypt/live/;

  location /ws/ {

    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

  location / {

server {
  listen 80;
  listen [::]:80;

  location /.well-known { 
    root /srv/httproot;

  location / {
    return 301 https://$server_name$request_uri;

File limit

For dealing with many visitors, make sure that nginx is allowed to open plenty of files (see e.g. this post).

In /etc/sysctl.conf add fs.file-max = 70000.

In /etc/security/limits.conf add

nginx       soft    nofile   10000
nginx       hard    nofile  30000

and then run sysctl -p

In /etc/nginx/nginx.conf add worker_rlimit_nofile 30000; and then run nginx -s reload.

Verify by using cat /proc/{PID}/limits where {PID} is the id of the nginx process.

Systemd service configuration example

In /etc/systemd/system/tijdloze-api.service configure something like

Description=Tijdloze Website API

ExecStart=/bin/bash de-tijdloze-website-api-1.0-SNAPSHOT/bin/de-tijdloze-website-api -Dconfig.file=/home/stijn/tijdloze-api/application.conf


Then you can use for example

  • systemctl daemon-reload (after changing the service config)
  • systemctl start tijdloze-api
  • systemctl status tijdloze-api
  • systemctl restart tijdloze-api
  • systemctl stop tijdloze-api


Build Docker image:

docker build --tag stijnvermeeren/tijdloze-api .


Scala/Play API for De Tijdloze Website







No releases published


No packages published