Installation
Create a project (recommended)
bun create miia my-app
npm create miia@latest my-app
pnpm create miia my-app
yarn create miia my-app
deno run -A npm:create-miia my-app
The CLI asks for the runtime (Bun, Node.js or Deno), the package manager on Node.js, and optional features - JWT auth, Swagger, CORS, static files, rate limiting, Biome and a database - then writes the project and installs it. Every prompt has a flag, and -y takes the defaults, so the same command works in CI:
bun create miia my-app -y --features jwt-auth,swagger --db drizzle-sqlite
With npm, put the flags after --: npm create miia@latest my-app -- -y --features jwt-auth,swagger.
jwt-auth on a Drizzle database, as in the first command, keeps users in a users table, so registering fails until it exists. Create it before the first start, from the project folder: bun run db:generate && bun run db:migrate. The CLI prints these steps with your package manager when it finishes.
Then start the dev server:
cd my-app && bun run dev
cd my-app && npm run dev
cd my-app && pnpm dev
cd my-app && yarn dev
cd my-app && deno task dev
Quick Start walks through the generated project. To set things up by hand instead, follow the steps below.
Manual setup
Core package
bun add @miiajs/core
npm install @miiajs/core
pnpm add @miiajs/core
yarn add @miiajs/core
Server adapters
MiiaJS exposes a standard fetch handler. Choose a server adapter for your runtime:
Bun & Deno
No additional package needed. app.listen() auto-detects the runtime.
Bun hands a request whose Host header is not a plain host - x/y, x?q, or empty - to the app with a relative req.url (/path?query). The router handles it, but code that parses the URL itself must give new URL() a base, or it throws: new URL(ctx.req.url, 'http://localhost').
Deno builds the URL of the Request from the Host header without checking it, so Host: x/admin turns GET /public into /admin/public. Run a Deno app behind a proxy that checks or rewrites Host.
Deno also closes a keep-alive connection, without saying so, when the response goes out before the request body has fully arrived - for example a 401 to an upload the app never read. A client or proxy that pools connections can then send its next request into the closed socket and see it fail.
Node.js
bun add @miiajs/node-server
npm install @miiajs/node-server
pnpm add @miiajs/node-server
yarn add @miiajs/node-server
uWebSockets.js
bun add @miiajs/uws-server
npm install @miiajs/uws-server
pnpm add @miiajs/uws-server
yarn add @miiajs/uws-server
uWebSockets.js comes with the adapter as its dependency, pinned to a GitHub release - do not install it separately. It runs on Node.js only; see uWS Server.
Runtime quirks
The Bun and Deno notes above describe defects of the runtimes themselves, not of MiiaJS. A runtime defect is worked around in the framework only when it would otherwise crash the process, leak memory or hang, or when the workaround is cheap - a few lines, nothing on the hot path. Everything else is documented where it bites and reported upstream. Defects of the MiiaJS adapters (@miiajs/node-server, @miiajs/uws-server) are fixed.
TypeScript configuration
MiiaJS packages ship ES2025 code, and TC39 decorators are compiled by tsc itself - no experimentalDecorators flag, no reflect-metadata. Match your project to the same baseline (TypeScript 6.0 or newer - earlier versions reject the ES2025 target):
{
"compilerOptions": {
"target": "ES2025",
"module": "nodenext",
"verbatimModuleSyntax": true
}
}
For the full list of packages, see Packages.