Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@alwatr/nanotron

Alwatr354AGPL-3.0-only4.9.1TypeScript support: included

Nanotron: Your Lightweight, High-Performance Micro/Nano Service Framework. Nanotron is designed for building blazingly fast and efficient microservices and APIs. Its minimalist approach and focus on performance make it ideal for resource-constrained envir

server, nanoservice, api, typescript, esm, alwatr

readme

Nanotron

Your Lightweight, High-Performance Micro/Nano Service Framework

Nanotron is designed for building blazingly fast and efficient microservices and APIs. Its minimalist approach and focus on performance make it ideal for resource-constrained environments and scenarios where every millisecond counts.

Key Features

  • Lightweight: Minimal dependencies and a small footprint ensure optimal performance.
  • High-Performance: Optimized for speed and efficiency in handling requests.
  • Microservice-Friendly: Perfect for building and managing microservices architectures.
  • Intuitive API: Simple and easy-to-use API for defining routes and handling requests.
  • TypeScript Support: Built with TypeScript for enhanced type safety and developer experience.

Installation

npm install @alwatr/nanotron

Getting Started

import { NanotronApiServer } from '@alwatr/nanotron';

const apiServer = new NanotronApiServer({
  host: '0.0.0.0',
  port: 80,
  prefix: '/api/',
});

apiServer.defineRoute({
  method: 'GET',
  url: '/hello',
  handler() {
    this.serverResponse.replyJson({
      ok: true,
      message: 'Hello :)',
    });
  }
});

apiServer.defineRoute({
  method: 'POST',
  url: '/echo-body',
  async handler() {
    const body = await this.getBodyRaw();
    this.serverResponse.replyJson({
      ok: true,
      data: body.toString(),
    });
  }
});

Sponsors

The following companies, organizations, and individuals support Nanotron ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.

Exir Studio

Contributing

Contributions are welcome! Please read our contribution guidelines before submitting a pull request.

License

This project is licensed under the AGPL-3.0 License.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.9.1 (2025-03-06)

Dependencies update

  • deps-dev: bump the dependencies group with 5 updates (e6a00eb) by @dependabot[bot]
  • update @alwatr/nanolib and @alwatr/nano-build to version 5.5.0; bump @alwatr/type-helper to version 5.4.0 (1e8b122) by @

4.9.0 (2025-02-26)

Dependencies update

  • bump @types/node from 22.13.4 to 22.13.5 and prettier from 3.5.1 to 3.5.2 across multiple packages (3d55c9a) by @alimd

4.8.1 (2025-02-18)

Dependencies update

  • deps-dev: bump the dependencies group across 1 directory with 11 updates (9257e08) by @dependabot[bot]
  • update TypeScript, Prettier, and various dependencies to latest versions (5c0f752) by @

4.8.0 (2024-11-08)

Note: Version bump only for package @alwatr/nanotron

4.7.0 (2024-11-07)

Note: Version bump only for package @alwatr/nanotron

4.6.0 (2024-11-07)

Dependencies update

  • deps-dev: bump @types/node in the dependencies group (9901819) by @dependabot[bot]
  • deps: bump @alwatr/nanolib from 5.0.0 to 5.2.1 in the alwatr group (f06afb7) by @dependabot[bot]

4.5.2 (2024-11-02)

Dependencies update

  • deps: bump the alwatr group with 6 updates (6636bb3) by @dependabot[bot]
  • update (86fbeb6) by @

4.5.1 (2024-10-28)

Note: Version bump only for package @alwatr/nanotron

4.5.0 (2024-10-28)

Features

  • nanotron: use pre-handlers package (11595c8) by @mohammadhonarvar

Dependencies update

  • bump the development-dependencies group across 1 directory with 2 updates (8b3e101) by @dependabot[bot]
  • update nanolib v1.4.0 and other deps (b8e7be7) by @

4.4.1 (2024-10-16)

Dependencies update

4.4.0 (2024-10-14)

Note: Version bump only for package @alwatr/nanotron

4.3.0 (2024-10-11)

Features

  • nanotron: install nanolib packages & export them here (169f360) by @mohammadhonarvar
  • update imports & packages based on the latest changes of nanolib & prevent sideeffects from build result (1d234b8) by @mohammadhonarvar

Bug Fixes

  • nanotro: update imports & remove extra exports (2bc4d2e) by @mohammadhonarvar

Code Refactoring

  • update imports & packages based on the latest changes of nanolib (7652b5d) by @mohammadhonarvar

Miscellaneous Chores

  • edited README (d707d38) by @ArmanAsadian

Dependencies update

  • update (834ffcc) by @mohammadhonarvar
  • update (fab97ef) by @mohammadhonarvar

4.2.2 (2024-09-29)

Miscellaneous Chores

  • nanotron: change the license to AGPL-3.0 (a1699ee) by @ArmanAsadian

Dependencies update

  • bump @types/node in the development-dependencies group (9c8d7d5) by @dependabot[bot]
  • update (1c4ef63) by @AliMD

4.2.1 (2024-09-24)

Dependencies update

4.2.0 (2024-09-23)

Features

  • Add @alwatr/crypto dependency to nanotron package.json and tsconfig.json (94cdf28) by @AliMD

Bug Fixes

  • export crypto from nanotron (21f00d2) by @njfamirm

Dependencies update

  • bump the alwatr-dependencies group with 6 updates (1c8a8ec) by @dependabot[bot]
  • bump the development-dependencies group with 2 updates (e3bc7f7) by @dependabot[bot]
  • update (d9f8d57) by @AliMD

4.1.0 (2024-09-14)

Features

  • route handlers to use 'call' method for binding 'this' (69517c1) by @

4.0.2 (2024-09-14)

Bug Fixes

  • definePackage (a2edcc1) by @AliMD

4.0.1 (2024-09-14)

Note: Version bump only for package @alwatr/nanotron

4.0.0 (2024-09-14)

Note: Version bump only for package @alwatr/nanotron

4.0.0-alpha.3 (2024-09-13)

Features

  • api-server: add new endpoint for hello2 in API demo (818c710) by @AliMD
  • demo: add POST /echo-body endpoint to echo request body (f13b916) by @AliMD

4.0.0-alpha.2 (2024-09-12)

Code Refactoring

  • api-server: Add new route for /hello endpoint (d2dad04) by @AliMD

Miscellaneous Chores

4.0.0-alpha.1 (2024-09-11)

Features

  • demo: add 404 test (b15bf5d) by @AliMD

Bug Fixes

  • demo: update with new apis (16fceca) by @

4.0.0-alpha.0 (2024-09-10)

Features

  • Add API routes for root and hello endpoints in api-server demo (4692fbb) by @AliMD
  • new package for export all nanotron packages (1c065d2) by @AliMD