npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nest-yalc-2/crud-gen

v2.2.18

Published

<div align="center"> <h1>@nest-yalc-2/crud-gen</h1> <p><em>Core enterprise module for the @nest-yalc-2/crud-gen integration within the Ferrox/YALC ecosystem.</em></p>

Readme

npm version License

🚀 Installation

npm install @nest-yalc-2/crud-gen
# or
yarn add @nest-yalc-2/crud-gen
# or
pnpm add @nest-yalc-2/crud-gen

⚡ Zero-Boilerplate TypeORM CRUD Generator (@nest-yalc-2/crud-gen)

💡 1. What It Is & Architectural Purpose

@nest-yalc-2/crud-gen is the automated REST and GraphQL code generation module for NestJS 11+. It was designed to eliminate up to 40% of repetitive controller, resolver, service, DTO, and query builder boilerplate for TypeORM database entities, while maintaining full developer control over authorization and middleware.


⚙️ 2. What It Does & Key Features

  • Automated REST Endpoints: Generates getMany, getOne, createOne, updateOne, deleteOne endpoints automatically.
  • Automated GraphQL Queries & Mutations: Produces strongly-typed GraphQL schemas, input DTOs, and field resolvers.
  • Dynamic SQL Query Parsing: Translates HTTP query strings (e.g. filter[age][gte]=18&sort=-createdAt) into optimized TypeORM WHERE, ORDER BY, and JOIN clauses.
  • Pagination Support: Automatic cursor-based or offset-based pagination.

🔬 3. How It Works Under the Hood

flowchart TD
    Entity["@Entity() Product Decorator"]
    CrudMacro["@CrudGenEntity() Metadata Processor"]
    RouterBuilder["Dynamic Controller & Resolver Factory"]
    TypeORM["TypeORM QueryBuilder Engine"]

    Entity --> CrudMacro
    CrudMacro --> RouterBuilder
    RouterBuilder --> TypeORM
  1. Metadata Reflection: Decorating a TypeORM entity with @CrudGenEntity() registers entity metadata and route configuration choices.
  2. Dynamic Factory Pattern: On NestJS application bootstrap, the crud-gen factory dynamically instantiates REST controllers and GraphQL resolvers with dependency injection into TypeORM repositories.

🧠 4. Why It Was Designed This Way (CrudGen vs Manual Scaffolding)

| Dimension | ⚡ @nest-yalc-2/crud-gen | 🐢 Manual NestJS Scaffolding | |---|---|---| | Endpoint Setup Time | < 2 minutes per Entity | 2-4 hours per Entity | | Maintainability | Centralized (Modify Entity to Update API) | Dozens of files to sync (DTO, Service, Controller, Resolver) | | Dynamic Filtering | Native SQL Query Filtering Support | Requires Handwritten QueryBuilder Logic |


🚀 5. Practical Usage Guide & Extended Code Examples

import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm';
import { CrudGenEntity } from '@nest-yalc-2/crud-gen';

@Entity('products')
@CrudGenEntity({
  routes: ['getMany', 'getOne', 'createOne', 'updateOne', 'deleteOne'],
  graphql: { enabled: true }
})
export class Product {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  sku: string;

  @Column()
  name: string;

  @Column('decimal', { precision: 10, scale: 2 })
  price: number;

  @CreateDateColumn()
  createdAt: Date;
}

⚠️ 6. Anti-Patterns: How NOT to Use It

  1. ❌ DO NOT expose all CRUD routes on sensitive entities without Auth Guards: Enabling deleteOne or updateOne without applying @UseGuards() exposes public data mutation endpoints.
  2. ❌ DO NOT use crud-gen for complex business workflows requiring Sagas: For operations involving payment providers or multi-step sagas, write a custom Controller/Resolver instead of standard CRUD logic.

💡 7. Pro-Tips & Best Practices

[!TIP] Customizing Generated Routes: You can override or extend any automatically generated route by declaring a custom Controller extending the base class produced by crud-gen.


🔗 Cross-References

To see how this module integrates with the rest of the Ferrox architecture, refer to the following documentation:


📚 Ecosystem Documentation

This module is a core component of the Ferrox enterprise microservice architecture.

👉 Read the Full Documentation on Ferrox-Rust.dev