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

@uecsio/users-api

v2.0.0

Published

A reusable NestJS API Users module for user management

Readme

@uecsio/users-api

A reusable NestJS API Users module for user management, built with TypeORM and following NestJS best practices.

Features

  • Complete CRUD Operations: Full Create, Read, Update, Delete functionality for users
  • TypeORM Integration: Built-in database entity and migration support
  • Validation: Input validation using class-validator
  • Swagger Documentation: Auto-generated API documentation
  • Modular Design: Easy to integrate into existing NestJS applications
  • Migration Support: Database schema management with TypeORM migrations

Installation

npm install @uecsio/users-api

Quick Start

1. Import the Module

import { Module } from '@nestjs/common';
import { UsersModule } from '@uecsio/users-api';

@Module({
  imports: [UsersModule],
})
export class AppModule {}

2. Configure TypeORM

The package automatically provides the User entity and migrations. Make sure your TypeORM configuration includes:

import { UsersMigrationConfig } from '@uecsio/users-api';

// In your TypeORM config
{
  entities: [...UsersMigrationConfig.entities],
  migrations: [...UsersMigrationConfig.migrations],
  migrationsTableName: UsersMigrationConfig.migrationsTableName,
}

3. Use the Service

import { UsersService } from '@uecsio/users-api';

@Injectable()
export class MyService {
  constructor(private readonly usersService: UsersService) {}

  async createUser(userData: CreateUserDto) {
    return this.usersService.create(userData);
  }
}

API Endpoints

The package automatically provides the following REST endpoints:

  • POST /users - Create a new user
  • GET /users - Get all users (with pagination)
  • GET /users/:id - Get a specific user
  • PUT /users/:id - Update a user
  • DELETE /users/:id - Delete a user

DTOs

CreateUserDto

{
  username: string;        // Required, unique, max 128 chars
  password: string;        // Required, max 128 chars
  role: string;           // Required
  status: number;         // Required (0: inactive, 1: active)
  name?: string;          // Optional, max 255 chars
  town: string;           // Required, max 255 chars
  address: string;        // Required
  email?: string;         // Optional, max 128 chars, email format
  phone: string;          // Required, max 50 chars
  profile?: string;       // Optional
}

UpdateUserDto

Extends CreateUserDto with partial support, allowing you to update only specific fields.

Entity

The User entity includes:

  • id: Auto-generated primary key
  • username: Unique username (128 chars max)
  • password: User password (128 chars max)
  • role: User role
  • status: User status (0: inactive, 1: active)
  • name: Full name (optional, 255 chars max)
  • town: Town/city (255 chars max)
  • address: Full address
  • email: Email address (optional, 128 chars max)
  • phone: Phone number (50 chars max)
  • profile: Additional profile info (optional)
  • createdAt: Timestamp of creation

Database Indexes

The package automatically creates the following database indexes for optimal performance:

  • IDX_USERS_USERNAME: Unique index on username
  • IDX_USERS_STATUS: Index on status for filtering
  • IDX_USERS_ROLE: Index on role for filtering
  • IDX_USERS_EMAIL: Index on email for lookups

Development

Building

npm run build

Testing

npm test
npm run test:watch
npm run test:cov

Linting

npm run lint
npm run lint:fix

Dependencies

Peer Dependencies

  • @nestjs/common: ^11.0.0
  • @nestjs/core: ^11.0.0
  • @nestjs/typeorm: ^11.0.0
  • typeorm: ^0.3.0
  • class-validator: ^0.14.0
  • class-transformer: ^0.5.1
  • @nestjs-library/crud: ^0.13.1

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

Support

For issues and questions, please use the GitHub issue tracker.