1.0.5 • Published 6 months ago

nest-generator-cli v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Nest Generator CLI

A powerful CLI tool for generating NestJS modules with Prisma integration. Quickly scaffold CRUD modules with proper TypeScript types, Swagger documentation, and Prisma schema integration.

Features

  • šŸš€ Generate complete NestJS CRUD modules
  • šŸ“ Auto-generate Prisma schema models
  • šŸ”„ Create DTOs with validation
  • šŸ“š Swagger/OpenAPI documentation
  • šŸŽÆ TypeScript support
  • ⚔ Proper naming conventions
  • šŸ” Interactive CLI interface

Installation

npm install -g nest-generator-cli

Usage

Run the generator:

nest-gen

Or using npx:

npx nest-generator-cli

The CLI will guide you through: 1. Entering the model name 2. Defining fields and their types 3. Setting up relationships 4. Generating all necessary files

Generated Files Structure

For each model, the following files are generated:

src/
└── your-model/
    ā”œā”€ā”€ dto/
    │   ā”œā”€ā”€ create-your-model.dto.ts
    │   └── update-your-model.dto.ts
    ā”œā”€ā”€ your-model.controller.ts
    ā”œā”€ā”€ your-model.service.ts
    └── your-model.module.ts

And in your Prisma schema:

prisma/
└── models/
    └── your-model.prisma

Features in Detail

1. Model Generation

  • Automatic Prisma schema generation
  • Support for all common data types
  • Relationship handling (One-to-One, One-to-Many, Many-to-Many)
  • Proper timestamps and ID fields

2. API Generation

  • Complete CRUD operations
  • Request validation
  • Swagger documentation
  • Proper error handling

3. Type Safety

  • TypeScript interfaces
  • DTO validation
  • Prisma client type generation

4. Best Practices

  • Follows NestJS conventions
  • Proper file organization
  • Clean code structure
  • Consistent naming

Configuration

The generator uses your project's existing Prisma configuration. Make sure you have a valid DATABASE_URL in your .env file:

DATABASE_URL="postgresql://user:password@localhost:5432/dbname"

Requirements

  • Node.js >= 14
  • NestJS project
  • Prisma setup in your project

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License - see the LICENSE file for details# nest-generator-cli

nest-generator-cli

nest-generator-cli

nest-generator-cli

nest-generator-cli

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago