RPC framework
Full stack APIs at the speed of light

Write a plain TypeScript function, and it is an API route. Params are validated, and params and results make the JSON round trip for you. The client calls remote routes like local async functions, with full types and autocompletion.

server.ts
// packages/private-examples/src/_homepage/home-rpc-server.tsimport {createMionRouter, Routes} from '@mionjs/router';import {startNodeServer} from '@mionjs/platform-node';const mion = createMionRouter();
Automatic validation and JSON round trip from TypeScript types
interface User { id: number; name: string; createdAt: Date; tags: Set<string>;}
A plain function is a route; its params arrive fully validated
const routes = { getUser: mion.query((ctx, id: number): User | null => { if (id !== 1234) return null; return { id: 1234, name: 'John', createdAt: new Date(), tags: new Set(['admin']), }; }), // ...other routes} satisfies Routes;export const myApi = mion.initRoutes(routes);export type MyApi = typeof myApi;startNodeServer({port: 3000});
client.ts
// packages/private-examples/src/_homepage/home-rpc-client.tsimport {initClient} from '@mionjs/client';import type {MyApi} from './home-rpc-server.ts';const {routes} = initClient<MyApi>({  baseURL: 'http://localhost:3000',});
Remote routes are called like local async functions, fully typed
const [user, error] = await routes.
  • getUser
getUser(1234).call();
if (user) { user.
User.createdAt: Date
createdAt
;
// @annotate: Native classes like Set come back as real values user.
User.tags: Set<string>
tags
;
}// Type error: id must be a number// @ts-expect-error -- shown on purpose; the assertion fails the build if this ever stops erroringroutes.getUser('1234').call();

RunTypes
Bringing TypeScript to runtime

Everything is generated at compile time, derived from your types:

ValidationType guards and error lists
SerializationJSON round trip for any type, including Map, Set, Temporal and many more
MockingSample data that fits the type
ReflectionWalk your types at runtime
run-types.ts
// packages/private-examples/src/_homepage/home-run-types.tsimport {createValidateFn, createJsonEncoderFn} from '@mionjs/run-types';import {createMockDataFn} from '@mionjs/run-types/mocking';interface User {  id: string;  name: string;  createdAt: Date;  tags: Set<string>;}
Create precompiled functions directly from TypeScript types
const isUser = createValidateFn<User>();const encodeUser = createJsonEncoderFn<User>();const mockUser = createMockDataFn<User>();
Generate mock data - respects type structure
const
const user: User
user
= mockUser();
Validate data at runtime
isUser(user);
JSON round trip for complex types (Date, Set, unions)
const
const json: string
json
= encodeUser(user);

Performance from the ground up!

Speed and memory efficiency are a design goal, measured from the first commit. Validation and the JSON round trip are compiled at build time, so your app imports no runtime library for them: smaller bundles, faster cold starts and less memory, which makes mion a natural fit for edge and serverless runtimes. The RPC server is benchmarked against express, fastify, hono and friends, and RunTypes against the fastest validators. Every number is generated on deploy from the code in this repository.

$ loading benchmarks…

Tested to the highest standard

Every function mion generates for you is tested, and so is the build step that writes them. The suite covers validation, JSON round trip, mock data and reflection, on every type shape we could think of.

Copyright © 2026