Roadmap / Short term (0-3 months)

Short term (0-3 months)

Hardening and gap-fills - what gets attention next.

The short-term horizon is mostly debt and gaps in existing packages rather than new things. The goal is to take everything currently labelled experimental to beta and unblock common app shapes that today require user-supplied glue.

Recently shipped

  • DI redesign (0.9) - typed tokens with createToken() and provider() instead of string tokens, module boundaries checked at startup (imports / exports / global, forwardRef for cycles, one report of every violation), request-scoped providers kept on the request context with REQUEST_CONTEXT, lifecycle hooks in dependency order and a two-phase shutdown with onShutdown(), and readable DI errors. See Providers and Modules.
  • Router (0.9) - the trie backs up when a branch dead-ends, so a wildcard still answers a URL a more specific route could not finish; params are per route, a route registered twice throws, and a subclass can override its parent's routes. See Routing.
  • Adapters (0.9) - @miiajs/node-server and @miiajs/uws-server read the body once as a real Request does, guard against an invalid Host and unsupported methods in native mode, answer an oversized declared body with an early 413, and uws-server got correct response framing, request-body backpressure and a shutdown that waits for responses in flight.
  • Lighter hot path (0.9) - a 404 without global middleware is answered without building an exception, compose() follows koa-compose without an async wrapper per level, static routes are looked up per method, and the DI container keeps less in memory after startup.
  • Event contracts in messaging (0.9) - @On and MessageBus.publish() take an event defined with defineEvent(topic, schema) instead of a string topic: the handler's parameter and the published payload are typed from the schema, every consumer validates the payload before its handler, and a payload that does not match goes to the DLQ without retry. See Event contracts.
  • CLI rework - @miiajs/cli moved to beta: miia new (and bun create miia / npm create miia through the new create-miia package) builds projects from template files laid out for strict module boundaries, with tests next to the code on Bun, Node.js and Deno; miia add applies the same add-ons to an existing project - jwt-auth, swagger, cors, serve-static, rate-limit, biome, drizzle-postgres, drizzle-mysql, drizzle-sqlite, papr, mongoose - through TypeScript-based codemods that keep the rest of each file as it was; miia g resource writes a working CRUD module with route schemas and a test. bun run cli:e2e generates projects outside the repo against the packed packages, installs them, type-checks, tests and starts them on all three runtimes; it is a step of every release.
  • Rate limiting - @miiajs/rate-limit shipped in 0.2 (beta): fixed-window limiter with a RateLimitStore contract whose increment() counts the hit and decides blocking atomically; the guard flow with @RateLimit / @SkipRateLimit (replacement semantics, @BodyLimit-style precedence) plus a perimeter rateLimit() middleware; draft-6 RateLimit-* headers; ctx.ip / trustProxy landed in core to support it. Deliberate departures from the original plan below: one package instead of three, fixed window instead of token bucket, increment() instead of consume() - a simpler default, with the store contract already shaped for Redis.
  • Request body size limits - shipped in 0.2.0: maxBodySize app option + @BodyLimit per-route overrides, enforced in core and in the adapters. See Body size limits.
  • Multipart / file upload - @miiajs/multipart shipped in 0.6 (beta): @Multipart opens a multipart/form-data route, ctx.parts walks the body part by part with real backpressure, ctx.form() buffers the same body into Files and strings, and a schema checks the buffered form as a flat object. The original plan on this page said one parser per runtime - busboy on Node, the runtime's own formData() on Bun and Deno. Both halves were wrong: native formData() buffers every part in memory on every runtime, so there was no streaming path to delegate to, and a Node-shaped stream parser would have left the edge runtimes without one. What shipped is a single engine everywhere - multipasta behind our own Web Streams bridge - so per-part streaming, per-file limits, and error mapping read the same on Bun, Deno, Node, and uWebSockets (backpressure reaches the socket on all four). allowedTypes filters file parts by media type at the head of a part, before its body is read - the media type is still client-supplied, so it buys an early refusal rather than a guarantee about the bytes. The worked example is the uploads module in examples/full-app, next to the raw-formData() avatar upload it contrasts with.

Validating the experimental packages

One package currently sits at experimental because it has not been validated by real adoption, not because its internal coverage is poor.

PackageStatusWhy experimentalWhat promotes it
@miiajs/messaging-redisexperimentalCrash recovery, heartbeat and cross-group isolation are covered by tests since retry moved into the consumer group's PEL. No production deployment.Build a small worker app on top of it, run it under a real rolling deploy.

