Skip to main content
The orion repl command lets you evaluate expressions against a running Orionjs dev server. It connects to the server over HTTP, runs your code, and prints the result — perfect for querying services, testing methods, running one-off data fixes, or inspecting app state.

Setup

Start your dev server with the --repl flag:
This enables a POST /__repl endpoint on your server and writes the port to .orion/port for auto-discovery.

Usage

In a separate terminal:
The expression runs inside an async function with getInstance from @orion-js/services available as a parameter, so you can use await and return directly.

Options

How It Works

  1. orion dev --repl sets ORION_REPL=true on the spawned app process
  2. When @orion-js/http starts, it registers a POST /__repl endpoint and writes the port to .orion/port
  3. orion repl -e "..." sends an HTTP POST to http://localhost:<port>/__repl
  4. The endpoint evaluates the expression via an AsyncFunction with getInstance in scope
  5. The result is returned as JSON and printed by the CLI

Examples

Simple expression

Query a service

Run a data migration

Inspect a collection

Specify a custom port

Tips

  • The getInstance function is injected as a parameter — use it to grab any registered service or repository.
  • The REPL runs against the live app, so all connections (MongoDB, etc.) are already established.
  • Use return to output a value. If you don’t return anything, nothing is printed.
  • For complex expressions, use multi-line strings or put your code in a script file instead.
  • The --repl flag is opt-in and only recommended for development. Do not enable it in production.

Claude Code Custom Skill

You can add the following as a Claude Code custom command at .claude/commands/orion-repl.md so Claude can interact with your Orionjs app directly: