@chinmay20409/data-crud-gen
v1.0.0
Published
> CLI tool to generate NestJS CRUD modules, services, and controllers based on your entity files.
Readme
@chinmay20409/data-crud-gen
CLI tool to generate NestJS CRUD modules, services, and controllers based on your entity files.
Features
- Interactive CLI prompts to specify entity path, class name, primary key, and module name.
- Generates NestJS module, service, and controller files with TypeORM and CRUD decorators.
- Supports customizable folder and file structure.
- Helps speed up boilerplate code creation for CRUD APIs.
Installation
You can install the package globally using npm:
npm install -g @chinmay20409/data-crud-genOr if you want to test locally before publishing:
npm linkUsage
Run the CLI command:
data-ui-moduleYou will be prompted to enter:
- Entity file path: The relative path to your entity
.tsfile (e.g.src/_core/entities/doctor-master.entity.ts). - Entity class name: The name of your entity class (e.g.
DoctorMasterViewEntity). - Primary key field: The primary key property name (e.g.
dr_id). - Module name: The desired module name (e.g.
doctor-view).
The tool will generate a folder named after the module in kebab-case containing:
*.module.tsservices/*.service.ts*.controller.ts
After Generation
Make sure to import and add the generated module to your root application module (app.module.ts):
import { DoctorViewModule } from './doctor-view/doctor-view.module';
@Module({
imports: [
DoctorViewModule,
// other modules
],
})
export class AppModule {}Development
If you want to build from source:
npm run buildThen you can link the package globally for testing:
npm link