mion is a lightweight TypeScript-based framework designed for building Type-Safe APIs. It aims to provide a great developer experience and is ready for serverless environments. With mion, you can quickly build APIs that are type-safe, with automatic validation and serialization out of the box.
- There are not many frameworks that offer Type-Safe APIs and take full advantage Typescript type system.
- Serverless applications have different requirements compared to conventional server.
- mion takes advantage of a new generation of tools (Deepkit) that bring types to runtime allowing automatic validation/serialization out of the box and a whole new set of possibilities.
- Generic http frameworks have a lot of baggage that is not required for modern APIs.
Url or path
mime-types, file uploads,
multipart/form-dataand 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.
mion is designed with a Remote Procedure Call (RPC) style where functions are the primary interface and there are no any abstractions over the API data.
mion operates over HTTP yet it uses an RPC style routing.
We have prioritized and tracked performance during the development of the framework, we even discarded features or experiments when we observed a performance degradation. Our goal is to have similar performance to fastify which we consider the gold standard in node.js frameworks!
Check out the Benchmarks page for more info!
But if you don't keep performance in check you end up like Internet Explorer!
mion's router is lightweight and fast. Unlike traditional routers. The Http method is not relevant, there are no parameters in the Url and data is sent and received in JSON format via the request body or headers. mion's router leverages a simple in-memory map for route lookup, making it extremely fast.
Apis are composed of Routes and Hooks. Routes are methods that can be called remotely from the client and have an specific url, while hooks are auxiliary methods that get's executed before or after a route.
To learn more about the router, refer to the Router Documentation.
mion utilizes Deepkit's runtime types for automatic validation and serialization. Deepkit's magic enables type information to be available at runtime, allowing for automatic validation and serialization of data.
By leveraging runtime types, mion offers advanced capabilities such as request validation and response/request serialization that typically involves using multiple framework and loads of code or boilerplate to be manually written by developers.