Installation
This section lists the core packages of LiteMW and their installation methods.
Router
To get started, you only need two modules: koa and @litemw/router. This is sufficient for the examples from the previous step. For a more detailed description of the router, see the creating an application section.
npm install koa @litemw/router
yarn add koa @litemw/router
pnpm i koa @litemw/router
bun i koa @litemw/router
TIP
Optionally, you can also use @koa/router. @litemw/router uses it internally and delegates all its methods.
Middlewares
npm install @litemw/middlewares
yarn add @litemw/middlewares
pnpm i @litemw/middlewares
bun i koa @litemw/middlewares
To use the useBody and useFiles middlewares, you will need the koa-bodyparser.
npm install koa-bodyparser
yarn add koa-bodyparser
pnpm i koa-bodyparser
bun i koa-bodyparser
Optionally, for validation, you can use the zod or class-validator
npm install zod
yarn add zod
pnpm i zod
bun i zod
npm install class-validator
yarn add class-validator
pnpm i class-validator
bun i class-validator
For additional OpenAPI schema support with these libraries, you can use zod-openapi and class-validator-jsonschema
npm install zod-openapi
yarn add zod-openapi
pnpm i zod-openapi
bun i zod-openapi
npm install class-validator-jsonschema
yarn add class-validator-jsonschema
pnpm i class-validator-jsonschema
bun i class-validator-jsonschema
OpenAPI
The OpenAPI module provides tools for generating OpenAPI schemas based on your routers, which can later be used, for example, with SwaggerUI.
npm install @litemw/openapi
yarn add @litemw/openapi
pnpm i @litemw/openapi
bun i @litemw/openapi