Scan your whole stack
From OX Research Newsroom
Are you using resultar-hono?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.0.0-beta.2
resultar-hono was last scanned on 23 Nov 2026 at version 2.0.0-beta.2. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.0.0-beta.2 LATEST | 23 Nov 2026 | No rules fired |
| 2.0.0-beta.1 | 23 Nov 2026 | No rules fired |
| 2.0.0-beta.0 | 22 Nov 2026 | No rules fired |
| 1.1.0 | 16 Nov 2026 | Not shown |
| 1.0.0 | 21 Oct 2026 | Not shown |
Findings for v2.0.0-beta.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.0.0-beta.2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
resultar-hono reexports the application DI helpers: createModule, Service, service,
resource, and the types ServiceClass, ServiceModule, ServiceScope, ServiceLifetime
and HttpApplication. These are the original resultar-di exports, with the same identity
and behavior. You do not need to import or directly install resultar-di for this API.
Keep resultar-di as a direct dependency for framework-independent shared services or
when importing framework adapter helpers such as withProvider and useServiceAccess.
Core helpers such as ResultTask continue to come from resultar.
The DI package has one entry point; migrate old resultar-di/advanced imports to resultar-di.
Prefer lazy ResultTask values for new async service methods and run them explicitly in routes.
task.runResult() (or ResultTask.runResult(task)) returns ResultAsync<T, E> (an in-flight PromiseLike<Result<T, E>>); existing eager ResultAsync service contracts can also be adapted back into lazy workflows with ResultTask.fromResultAsync(() => legacyMethod()).
createHonoServices supplies per-route middleware over the same resultar-di request scopes.
It preserves c.env, execution context and native route/RPC response inference:
import { Hono } from 'hono'
import { createModule, createHonoServices } from 'resultar-hono'
const di = createHonoServices(createModule().value('answer', 42))
const app = new Hono<{ Bindings: { suffix: string } }>()
.get('/public', c => c.text('public'))
.get('/answer', di.middleware(['answer']), c =>
c.json({ answer: c.var.services.answer, suffix: c.env.suffix }),
)
export default app
// On shutdown, after consuming/canceling active responses:
// const closed = await di.close()
Only matching middleware selects and initializes services. Its scope stays open through response
body consumption, failure or cancellation, using scope.fetch; it does not close in a middleware
finally. close() is idempotent, retains typed root cleanup errors and rejects new scoped requests.
Use middleware(keys, { locals: (c: Context<AppEnvironment>) => ({ tenant: c.var.tenant }) })
after authentication to supply request locals. Sync and async callbacks are supported. Registered
names cannot be overwritten, and a singleton cannot capture locals. Install one services middleware
per request; all selected services should be listed in that middleware. No global Hono variable
augmentation is installed. For app.use, declare the application's variables explicitly according
to Hono's normal typing rules; inline route middleware infers c.var.services automatically.
createHonoApp below retains its existing c.env bindings and application-wide selection behavior.
For the corresponding native Fastify plugin, see resultar-fastify.
Typed Hono service bindings and one DI scope per response. Configure ordinary Hono routes; reuse Resultar DI for service resolution, streaming ownership and cleanup.
pnpm add resultar-hono resultar hono
import { createModule, service, createHonoApp } from 'resultar-hono';
const Greeting = service('greeting', {}, () => ({ text: 'Hello' }));
const app = createHonoApp(
{ services: createModule().scoped(Greeting) },
(hono) => {
hono.get('/', (c) => c.text(c.env.greeting.text));
},
);
const response = await app.request('/');
console.log(await response.text());
const closed = await app.close();
closed.match(
() => console.log('closed'),
(error) => console.error(error),
);
The callback receives a real Hono instance and configures it synchronously once. Native
HonoOptions (strict, router and getPath) are forwarded to new Hono(...) without
attaching Resultar options to the router instance. Bindings are inferred from the selected DI
services. Unknown names and missing dependencies are compile-time errors. Run Task-returning
methods with await task.runResult() (or await ResultTask.runResult(task)) and use result.match inside routes. Native Hono
and lifecycle Promise boundaries retain ordinary await. Configure middleware (such as logger from hono/logger),
onError and notFound on the supplied Hono instance as usual.
| Configuration | Services resolved and exposed before the handler |
|---|---|
bindings omitted |
All services registered in the module |
bindings: ["users", "health"] |
Only the listed services; their dependencies are resolved internally |
bindings: [] |
None |
Creating the application still initializes no providers. On a request, the effective selection is resolved in registration order for the default view, following dependency resolution and each provider's lifetime. Singletons are reused, scoped services belong to the request and transients are created per resolution. Reading the resulting view does not resolve them again.
Omission is convenient for small modules. Restrict the list when an unrelated service should not initialize for those routes: an acquisition failure in any selected service prevents the handler from running. Missing or incompatible requirements are checked for the effective selection. No route-body analysis or automatic property-based resolution is performed.
createHonoApp also accepts an optional startup: ResultTask<void, E, R>. It runs once on the first call to
ready() or before the first request, using the same root as the request services:
import { ResultTask } from 'resultar'
const app = createHonoApp(
{
services,
startup: ResultTask.gen(function* () {
const database = yield* Database
yield* database.ensureSchema()
}),
},
configureRoutes,
)
// At the server boundary, stop startup if initialization fails.
await app.ready().unwrapOrThrow()
The task's requirements are checked against the module. A failed task closes the root and prevents
subsequent requests. Startup is lazy, shared by concurrent requests and optional; applications
without it keep the existing behavior.
Directly acquired resources remain alive until close(), then release before singleton dependencies.
Startup cannot capture scoped/transient services. Closing during startup requests cooperative
cancellation and prevents waiting requests from reaching routes. Failed startup and cleanup causes
are retained together; an SDK that ignores cancellation can still delay shutdown.
The runnable example keeps service definitions and
createServices in services.ts, native routes in routes.ts, and application creation,
the exported AppHono type and Node startup in main.ts. Its
app-config.ts uses resultar-config and
TypeBox to validate PORT before listening. The validated snapshot is then injected
into the request services:
// main.ts
import { serve } from "@hono/node-server";
import type { Hono } from "hono";
import { createHonoApp, type InferRequestServices } from "resultar-hono";
import { appConfig } from "./app-config.ts";
import { healthRoutes, usersRoutes } from "./routes.ts";
import { createServices } from "./services.ts";
// The package infers context.env and keeps resources alive until the response finishes.
export const createApplication = (services = createServices()) =>
createHonoApp({ services }, (app) => {
usersRoutes(app);
healthRoutes(app);
});
export type AppHono = Hono<{ Bindings: InferRequestServices<typeof createApplication> }>;
if (import.meta.main) {
const config = await appConfig.load().runResult();
if (config.isErr()) {
console.error("Invalid application configuration", config.error.issues);
process.exitCode = 1;
} else {
const app = createApplication(createServices().override("appConfig", config.value));
serve({ fetch: app.fetch, port: config.value.PORT }, (info) => {
console.log(`Listening on http://${info.address}:${info.port}/`);
});
}
}
Route files import only the application type:
// routes.ts — adapting the fixture's existing eager health method
import { ResultTask } from "resultar";
import type { AppHono } from "./main.ts";
export const healthRoutes = (app: AppHono) => {
app.get("/health", async (c) => {
const result = await ResultTask.fromResultAsync(() => c.env.health.check()).runResult();
return result.match(
(health) => c.json(health),
() => c.json({ error: "Health unavailable" }, 503),
);
});
};
The type-only import adds no runtime dependency on the bootstrap. InferRequestServices
accepts the factory or its returned application and infers a readonly view of all registered
services by default, or only the explicit bindings selection. Routes do not repeat service tokens and need no global augmentation.
This helper describes createHonoApp bindings in c.env; createHonoServices middleware
continues to infer its per-route selection in c.var.services.
The runnable fixture retains eager Async service methods for compatibility coverage. The bridge
calls the method on each Task run; passing an already-created Async value would reuse its execution.
For a new Task-returning method, pass it directly to runResult. Task has no .then, map is
synchronous, and match returns a Task to execute with a runner.
Start the example with pnpm dev from examples/hono. Tests import createApplication
without starting the Node server because startup is guarded by import.meta.main.
fetch(request) serves requests using one shared root and a fresh child scope per response.request(input, init?) uses the same path for tests. Relative paths resolve against localhost.ready() runs the optional startup task once and returns an in-flight ResultAsync. Call it before opening a
server listener when startup errors should be handled explicitly.close() returns an in-flight ResultAsync, retaining the module's typed release failures. Concurrent
and repeated calls return the same ResultAsync; requests after close are rejected. Defects or
composite causes that cannot be represented by Result may reject with ResultTaskCauseError,
following task.runResult() / ResultTask.runResult semantics.The application type is HonoApplication<CloseError, RequestServices>. The second parameter
defaults to object, preserving HonoApplication<CloseError>. createHonoApp retains both
ServiceScopeError<R> and the selected bindings: handle the close() Err case for typed
release failures. Service type metadata exists only in the declarations, not at runtime.
createHonoApp adds ready() to its inferred return type without requiring that method on existing
implementations or test doubles of the HonoApplication interface.
Selected services are acquired before each handler. Singleton providers live until root close; scoped providers live
until their response is consumed, canceled or fails. A returned Response does not mean its body
has finished. Consume or cancel every response in tests. close waits for active consumers:
persistent streams must be finished or canceled before waiting for shutdown.
Provider failures before Hono runs reject fetch with their cause. Hono's onError handles route
errors; it cannot intercept earlier DI failures or failures after headers have been delivered.
A finalizer failure after headers affects the response body instead of changing the HTTP status.
Every request, including 404, resolves the selected bindings; selection is not per route.
Pass app.fetch to the server chosen by your application. Port, hostname, TLS, operating-system
signals, deadlines and server shutdown remain in the bootstrap. Stop/drain the server first,
then await app.close(). No /node, /deno or /bun adapters are provided.
See the complete example with workspace dependencies and no experimental module-resolution flags.
| Runtime | Status |
|---|---|
| Node.js 24 | Exercised (example via @hono/node-server) |
| Deno | Exercised (Deno.serve with app.fetch) |
| Bun | Not validated |
The runtime uses web APIs and does not import Node APIs.
This adapter accepts Request only. It does not forward runtime bindings or ExecutionContext,
guarantee Hono RPC schemas, support WebSocket upgrades, or infer authenticated request-local DI
values — typed local entries such as the authenticated user still depend on a framework adapter.
Selection is per request, not per route. Use the existing lower-level integration when those
features are needed.
Class services reexported by this adapter accept synchronous factories:
Service("users", { requires: { repository: Repository }, make: ({ repository }) => ({ find: (id: string) => repository.find(id) }) }).
Construction remains lazy and follows the registered lifetime. Factories can also return a
ResultTask for initialization with failures or resources; raw Promises are not accepted.
runTaskJson(context, task, { ok, error }) is an optional helper for materialized JSON responses.
It executes the task with context.req.raw.signal and leaves status codes and payloads to the
application. Both mappers may be async and retain their exact typed JSON responses for Hono RPC
and OpenAPI route contracts. An exhaustive Match.context(...).tagsExhaustive(...) handler can
be used for error without introducing another error-dispatch abstraction.
import { Hono } from 'hono'
import { ResultTask } from 'resultar'
import { runTaskJson } from 'resultar-hono'
const app = new Hono().get('/answer', c =>
runTaskJson(c, ResultTask.ok({ answer: 42 }), {
ok: value => c.json(value, 200),
error: () => c.json({ error: 'unavailable' }, 503),
}),
)
Provide required Task services before calling the helper. Simple typed failures, including typed
release failures, reach error; defects, interruptions and composite causes reject into Hono's
onError. The helper does not choose a cancellation status code. Request cancellation is only as
prompt as the task's cooperative work and cleanup allow.
Task-owned resources close before either response mapper runs. Return detached data from the task; do not return a live resource that the mapper still needs. This helper accepts typed JSON responses only. Streams require an explicit owner that outlives body consumption; the existing services middleware continues to own its DI resources through the response lifecycle.
The OpenAPI fixture validates response schemas and RPC inference for
200/404 responses. @hono/zod-openapi is a test dependency, not a runtime requirement of the helper.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.