WTF are Full Stack APIs?
Is the concept of fully integrate your API functions into your frontend application as if they were local functions.
All the complexity of http requests, methods, validation, serialization, etc... is abstracted away and you can just call your APIs as if they were local functions.
With mion, you can quickly build APIs that are type-safe, with automatic validation and serialization out of the box.
import {initMionRouter, route, Routes} from '@mionkit/router';
import {startNodeServer} from '@mionkit/node';
const routes = {
// fully validated params
sayHello: route((ctx, name: string): string => {
return `Hello ${name}!`;
}),
} satisfies Routes;
export const myApi = await initMionRouter(routes);
startNodeServer({port: 3000});
export type MyApi = typeof myApi;
import {initClient} from '@mionkit/client';
import type {MyApi} from './about-server.ts';
const {routes} = initClient<MyApi>({
baseURL: 'http://localhost:3000',
});
async function example() {
// Call server method as if it were a local function
const [hello] = await routes.sayHello('World').call();
console.log(hello); // hello world
}
example();
params, multiple mime-types, file uploads, multipart/form-data and many other features that generic HTTP frameworks must support just make them more complicated and slow.mion addresses these challenges by offering a lightweight and opinionated framework focused on simplicity and developer experience.
RunTypes
Automatic Serialization & Validation
RPC "Like"
mion is designed with a Remote Method Call (RPC) style where functions are the primary interface and there are no abstractions over the API data.
We use the term RPC "Like" to highlight that mion does not use an RPC or custom protocol. mion operates over HTTP yet it uses an RPC style routing.
Routing
Fast
Benchmarks