An open API service indexing awesome lists of open source software.

https://github.com/thomasbarkats/yasui

Lightweight multi-runtime framework built on Web Standards for REST APIs.
https://github.com/thomasbarkats/yasui

api backend framework typescript

Last synced: 19 days ago
JSON representation

Lightweight multi-runtime framework built on Web Standards for REST APIs.

Awesome Lists containing this project

README

          



Logo

YasuiJS

[![Node.js Version](https://img.shields.io/node/v/yasui.svg?color=EAA458)](https://nodejs.org/)
[![npm bundle size](https://img.shields.io/npm/unpacked-size/yasui?color=EAA458)](https://www.npmjs.com/package/yasui)
[![npm downloads](https://img.shields.io/npm/dm/yasui.svg?color=C17633)](https://www.npmjs.com/package/yasui)

Ship production-ready REST APIs in minutes 🐿️
  •  
**[Documentation](https://yasui.app/guide/getting-started.html)** 📖



## What is YasuiJS?

Yasui (meaning "easy" in Japanese) is a lightweight multi-runtime framework built on Web Standards and pushed with [SRVX](https://srvx.h3.dev), that brings the developer experience of modern frameworks without the complexity. It runs on Node.js, Deno, and Bun, providing the structure you need with just the features you'll actually use.

## Features Summary
- **Multi-Runtime**: Runs on Node.js, Deno, and Bun via SRVX and Web Standards
- **Lightweight & Fast**: Minimal dependencies with focus on essentials without the bloat
- **Complete Error Handling**: Everything can throw without try/catch - automatic error handling everywhere
- **Automatic Type-Casting**: Query params automatically converted to proper types. Even in middlewares
- **Flexible DI System**: Constructor and method-level injection with configurable scopes for better control
- **Simple Middlewares**: Apply at global, controller, or route level. Use the same decorators as controllers
- **Rich Swagger Generation**: Flexible decorators for enums, arrays, classes, OpenAPI schemas
- **HTTPS/HTTP2 Support**: Built-in TLS configuration with automatic HTTP/2 on Node.js
- **Type-safe**: Full TypeScript support with proper typing

## Quick Start

```sh
npm install yasui
```

```ts
import yasui, { Controller, Get } from 'yasui';

@Controller('/')
export class AppController {
@Get('/')
hello() {
return { message: 'Hello World!' };
}
}

yasui.createServer({
controllers: [AppController]
});
```

## 📖 **[Documentation](https://yasui.app/guide/getting-started.html)**

- [Configuration](https://yasui.app/guide/config.html) - Server setup and global options
- [Controllers](https://yasui.app/guide/controllers.html) - Define routes with decorators and automatic type casting
- [Dependency Injection](https://yasui.app/guide/dependency-injection.html) - Constructor and method-level injection with flexible scopes
- [Error Handling](https://yasui.app/guide/error-handling.html) - Automatic error catching without try/catch blocks
- [Logging](https://yasui.app/guide/logging.html) - Built-in timing and color-coded logging service
- [Middlewares](https://yasui.app/guide/middlewares.html) - Apply at multiple levels with same decorators as controllers
- [Pipes](https://yasui.app/guide/pipes.html) - Transform and validate request data automatically
- [Swagger Doc.](https://yasui.app/guide/swagger.html) - Generate OpenAPI docs with flexible decorators

## Plugins

Production-ready middlewares and utilities for YasuiJS:

- **[@yasui/cors](https://www.npmjs.com/package/@yasui/cors)** ([JSR](https://jsr.io/@yasui/cors)) - CORS middleware
- **[@yasui/rate-limit](https://www.npmjs.com/package/@yasui/rate-limit)** ([JSR](https://jsr.io/@yasui/rate-limit)) - Rate limiting middleware
- **[@yasui/validation](https://www.npmjs.com/package/@yasui/validation)** ([JSR](https://jsr.io/@yasui/validation)) - Automatic DTO validation middleware

## Why YasuiJS?

YasuiJS adopts a **class-based, object-oriented approach** with decorators, bringing significant architectural advantages:

### Better Code Organization
Classes and decorators provide better organization, encapsulation, and maintainability. This approach naturally supports established architectural patterns like onion architecture, hexagonal architecture, and clean architecture.

### Dependency Injection
Built-in dependency injection enables loose coupling, better testability, and cleaner separation of concerns. Dependencies are explicitly declared and automatically resolved.

### Declarative Over Imperative
Instead of manually registering routes and extracting parameters, you declare what you want using decorators. The framework handles the implementation details.

### Multi-Runtime Support
Built on web standards, YasuiJS provides a portable, standard codebase for JavaScript runtimes, capable of running on Node.js, Deno, and Bun with [SRVX](https://srvx.h3.dev), a universal server abstraction based on the Fetch API. Future-proof your applications with standard web APIs.

## Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.
Please use `npm run commit` to standardize commits nomenclature.

## License

This project is licensed under the [GNU Affero General Public License v3.0 or later](https://www.gnu.org/licenses/agpl-3.0.html). See the [LICENSE](./LICENSE) file for details.