The OAuth2 recipe is also marked experimental until the GitHub OAuth flow is validated end-to-end on a real app. The plan is to keep OAuth2 as a recipe rather than a separate package - see Examples and docs gaps.

Test depth on small-surface packages

These are beta (small but well-targeted test coverage) but would benefit from a few more edge-case tests as we hit them in real apps. None block their beta status today.

PackageEdges worth adding when we touch them
@miiajs/jwtAlgorithm allowlist enforcement, expired tokens, key rotation, missing config.
@miiajs/authMulti-provider (OR) resolution, token extractor edge cases, AuthGuard composition.

Rate limiting stores (@miiajs/rate-limit-redis + @miiajs/rate-limit-upstash)

planned

The core package shipped in 0.2 with an in-memory store. What remains is the distributed story - two store packages built against the existing RateLimitStore interface:

  • @miiajs/rate-limit-redis - ioredis-backed store using a single Lua script for the atomic increment + window expiry + block decision. Covers typical Node/Bun/Deno deployments.
  • @miiajs/rate-limit-upstash - thin adapter over @upstash/redis (HTTP REST API). This is the edge story: works on Vercel Edge, Netlify, Cloudflare Workers, and any other runtime where TCP-based clients like ioredis don't start.

Sliding window and token bucket algorithms are candidate extensions of the RateLimitStore contract, most likely landing together with the Redis store (fixed window shipped first as the simpler default).

Why our own. Wrappers over rate-limiter-flexible looked appealing but bring two problems: official Bun support is unverified, and the library's store list is Node-shaped (no native edge story). The RateLimitStore interface is ~20 lines and we control runtime compatibility by construction. Same pattern as IdempotencyStore in messaging - users learn one shape across the framework.

Serverless story. Unlike cache, rate limiting needs atomic counter increments with TTL. Unstorage's getItem/setItem is not atomic - we cannot reuse that bridge here without race conditions under load. Instead, the dedicated @miiajs/rate-limit-upstash package gives Vercel/Netlify/CF Workers users a working store from day one.

Because RateLimitStore is our interface, native first-party drivers (@miiajs/rate-limit-cloudflare-do for Durable Objects, @miiajs/rate-limit-dynamodb for AWS Lambda) can land later without breaking users. They swap the store instance, nothing else changes.

Server-Sent Events helper

planned

ctx.res.sse(stream | iterable) helper plus a small SseStream builder that handles event framing, keep-alive comments, and back-pressure. No decorator, no new package - this lives in @miiajs/core and composes with existing guards/middleware/DI. There will not be a @miiajs/sse package.

ts
@Get('/events')
async stream(ctx: RequestContext) {
  return ctx.res.sse(async function* () {
    yield { event: 'tick', data: { now: Date.now() } }
  })
}

Why now: SSE solves 70% of "I need server-push" use cases (notifications, progress updates, log tails) without WebSocket-level complexity. WebSocket lands mid-term; SSE is ~50 lines of code today and unblocks real apps now.

Request validation pipe sugar

idea

Route schemas ({ body, query, params } in @Get, @Post, and the rest) exist but are Zod-flavoured. Add a thin pipe layer so consumers can plug arbitrary schema libraries (Valibot, ArkType, Yup) by passing a safeParse-shaped function. Mostly already there via ZodLike interface; needs docs and one or two non-Zod tests to demonstrate.

Examples and docs gaps

Add small, focused example apps and recipes so contributors and users can copy-paste:

  • Auth recipes: validate the existing OAuth2 recipe end-to-end with GitHub/Google, add API-key recipe, add session-based recipe. Recipes only - no separate auth packages (per design choice).
  • Production logger recipes: worked setups for winston / pino on top of the LoggerService interface, with request ids and structured fields. The interface and a minimal adapter are on the Logger page; full recipes are not.
  • Health check recipe: small core helper plus a controller pattern. We deliberately do not ship a @miiajs/health package - 50 lines of glue do not earn one.
  • Transactions recipes: explicit db.transaction() patterns for Drizzle, Mongoose, Papr. No @Transactional decorator, no AsyncLocalStorage indirection.

Out of scope (deferred to mid-term)

  • WebSocket support
  • OpenTelemetry integration
  • Cache abstraction

These are valuable but bigger commitments than 0-3 months. Items removed from short-term entirely after re-scoping: dedicated health-checks package (now a recipe), separate auth packages per credential type (recipes only, never packages), Request-Reply for messaging (long-term), scheduler (long-term idea).

Edit this page on GitHub