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:
- TypeScript compiler in watch mode (
tsc --noEmit --watch) - Development server with file watching
| Flag | Default | Description |
|---|---|---|
--runtime, -r | auto-detected | Runtime: bun, deno, node |
--entry | src/main.ts | Entry point file |
--env-file | .env (if exists) | Environment file path |
miia build
Build the project for production:
miia build
miia build --runtime node
| Runtime | Behavior |
|---|---|
| Bun / Deno | tsc --noEmit (type-check only) |
| Node.js | tsc (full compilation to dist/) |
| Flag | Default | Description |
|---|---|---|
--runtime, -r | auto-detected | Runtime: 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
| Runtime | Command |
|---|---|
| Bun | bun src/main.ts |
| Deno | deno run --allow-all src/main.ts |
| Node.js | node dist/main.js |
Sets NODE_ENV=production for Bun and Node.js.
| Flag | Default | Description |
|---|---|---|
--runtime, -r | auto-detected | Runtime: bun, deno, node |
--entry | src/main.ts | Source entry point |
--dist | dist/main.js | Compiled 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:
- Project name (if not provided)
- 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:
| Lockfile | Runtime |
|---|---|
bun.lock / bun.lockb | Bun |
deno.lock | Deno |
package-lock.json / yarn.lock / pnpm-lock.yaml | Node.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
| Tool | Required by |
|---|---|
typescript (tsc) | All commands |
tsx | Node.js dev command |
Runtime (bun / deno) | When using that runtime |