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:
POST /__repl endpoint on your server and writes the port to .orion/port for auto-discovery.
Usage
In a separate terminal:async function with getInstance from @orion-js/services available as a parameter, so you can use await and return directly.
Options
| Flag | Description |
|---|---|
-e, --expression <expr> | (Required) The TypeScript expression to evaluate |
--port <port> | Port of the dev server (default: auto-detect from .orion/port, then PORT env, then 3000) |
How It Works
orion dev --replsetsORION_REPL=trueon the spawned app process- When
@orion-js/httpstarts, it registers aPOST /__replendpoint and writes the port to.orion/port orion repl -e "..."sends an HTTP POST tohttp://localhost:<port>/__repl- The endpoint evaluates the expression via an
AsyncFunctionwithgetInstancein scope - 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
getInstancefunction 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
returnto 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
--replflag 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: