CLI

Dev server, build, start, type checking, and project scaffolding.

@miiajs/cli provides commands for developing, building, and running MiiaJS applications across Bun, Deno, and Node.js.

Installation

npm install -D @miiajs/cli

Commands

miia dev

Start the development server with hot reload and type checking:

miia dev
miia dev --runtime bun
miia dev --entry src/server.ts --env-file .env.local

Runs two parallel processes:

  1. TypeScript compiler in watch mode (tsc --noEmit --watch)
  2. Development server with file watching
FlagDefaultDescription
--runtime, -rauto-detectedRuntime: bun, deno, node
--entrysrc/main.tsEntry point file
--env-file.env (if exists)Environment file path

miia build

Build the project for production:

miia build
miia build --runtime node
RuntimeBehavior
Bun / Denotsc --noEmit (type-check only)
Node.jstsc (full compilation to dist/)
FlagDefaultDescription
--runtime, -rauto-detectedRuntime: bun, deno, node

miia start

Start the production server:

miia start
miia start --runtime node --dist dist/app.js
miia start --env-file .env.production
RuntimeCommand
Bunbun src/main.ts
Denodeno run --allow-all src/main.ts
Node.jsnode dist/main.js

Sets NODE_ENV=production for Bun and Node.js.

FlagDefaultDescription
--runtime, -rauto-detectedRuntime: bun, deno, node
--entrysrc/main.tsSource entry point
--distdist/main.jsCompiled entry (Node.js only)
--env-file.env (if exists)Environment file path

miia check

Type-check the project:

miia check

Runs tsc --noEmit. No flags.

miia new

Scaffold a new MiiaJS project:

miia new my-app
miia new  # interactive prompt

Prompts for:

  1. Project name (if not provided)
  2. Runtime — Bun (recommended), Deno, or Node.js

Generates:

my-app/
├── package.json
├── tsconfig.json
├── .gitignore
└── src/
    ├── main.ts
    └── app/
        ├── app.module.ts
        ├── app.controller.ts
        └── app.service.ts

Then installs dependencies automatically.

Runtime detection

The CLI automatically detects your runtime by checking lockfiles:

LockfileRuntime
bun.lock / bun.lockbBun
deno.lockDeno
package-lock.json / yarn.lock / pnpm-lock.yamlNode.js

If no lockfile is found, it checks for bun or deno in PATH. Falls back to Node.js.

Override with --runtime:

miia dev --runtime bun

Package.json scripts

The generated project includes these scripts:

{
  "scripts": {
    "dev": "miia dev",
    "build": "miia build",
    "start": "miia start",
    "check": "miia check"
  }
}

Prerequisites

ToolRequired by
typescript (tsc)All commands
tsxNode.js dev command
Runtime (bun / deno)When using that runtime