Socket
Book a DemoInstallSign in
Socket

@lonestone/nzoth

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lonestone/nzoth

NZOTH: Nest + Zod + OpenAPI + Typed + Helpers - Build fully type-safe REST APIs with NestJS

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
2
Created
Source

@lonestone/nzoth

NZOTH: Nest + Zod + OpenAPI + Typed + Helpers

A collection of NestJS utilities for building RESTful APIs with support for filtering, pagination, sorting, type-safe request/response validation, and OpenAPI schema registration using Zod. Allows registering Zod schemas with OpenAPI metadata for automatic documentation generation.

Why NZOTH?

NZOTH combines the best of all worlds:

  • NestJS: The progressive Node.js framework for building efficient, reliable, and scalable server-side applications
  • Zod: TypeScript-first schema validation with static type inference
  • OpenAPI: Automated API documentation that stays in sync with your code
  • Typed: End-to-end type safety from your routes to your controllers to your clients
  • Helpers: A comprehensive collection of utilities for filtering, pagination, sorting, and more

Our goal is to provide a type-safe API solution that's easy to use while still being compatible with various languages and tools. NZOTH offers a simple yet powerful alternative to solutions like tRPC and GraphQL for projects that need REST APIs with strong typing.

Features

  • Validation: Comprehensive Zod-based validation for requests and responses
  • 🎯 Decorators: Decorators to validate route response, parameters, query params, and body
  • 🔍 Filtering: Flexible query parameter-based filtering with multiple operators
  • 📄 Pagination: Easy-to-use pagination with offset and page size
  • 🔃 Sorting: Multi-field sorting with ascending/descending support
  • 📄 OpenAPI: Automatically generate OpenAPI documentation from your Zod schemas

Installation

npm install @lonestone/nzoth
# or
yarn add @lonestone/nzoth
# or
pnpm add @lonestone/nzoth

Basic Usage

import { TypedRoute, TypedBody } from '@lonestone/nzoth/server';
import { z } from 'zod';

const UserSchema = z.object({
  id: z.string().uuid(),
  name: z.string().min(3),
  email: z.string().email(),
});

@Controller('users')
class UserController {
  @TypedRoute.Get(undefined, UserSchema.array())
  findAll(): User[] {
    return this.userService.findAll();
  }

  @TypedRoute.Post('/', UserSchema)
  create(@TypedBody(UserSchema.omit({ id: true })) dto: CreateUserDto): User {
    return this.userService.create(dto);
  }
}

Documentation

For full documentation, examples, and API reference, visit the GitHub repository.

License

UNLICENSED - ©Lonestone - Pierrick Bignet

Keywords

nestjs

FAQs

Package last updated on 09 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts