Nest AutoCRUD
Go to file
2024-11-10 11:49:04 +07:00
libs feat: full working of typeorm 2024-11-10 11:42:27 +07:00
prisma feat: implement unique identifier when searching to database 2024-11-02 09:41:20 +07:00
scripts/unix chore: cleaner after publish 2024-11-02 23:14:35 +07:00
src feat: full working of typeorm 2024-11-10 11:42:27 +07:00
test wip: typeorm module and service 2024-11-06 01:00:33 +07:00
.env.example chore: env and prisma init 2024-10-26 19:17:58 +07:00
.eslintrc.js wip: controller 2024-10-26 15:35:59 +07:00
.gitignore chore: change to package instead of dist 2024-10-29 09:48:50 +07:00
.npmignore chore: change to package instead of dist 2024-10-29 09:48:50 +07:00
.prettierrc wip: controller 2024-10-26 15:35:59 +07:00
.release-it.json feat: using release-it instead 2024-10-29 10:08:36 +07:00
jsr.json feat: add jsr 2024-10-29 01:38:53 +07:00
nest-cli.json wip: typeorm module and service 2024-11-06 01:00:33 +07:00
package-lock.json wip: get database credential by single env that also used by prisma 2024-11-05 00:11:42 +07:00
package.json chore: update version 2024-11-10 11:49:04 +07:00
README.md chore: readme 2024-11-10 11:46:06 +07:00
tsconfig.build.json wip: controller 2024-10-26 15:35:59 +07:00
tsconfig.json wip: typeorm module and service 2024-11-06 01:00:33 +07:00

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

Status

This project is still in development and not ready for production, it's not even ready to install yet. Calling for contributors to help this project.

Description

Nest Auto CRUD is a library that provides a set of modules, decorator, service, and many more to reduce the boilerplate code.

Roadmap

Basic Thing

  • Custom body mapping
  • Custom validation

Advanced Support

  • Generic support for Prisma ORM #5273

Installation

$ npm install @aditama-labs/nest-autocrud

Example

Prisma ORM

// Your Module
@Module({
  imports: [
    // This module will automatically map your model to the controller
    PrismaModule.forRoot({
      delegate: (prisma: PrismaClient) => prisma.user,
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

// Your Controller
@Controller('examples')
export class AppController extends SkeletonCRUDController {
  // Yes, no need to write anything here
}

TypeORM

// Your Entity
@Entity('account')
export class UserEntity {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ type: String })
  username: string;

  @Column({ type: String })
  name: string;
}

// Your Module
@Module({
  // This module will automatically map your model to the controller
  imports: [
    TypeORMModule.forRoot<UserEntity>({
      entity: UserEntity,
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

// Your Controller
@Controller('examples')
export class AppController extends SkeletonCRUDController {
  // Yes, no need to write anything here
}

Output in Terminal

// Expected Output ( As you can see the API is automatically mapped and generated )
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [NestFactory] Starting Nest application...
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [InstanceLoader] PrismaModule dependencies initialized +14ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RoutesResolver] AppController {/examples}: +3ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples, POST} route +3ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples/:id, DELETE} route +1ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples/list, GET} route +0ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples, GET} route +1ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples/:id, GET} route +0ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [RouterExplorer] Mapped {/examples/:id, PATCH} route +0ms
[Nest] 125875  - 10/30/2024, 10:57:56 PM     LOG [NestApplication] Nest application successfully started +148ms

Support

Nest AutoCRUD is an MIT-licensed open source project.

Stay in touch

License

Nest AutoCRUD is MIT licensed