Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,574 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

mion, a mikro kit for Typescript Serverless APIs

npm npm

mion : Full Stack APIs at the speed of light πŸš€

mion is a lightweight TypeScript-based framework designed for building serverless APIs. It aims to provide a great developer experience and is optimized for serverless environments. With mion, you can quickly build APIs that are type-safe, with automatic validation and serialization out of the box.

Check Out The Website And Documentation πŸ“š

mion-website-banner

Why Another Framework?

Serverless applications have different requirements compared to conventional server apps and there are not many frameworks that offer type-safe APIs with automatic validation and serialization by default.

mion addresses these challenges by offering a lightweight and opinionated framework focused on simplicity and developer experience.

Features

Status Name Description
βœ… RPC-like Router Provides an RPC-style router for handling API requests
βœ… Automatic Validation Automatically validates data received by the API
βœ… Automatic Serialization Automatically serializes data sent by the API
βœ… AWS Lambda Handler Seamless integration with AWS Lambda for serverless execution
βœ… HTTP Server Includes an HTTP server module for handling API requests
βœ… Automatic TypeScript Client Fully typed client without need of compilation

Opinionated Approach (Aka: RPC Like)

mion is designed with a Remote Procedure Call (RPC) style and works exclusively with JSON data. The framework prioritizes quick development, fast startups, and minimal abstractions. It follows a convention-over-configuration approach and focuses on performance and developer experience.

Fast

We have prioritized and tracked performance during the development of the framework, we even have many discarded features and experiments when there was a performance degradation compared to previous versions. Our goal is to have similar performance to fastify which we consider the gold standard in node.js frameworks!

For full benchmarks and comparison against other frameworks please visit the benchmarks repo.
We know! benchmarks are just benchmarks, but if you don't keep performance in mind you end up like express πŸ˜…

Routing

mion's router is lightweight and fast. Unlike traditional routers, it uses a Remote Procedure Call (RPC) style of routing. 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.

Automatic Serialization & Validation

mion utilizes RunTypes for automatic validation and serialization. RunTypes 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.

Full Stack APIs

type safes apis

Thats it πŸ‘†, thats all you need to write a Fully Type Safe Api and Client Β  πŸš€
All parameters and return values will also be automatically validated and serialized without any extra code required.

Contributing

Contributors and maintainers are welcome πŸ‘

Mion's philosophy is simplicity, so we don't want to add many features! As an small open source project we want to keep it simple and keep features to maintain at a minimum, that said contributions to mion are encouraged! Please open issues and submit pull requests for any improvements or bug fixes.

The project is organized as a monorepo using pnpm workspaces, NX, and Lerna. Each package within the monorepo is compiled and tested individually using TypeScript and Vitest.

Install

This repo uses pnpm (with a security-hardened .npmrc: pinned versions, 30-day minimum release age, no install scripts, no non-registry sources). Do not run npm install.

pnpm install --frozen-lockfile

Publishing

To publish packages we need to make sure the packages are built first.

pnpm run build
pnpm exec lerna version --no-private
pnpm exec lerna publish from-package --no-private

Powered by:


License: MIT

Releases

Packages

Used by

Contributors

Languages