[data-reveal]{opacity:1!important;transform:none!important}
DocumentationRuntime

Runtime

Reference for the runtime interface, which reports the environment of a running project and registers development servers for external tools.

The @antelopejs/interface-core/runtime module reports the environment a project runs in and keeps a registry of development servers. The AntelopeJS core implements it. ajs project dev, and its former name ajs project run, report development mode. ajs project start reports production mode.

typescript
import {
  GetRuntimeInfo,
  RegisterDevServer,
  DEV_REGISTRY_PATH,
} from "@antelopejs/interface-core/runtime";

GetRuntimeInfo

GetRuntimeInfo returns information about the runtime environment of the running project. Use it to turn on development diagnostics or to register local tools. Development mode is not an authorization boundary, so keep authentication and data-access checks explicit.

typescript
import { GetRuntimeInfo } from "@antelopejs/interface-core/runtime";

const info = await GetRuntimeInfo();
// { dev: true, projectPath: "/path/to/project", env: "default" }
FieldDescription
devtrue when the project runs under ajs project dev. An embedded runtime takes it from the dev option of createRuntime, which defaults to false.
projectPathAbsolute path to the root of the running project.
envName of the active configuration environment.

RegisterDevServer

RegisterDevServer registers a development server and the endpoints it listens on. A module that binds a network port, such as an HTTP API, calls it after listen() succeeds, so external tools can find the real endpoints.

typescript
import { RegisterDevServer } from "@antelopejs/interface-core/runtime";

await RegisterDevServer("api", [
  { protocol: "http", host: "localhost", port: 5011 },
]);

In development mode, the core merges the registration into the dev registry file and deletes the file at shutdown. Outside development mode, the call does nothing, so a module can call it in every mode.

Dev registry file

The dev registry file is at DEV_REGISTRY_PATH (.antelope/dev.json), relative to the project root. The DevServerRegistry type describes its shape, and DevServerEndpoint describes each endpoint entry.

.antelope/dev.json json
{
  "pid": 12345,
  "startedAt": "2026-06-12T10:00:00Z",
  "servers": {
    "api": {
      "endpoints": [{ "protocol": "http", "host": "localhost", "port": 5011 }]
    }
  }
}
Warning

The file is valid only while the process identified by pid exists. When that process is gone, the file is orphaned, so ignore it or overwrite it. At startup in development mode, the core deletes an orphaned file.

See also

  • Configuration describes the environments and module sources that the runtime info refers to.
  • Core utilities lists other functions that the core interface exports.
  • Embedded runtime covers running modules inside an application, where dev comes from the dev option of createRuntime and defaults to false.