Skip to content

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.

shell
npm install koa @litemw/router
shell
yarn add koa @litemw/router
shell
pnpm i koa @litemw/router
shell
bun i koa @litemw/router

TIP

Optionally, you can also use @koa/router. @litemw/router uses it internally and delegates all its methods.

Middlewares

shell
npm install @litemw/middlewares
shell
yarn add @litemw/middlewares
shell
pnpm i @litemw/middlewares
shell
bun i koa @litemw/middlewares

To use the useBody and useFiles middlewares, you will need the koa-bodyparser.

shell
npm install koa-bodyparser
shell
yarn add koa-bodyparser
shell
pnpm i koa-bodyparser
shell
bun i koa-bodyparser

Optionally, for validation, you can use the zod or class-validator

shell
npm install zod
shell
yarn add zod
shell
pnpm i zod
shell
bun i zod
shell
npm install class-validator
shell
yarn add class-validator
shell
pnpm i class-validator
shell
bun i class-validator

For additional OpenAPI schema support with these libraries, you can use zod-openapi and class-validator-jsonschema

shell
npm install zod-openapi
shell
yarn add zod-openapi
shell
pnpm i zod-openapi
shell
bun i zod-openapi
shell
npm install class-validator-jsonschema
shell
yarn add class-validator-jsonschema
shell
pnpm i class-validator-jsonschema
shell
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.

shell
npm install @litemw/openapi
shell
yarn add @litemw/openapi
shell
pnpm i @litemw/openapi
shell
bun i @litemw/openapi