Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payment link revamp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Daffa
payment link revamp
Commits
6a949dc4
Commit
6a949dc4
authored
Oct 01, 2025
by
Daffa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add documentation for creating new modules and CRUD resources in README
parent
5152dcd0
Pipeline
#2159
failed
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
README.md
README.md
+65
-0
No files found.
README.md
View file @
6a949dc4
...
...
@@ -226,6 +226,71 @@ module.exports = {
npm run db:migrate
```
## Creating New Modules
NestJS CLI provides a powerful generator to create new modules with all necessary files.
### Generate a complete CRUD resource:
```
bash
nest g resource products
```
This will prompt you to:
-
Choose transport layer (REST API, GraphQL, Microservice, WebSockets) - Select
**REST API**
-
Generate CRUD entry points? - Select
**Yes**
This command creates:
```
src/modules/products/
├── dto/
│ ├── create-product.dto.ts
│ └── update-product.dto.ts
├── entities/
│ └── product.entity.ts
├── products.controller.ts
├── products.module.ts
├── products.service.ts
└── products.controller.spec.ts
```
### Other useful generators:
Generate a module only:
```
bash
nest g module products
```
Generate a controller:
```
bash
nest g controller products
```
Generate a service:
```
bash
nest g service products
```
Generate a guard:
```
bash
nest g guard auth/guards/custom
```
Generate a decorator:
```
bash
nest g decorator common/decorators/custom
```
Generate a middleware:
```
bash
nest g middleware common/middleware/custom
```
After generating a new module, remember to:
1.
Create the corresponding Sequelize model in
`src/database/models/`
2.
Create a migration for the database table
3.
Add the model to
`SequelizeModule.forFeature([])`
in your module
4.
Update DTOs with proper validation decorators
## Contributors
-
Daffa Praramadhana -
[
daffa.praramadhana@mdd.co.id
](
mailto:daffa.praramadhana@mdd.co.id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment