Skip to content

svnoak/dansbart.se

Repository files navigation

Dansbart.se

Swedish folk music discovery platform powered by AI-driven dance style classification.

Overview

Dansbart.se is a platform for finding Swedish folk music to dance to. It uses machine learning to analyse and classify tracks by dance style — Polska, Hambo, Vals, and more — based on tempo, rhythm, and audio characteristics.

Architecture

frontend/               # React 19 + TypeScript + Tailwind CSS v4
backend/
  api/                  # Java Spring Boot REST API
  workers/
    feature/            # Python Celery worker (ML feature extraction, light tasks)
    audio/              # Python Celery worker (audio analysis via Essentia)

Service communication:

React frontend --> Java API (REST, :8000) --> PostgreSQL (jOOQ + pgvector)
                         |
                    Redis / Celery
                         |
             feature worker + audio worker

Technology Stack

Frontend: React 19, TypeScript, Tailwind CSS v4, Vitest

Backend API: Java 21, Spring Boot 3.2, jOOQ, Flyway, PostgreSQL + pgvector

Workers: Python, Celery, Redis

  • Feature worker: ML feature extraction and light background tasks
  • Audio worker: audio download and analysis via NeckenML Analyzer + Essentia (requires linux/amd64)

Getting Started

Prerequisites

  • Docker and Docker Compose
  • Git
  • 4GB+ RAM recommended

Installation

  1. Clone the repository:

    git clone https://github.com/svnoak/dansbart.se.git
    cd dansbart.se
  2. Set up environment variables:

    cp .env.example .env
    # Edit .env with your configuration
  3. Download MusiCNN models (required for audio analysis):

    cd backend/workers/audio && ./scripts/download_models.sh
  4. Start the full stack:

    docker compose up
  5. Access the application:

Running Services Individually

# Frontend dev server only
docker compose up frontend

# API + dependencies
docker compose up backend db redis

# Audio worker only
docker compose up worker-audio db redis

# All workers
docker compose up worker-audio worker-feature

Development

Java API

cd backend/api
./mvnw clean install          # build
./mvnw spring-boot:run         # run locally
./mvnw test                    # tests
./mvnw generate-sources -Pgenerate-jooq  # regenerate jOOQ after schema changes

Database migrations are managed by Flyway and run automatically on startup.

React Frontend

cd frontend
npm install
npm run dev           # Vite dev server (port 5173)
npm run test:run      # Vitest
npm run build         # production build
npm run api:update    # re-export OpenAPI spec and regenerate TypeScript client

Python Workers

# Feature worker
cd backend/workers/feature
pip install -r requirements.txt
celery -A app.core.celery_app worker --loglevel=info --pool=solo -Q feature,light
pytest

# Audio worker (requires linux/amd64)
cd backend/workers/audio
pip install -r requirements.txt
celery -A app.core.celery_app worker --loglevel=info --pool=solo -Q audio
pytest

Deployment

Production images are built and pushed to GitHub Container Registry via CI on every merge to main:

  • ghcr.io/svnoak/dansbart-frontend:production
  • ghcr.io/svnoak/dansbart-api:production
  • ghcr.io/svnoak/dansbart-feature-worker:production
  • ghcr.io/svnoak/dansbart-audio-worker:production

Open Dataset

Analysis data and human feedback are publicly accessible:

  • API: GET /api/export/dataset
  • License: CC BY 4.0
  • Example scripts: examples/

License

AGPL-3.0 — see LICENSE.

The core analysis engine, NeckenML Analyzer, is a separate MIT-licensed library.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for guidelines — all PRs must be linked to an issue.


About

This is the codebase for the website dansbart.se which provides users with tracks to find to dance swedish folkdance to.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors