# restana

> Super fast and minimalist web framework for building REST micro-services.

Latest version **7.0.0** (published 2026-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install restana
pnpm add restana
yarn add restana
bun add restana
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-10-24 |
| First published | 2017-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=24.x |
| Dependencies | 1 |
| Unpacked size | 67.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 468 |
| Author | Rolando Santamaria Maso |
| Maintainers | jkyberneees |
| Keywords | rest, http, framework, web, service |

## Links

- npm: https://www.npmjs.com/package/restana
- Repository: https://github.com/BackendStack21/restana
- Homepage: https://github.com/BackendStack21/restana#readme
- Issues: https://github.com/BackendStack21/restana/issues
- npm.io page: https://npm.io/package/restana

## Dependencies (1)

- [0http](https://npm.io/package/0http.md) ^5.2.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 7.0.0 (latest) — 2026-10-24
- 6.1.0 — 2026-09-05
- 6.0.1 — 2026-07-19
- 6.0.0 — 2026-04-25
- 5.2.0 — 2026-04-19
- 5.1.0 — 2025-07-31
- 5.0.0 — 2025-01-04
- 4.9.9 — 2024-04-06
- 4.9.7 — 2022-12-10
- 4.9.6 — 2022-06-13
- 4.9.5 — 2022-05-11
- 4.9.4 — 2022-04-21
- 4.9.3 — 2022-02-05
- 4.9.2 — 2021-11-01
- 4.9.1 — 2021-05-01
- … 89 more at https://npm.io/package/restana/versions

## README

# Introduction
[![NPM version](https://badgen.net/npm/v/restana)](https://www.npmjs.com/package/restana)
[![NPM Total Downloads](https://badgen.net/npm/dt/restana)](https://www.npmjs.com/package/restana)
[![License](https://badgen.net/npm/license/restana)](https://www.npmjs.com/package/restana)
[![TypeScript support](https://badgen.net/npm/types/restana)](https://www.npmjs.com/package/restana)
[![Github stars](https://badgen.net/github/stars/BackendStack21/restana?icon=github)](https://github.com/BackendStack21/restana)

<img src="docs/restana-logo.svg" width="400">  

Restana is a lightweight and fast Node.js framework for building RESTful APIs. Inspired by Express, it provides a simple and intuitive API for routing, handling requests and responses, and middleware management. It is designed to be easy to use and integrate with other Node.js modules, allowing developers to quickly build scalable and maintainable APIs.

Read more online:  
- restana = faster and efficient Node.js REST APIs: https://itnext.io/restana-faster-and-efficient-node-js-rest-apis-1ee5285ce66

![Performance Benchmarks](docs/Benchmarks.png)
> Check it yourself: https://web-frameworks-benchmark.netlify.app/result?f=feathersjs,0http,koa,nestjs-express,express,sails,nestjs-fastify,restana


# Usage
Install
```bash
npm i restana
```
Create an HTTP API service:
```js
const restana = require('restana')

const service = restana()
service.get('/hi', (req, res) => res.send('Hello World!'))

service.start(3000)
```
Creating secure API service:
```js
const https = require('https')
const restana = require('restana')

const service = restana({
  server: https.createServer({
    key: keys.serviceKey,
    cert: keys.certificate
  })
})
service.get('/hi', (req, res) => res.send('Hello World!'))

service.start(3000)
```

Using `http.createServer()`:
```js
const http = require('http')
const restana = require('restana')

const service = restana()
service.get('/hi', (req, res) => res.send('Hello World!'))

http.createServer(service).listen(3000, '0.0.0.0')
```

# Security defaults
Restana ships with secure defaults out of the box:
- **Error handling**: The default error handler only returns the status code and its standard status text (e.g. `Not Found`), preventing internal details (stack traces, database errors, file paths) from leaking to clients. Provide a custom `errorHandler` to control what gets exposed.
- **Stream safety**: Stream errors are handled gracefully, preventing connection leaks.
- **Immutable config**: `getConfigOptions()` returns a frozen copy, preventing middleware from mutating internal framework options.
- **Response headers**: Browser hardening headers are enabled by default, and connection-specific or cookie headers cannot be injected through `res.send()`.
- **Proxy safety**: Forwarded protocol headers are ignored unless `trustProxy: true` is explicitly configured.

For local-only development, bind explicitly to loopback:
```js
service.start(3000, '127.0.0.1')
```

When TLS terminates at a trusted reverse proxy:
```js
const service = restana({ trustProxy: true })
```

Error details are hidden by default in every environment. For local debugging only, opt in with `debugErrors: true`; production mode always masks details.

## 7.0 highlights
- Dependency-free trie router by default: constant-time static routes and no match cache to tune.
- Case-sensitive routing that agrees with reverse proxies and WAFs (`caseSensitive: false` to opt out).
- Consistent error responses from `res.send(err)` and the default error handler.
- Faster startup: no third-party modules are loaded by default.
- TypeScript route params inferred from the path (`'/users/:id'` → `req.params.id`).
- Stricter `res.send()` status code handling and a typed, explicit public API.

Upgrading from 6.x? Read the [migration guide](MIGRATION.md).

# More
- Website and documentation: https://restana.21no.de
- [Full API guide](docs/README.md)
- [Changelog](CHANGELOG.md)
- [Migration guide (6.x → 7.0)](MIGRATION.md)
- [Contributing](CONTRIBUTING.md)

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