# moleculer-web

> Official API Gateway service for Moleculer framework

Latest version **0.11.0** (published 2026-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install moleculer-web
pnpm add moleculer-web
yarn add moleculer-web
bun add moleculer-web
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.11.0 |
| Published | 2026-03-28 |
| First published | 2017-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 22.x.x |
| Dependencies | 14 |
| Unpacked size | 137.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 302 |
| Author | MoleculerJS |
| Maintainers | icebob, shawnmcknight, andre.mazayev |
| Keywords | api-gateway, http-server, microservices, microservice, moleculer |

## Links

- npm: https://www.npmjs.com/package/moleculer-web
- Repository: https://github.com/moleculerjs/moleculer-web
- Homepage: https://github.com/moleculerjs/moleculer-web#readme
- Issues: https://github.com/moleculerjs/moleculer-web/issues
- npm.io page: https://npm.io/package/moleculer-web

## Dependencies (14)

- [qs](https://npm.io/package/qs.md) ^6.15.0
- [etag](https://npm.io/package/etag.md) ^1.8.1
- [fresh](https://npm.io/package/fresh.md) ^0.5.2
- [kleur](https://npm.io/package/kleur.md) ^4.1.5
- [lodash](https://npm.io/package/lodash.md) ^4.17.23
- [isstream](https://npm.io/package/isstream.md) ^0.1.2
- [@types/qs](https://npm.io/package/@types/qs.md) ^6.15.0
- [es6-error](https://npm.io/package/es6-error.md) ^4.1.1
- [body-parser](https://npm.io/package/body-parser.md) ^2.2.2
- [serve-static](https://npm.io/package/serve-static.md) ^2.2.1
- [path-to-regexp](https://npm.io/package/path-to-regexp.md) ^8.3.0
- [@fastify/busboy](https://npm.io/package/@fastify/busboy.md) ^3.2.0
- [@types/body-parser](https://npm.io/package/@types/body-parser.md) ^1.19.6
- [@types/serve-static](https://npm.io/package/@types/serve-static.md) ^2.2.0

## Recent versions

- 0.11.0 (latest) — 2026-03-28
- 0.11.0-beta3 (next) — 2025-10-09
- 0.11.0-beta2 — 2025-06-11
- 0.10.8 — 2025-03-24
- 0.11.0-beta1 — 2024-12-04
- 0.10.7 — 2023-11-12
- 0.10.6 — 2023-07-15
- 0.10.5 — 2022-12-17
- 0.10.4 — 2022-01-09
- 0.10.3 — 2021-10-17
- 0.10.2 — 2021-09-05
- 0.10.1 — 2021-09-01
- 0.10.0 — 2021-06-27
- 0.10.0-beta4 — 2021-06-13
- 0.10.0-beta3 — 2021-03-26
- … 56 more at https://npm.io/package/moleculer-web/versions

## README

[![Moleculer logo](http://moleculer.services/images/banner.png)](https://github.com/moleculerjs/moleculer)

![Node CI](https://github.com/moleculerjs/moleculer-web/workflows/Node%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/moleculerjs/moleculer-web/badge.svg?branch=master)](https://coveralls.io/github/moleculerjs/moleculer-web?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5d0c3b3d03bd4e8683a19630a32ad22b)](https://www.codacy.com/app/mereg-norbert/moleculer-web?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=moleculerjs/moleculer-web&amp;utm_campaign=Badge_Grade)
[![Maintainability](https://api.codeclimate.com/v1/badges/6d81a3b83b448bbb1f99/maintainability)](https://codeclimate.com/github/moleculerjs/moleculer-web/maintainability)
[![David](https://img.shields.io/david/moleculerjs/moleculer-web.svg)](https://david-dm.org/moleculerjs/moleculer-web)
[![Known Vulnerabilities](https://snyk.io/test/github/moleculerjs/moleculer-web/badge.svg)](https://snyk.io/test/github/moleculerjs/moleculer-web)
[![Join the chat at https://gitter.im/moleculerjs/moleculer](https://badges.gitter.im/moleculerjs/moleculer.svg)](https://gitter.im/moleculerjs/moleculer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

# Official API Gateway for Moleculer framework  [![NPM version](https://img.shields.io/npm/v/moleculer-web.svg)](https://www.npmjs.com/package/moleculer-web)


The `moleculer-web` is the official API gateway service for [Moleculer](https://github.com/moleculerjs/moleculer). Use it to publish your services.

## Features
* support HTTP & HTTPS
* serve static files
* multiple routes
* support global, route, alias middlewares
* support file uploading
* alias names (with named parameters & REST shorthand)
* whitelist
* blacklist
* multiple body parsers (json, urlencoded)
* CORS headers
* ETags
* HTTP2
* Rate limiter
* before & after call hooks
* Buffer & Stream handling
* middleware mode (use as a middleware in ExpressJS Application)
* support authorization

## Install
```
npm install moleculer-web --save
```

## Usage

### Run with default settings
This example uses API Gateway service with default settings.
You can access to all services (including internal `$node.`) via `http://localhost:3000/`

```js
let { ServiceBroker } = require("moleculer");
let ApiService = require("moleculer-web");

let broker = new ServiceBroker({ logger: console });

// Create a service
broker.createService({
    name: "test",
    actions: {
        hello() {
            return "Hello API Gateway!"
        }
    }
});

// Load API Gateway
broker.createService(ApiService);

// Start server
broker.start();
```

**Test URLs:**	
- Call `test.hello` action: `http://localhost:3000/test/hello`

- Get health info of node: `http://localhost:3000/~node/health`
- List all actions: `http://localhost:3000/~node/actions`

## Documentation
Please read our [documentation on Moleculer site](http://moleculer.services/docs/moleculer-web.html)

## Test
```
$ npm test
```

In development with watching

```
$ npm run ci
```

## License
Moleculer-web is available under the [MIT license](https://tldrlegal.com/license/mit-license).

## Contact
Copyright (c) 2016-2021 MoleculerJS

[![@moleculerjs](https://img.shields.io/badge/github-moleculerjs-green.svg)](https://github.com/moleculerjs) [![@MoleculerJS](https://img.shields.io/badge/twitter-MoleculerJS-blue.svg)](https://twitter.com/MoleculerJS)

---
_Source: https://npm.io/package/moleculer-web · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
