Skip to main content

Developing Otoroshi

This guide explains how to set up your development environment and work on Otoroshi using mise-en-place as the toolchain manager.

Prerequisites​

You only need two things installed on your machine:

  • git - to clone the repository
  • mise - to manage all other tools automatically

mise will handle installing the correct versions of Java, SBT, and Node.js for you.

Getting started​

Clone the repository​

git clone https://github.com/MAIF/otoroshi.git
cd otoroshi

Or fork the repository first and clone your own fork.

Install the toolchain​

mise install

This installs all the required tools at the exact versions defined in mise.toml:

ToolVersionPurpose
JavaOpenJDK 17Scala backend runtime
SBT1.7.2Scala build tool
Node.js22Frontend build & documentation

Install JS dependencies​

mise run install-js-deps

This installs npm dependencies for both the frontend UI and the documentation site.

You're ready to go!

Development mode​

mise run dev

This starts both the Scala backend (with hot reload) and the frontend webpack dev server in parallel. Once running, access Otoroshi at:

http://otoroshi.oto.tools:9999

If you also want the documentation dev server:

mise run dev-w-doc

Start components individually​

You can also start each component separately:

# Backend only (sbt ~reStart with hot reload)
mise run dev-backend

# Frontend only (webpack dev server on port 3040)
mise run dev-frontend

# Documentation only (Docusaurus dev server)
mise run dev-doc

Customizing the backend environment​

The dev-backend task supports environment variables to configure Otoroshi at startup. Uncomment and edit them in mise.toml or pass them inline:

OTOROSHI_INITIAL_ADMIN_LOGIN=admin@otoroshi.io \
OTOROSHI_INITIAL_ADMIN_PASSWORD=password \
mise run dev-backend

You can also pass JVM args directly to the sbt reStart command by editing the task or using sbt interactively.

Building​

Build everything​

mise run build

This builds the frontend (webpack production bundle) then compiles and assembles the Scala backend into a fat JAR. The output is:

otoroshi/target/scala-2.12/otoroshi.jar

To also build the documentation:

mise run build-w-doc

Build components individually​

# Compile Scala backend only (no jar assembly, faster feedback loop)
mise run compile

# Build backend jar (compile + assembly)
mise run build-backend

# Build frontend production bundle
mise run build-frontend

# Build documentation static site
mise run build-doc

Run the built jar​

After building, you can run Otoroshi locally as a standalone jar:

mise run jar

This starts Otoroshi on port 8080 with file-based storage and default admin credentials (admin@otoroshi.io / password). See the [tasks.jar.env] section in mise.toml to customize.

Testing​

Run the main test suite​

mise run test

Runs the OtoroshiTests suite using the in-memory datastore.

Run plugin tests​

mise run test-plugins

Runs the functional.PluginsTestSpec suite.

Run all backend tests​

mise run test-all

Runs both the main suite and the plugin suite sequentially.

Run a specific test​

For more granular test execution, use sbt directly:

cd otoroshi
sbt 'testOnly *PluginsTestSpec -- -t "plugins should React2SShellDetector"'

Run end-to-end tests​

The project includes Playwright-based E2E tests. You need a running Otoroshi instance first:

# In one terminal
mise run dev

# In another terminal
mise run test-e2e

Formatting code​

Format everything​

mise run fmt

Formats both frontend (prettier) and backend (scalafmt) code.

Format individually​

# Frontend only (prettier)
mise run fmt-frontend

# Backend only (scalafmt)
mise run fmt-backend

Cleaning build artifacts​

mise run clean

Removes backend build outputs, frontend bundles, and documentation build files.

All available tasks​

Run mise tasks to see the full list. Here is a summary:

TaskDescription
Development
devStart backend + frontend in dev mode
dev-w-docStart backend + frontend + doc in dev mode
dev-backendRun otoroshi backend in dev mode (sbt ~reStart, hot reload)
dev-frontendStart frontend webpack dev server (port 3040)
dev-docRun documentation Docusaurus dev server
Build
compileCompile Scala backend (no assembly)
buildBuild otoroshi (frontend + backend jar)
build-w-docBuild otoroshi (frontend + backend + doc)
build-backendBuild otoroshi backend jar (compile + assembly)
build-frontendBuild otoroshi frontend (webpack production)
build-docBuild the documentation static site
Run
jarRun the built otoroshi jar locally
Test
testRun the main backend test suite (OtoroshiTests)
test-pluginsRun the plugins test suite
test-allRun all backend tests (main + plugins)
test-e2eRun Playwright end-to-end tests
Format
fmtFormat all code (frontend + backend)
fmt-frontendFormat frontend code with prettier
fmt-backendFormat Scala code with scalafmt
Install
install-js-depsInstall all JS dependencies (frontend + doc)
install-frontend-js-depsInstall frontend JS dependencies
install-doc-js-depsInstall documentation JS dependencies
Clean
cleanClean all build artifacts

Quick reference​

# First time setup
mise install && mise run install-js-deps

# Daily development
mise run dev # start coding

# Before committing
mise run fmt # format code
mise run test # run tests

# Build a release
mise run build # produce otoroshi.jar
mise run jar # test the jar locally