Skip to content

Running the Console from Its Source

Use this page to run the console on your own computer, against a Tadoru server that runs on the same computer. The console then reloads as you change its code. A server built with the feature console serves the console itself on console_listen, so you need these steps only to work on the console.

  • A Tadoru server that runs on this computer. Its API listens on a Unix socket, api.sock, in its runtime root, the directory that holds the socket of the server. --runtime-dir names that directory (The command line).
  • mise, which installs the versions of Node and pnpm that the console needs.
  • socat, which connects a TCP port to the socket of the server. On a Mac, install it with Homebrew: brew install socat.
  1. Start the Tadoru server, and name its runtime root. For example, at the root of the repository:

    Terminal window
    cargo run -p tadoru -- --data-dir ./data --runtime-dir ./data/run
  2. In a terminal, connect the port 8080 to the socket of the server. Use the path of the socket on your computer:

    Terminal window
    socat TCP-LISTEN:8080,bind=127.0.0.1,reuseaddr,fork UNIX-CONNECT:./data/run/api.sock

    The path in this example is relative to the root of the repository, so run the command there. Keep this terminal open while you work.

  3. In console/, the folder of the console in the Tadoru repository, copy .env.example to .env.local. Make sure that it holds this line:

    Terminal window
    TADORU_API_URL=http://127.0.0.1:8080

    Git ignores .env.local, so the file stays on your computer.

  4. Install the tools and the packages once, in console/. mise reads mise.toml at the root of the repository, so mise install works there too:

    Terminal window
    mise install
    pnpm install --frozen-lockfile
  5. Start the console, in console/:

    Terminal window
    pnpm dev
  6. Open the address that pnpm dev prints, usually http://localhost:5173/.

The dev server sends each request for /api to the address in TADORU_API_URL. socat passes it on to the socket, so the console and the server meet as they do in a release.

  • A reload keeps your session, because the console reads it back from the server. A server older than GET /api/session cannot give it back, and then the console asks you to log in again.
  • If the server has no administrator yet, click “Set up Tadoru” on the login page. Read Setting Up the First Administrator.
  • If socat stops, or the server stops, each read of the console fails with a network error. Start them again, then use “Try again” or “Read again”.
  • Port 8080 must be free. If another program uses it, choose another port in the socat command and in TADORU_API_URL.