create-hest-app 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +211 -0
  2. package/dist/index.js +127 -0
  3. package/package.json +50 -0
  4. package/templates/base/.prettierrc +33 -0
  5. package/templates/base/.vscode/extensions.json +79 -0
  6. package/templates/base/.vscode/settings.json +70 -0
  7. package/templates/base/README.md +562 -0
  8. package/templates/base/eslint.config.ts +26 -0
  9. package/templates/base/package.json +62 -0
  10. package/templates/base/src/app.controller.ts +39 -0
  11. package/templates/base/src/app.module.ts +12 -0
  12. package/templates/base/src/app.service.ts +30 -0
  13. package/templates/base/src/common/filters/http-exception.filter.ts +34 -0
  14. package/templates/base/src/common/interceptors/response.interceptor.ts +38 -0
  15. package/templates/base/src/index.ts +35 -0
  16. package/templates/base/src/modules/custom-validation/custom-validation.controller.ts +146 -0
  17. package/templates/base/src/modules/custom-validation/custom-validation.module.ts +10 -0
  18. package/templates/base/src/modules/custom-validation/custom-validation.service.ts +33 -0
  19. package/templates/base/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
  20. package/templates/base/src/modules/users/dto/user.dto.ts +64 -0
  21. package/templates/base/src/modules/users/entities/user.entity.ts +9 -0
  22. package/templates/base/src/modules/users/users.controller.ts +68 -0
  23. package/templates/base/src/modules/users/users.module.ts +10 -0
  24. package/templates/base/src/modules/users/users.service.ts +55 -0
  25. package/templates/base/tsconfig.json +19 -0
  26. package/templates/base_scalar/.prettierrc +32 -0
  27. package/templates/base_scalar/.vscode/extensions.json +79 -0
  28. package/templates/base_scalar/.vscode/settings.json +70 -0
  29. package/templates/base_scalar/README.md +562 -0
  30. package/templates/base_scalar/eslint.config.ts +26 -0
  31. package/templates/base_scalar/package.json +63 -0
  32. package/templates/base_scalar/src/app.controller.ts +196 -0
  33. package/templates/base_scalar/src/app.module.ts +12 -0
  34. package/templates/base_scalar/src/app.service.ts +30 -0
  35. package/templates/base_scalar/src/common/filters/http-exception.filter.ts +34 -0
  36. package/templates/base_scalar/src/common/interceptors/response.interceptor.ts +38 -0
  37. package/templates/base_scalar/src/index.ts +67 -0
  38. package/templates/base_scalar/src/modules/custom-validation/custom-validation.controller.ts +146 -0
  39. package/templates/base_scalar/src/modules/custom-validation/custom-validation.module.ts +10 -0
  40. package/templates/base_scalar/src/modules/custom-validation/custom-validation.service.ts +33 -0
  41. package/templates/base_scalar/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
  42. package/templates/base_scalar/src/modules/users/dto/user.dto.ts +64 -0
  43. package/templates/base_scalar/src/modules/users/entities/user.entity.ts +9 -0
  44. package/templates/base_scalar/src/modules/users/users.controller.ts +68 -0
  45. package/templates/base_scalar/src/modules/users/users.module.ts +10 -0
  46. package/templates/base_scalar/src/modules/users/users.service.ts +55 -0
  47. package/templates/base_scalar/tsconfig.json +19 -0
  48. package/templates/cqrs/.prettierrc +33 -0
  49. package/templates/cqrs/.vscode/extensions.json +79 -0
  50. package/templates/cqrs/.vscode/settings.json +70 -0
  51. package/templates/cqrs/README.md +234 -0
  52. package/templates/cqrs/eslint.config.ts +26 -0
  53. package/templates/cqrs/package.json +62 -0
  54. package/templates/cqrs/src/app.controller.ts +28 -0
  55. package/templates/cqrs/src/app.module.ts +12 -0
  56. package/templates/cqrs/src/app.service.ts +8 -0
  57. package/templates/cqrs/src/common/filters/http-exception.filter.ts +34 -0
  58. package/templates/cqrs/src/common/interceptors/response.interceptor.ts +38 -0
  59. package/templates/cqrs/src/index.ts +38 -0
  60. package/templates/cqrs/src/modules/custom-validation/custom-validation.controller.ts +146 -0
  61. package/templates/cqrs/src/modules/custom-validation/custom-validation.module.ts +10 -0
  62. package/templates/cqrs/src/modules/custom-validation/custom-validation.service.ts +33 -0
  63. package/templates/cqrs/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
  64. package/templates/cqrs/src/modules/users/dto/user.dto.ts +64 -0
  65. package/templates/cqrs/src/modules/users/entities/user.entity.ts +9 -0
  66. package/templates/cqrs/src/modules/users/users.controller.ts +68 -0
  67. package/templates/cqrs/src/modules/users/users.module.ts +10 -0
  68. package/templates/cqrs/src/modules/users/users.service.ts +55 -0
  69. package/templates/cqrs/src/test-error-scenarios.ts +54 -0
  70. package/templates/cqrs/src/users/commands/create-user.command.ts +8 -0
  71. package/templates/cqrs/src/users/commands/index.ts +2 -0
  72. package/templates/cqrs/src/users/commands/update-user.command.ts +11 -0
  73. package/templates/cqrs/src/users/entities/index.ts +1 -0
  74. package/templates/cqrs/src/users/entities/user.entity.ts +22 -0
  75. package/templates/cqrs/src/users/events/index.ts +2 -0
  76. package/templates/cqrs/src/users/events/user-created.event.ts +8 -0
  77. package/templates/cqrs/src/users/events/user-updated.event.ts +8 -0
  78. package/templates/cqrs/src/users/handlers/create-user.handler.ts +26 -0
  79. package/templates/cqrs/src/users/handlers/get-all-users.handler.ts +15 -0
  80. package/templates/cqrs/src/users/handlers/get-user.handler.ts +15 -0
  81. package/templates/cqrs/src/users/handlers/index.ts +6 -0
  82. package/templates/cqrs/src/users/handlers/update-user.handler.ts +33 -0
  83. package/templates/cqrs/src/users/handlers/user-created.handler.ts +15 -0
  84. package/templates/cqrs/src/users/handlers/user-updated.handler.ts +15 -0
  85. package/templates/cqrs/src/users/index.ts +8 -0
  86. package/templates/cqrs/src/users/queries/get-all-users.query.ts +8 -0
  87. package/templates/cqrs/src/users/queries/get-user.query.ts +12 -0
  88. package/templates/cqrs/src/users/queries/index.ts +2 -0
  89. package/templates/cqrs/src/users/repositories/index.ts +1 -0
  90. package/templates/cqrs/src/users/repositories/user.repository.ts +51 -0
  91. package/templates/cqrs/src/users/user.controller.ts +66 -0
  92. package/templates/cqrs/src/users/user.module.ts +30 -0
  93. package/templates/cqrs/tsconfig.json +19 -0
  94. package/templates/cqrs_scalar/.prettierrc +33 -0
  95. package/templates/cqrs_scalar/.vscode/extensions.json +79 -0
  96. package/templates/cqrs_scalar/.vscode/settings.json +70 -0
  97. package/templates/cqrs_scalar/README.md +234 -0
  98. package/templates/cqrs_scalar/eslint.config.ts +26 -0
  99. package/templates/cqrs_scalar/package.json +62 -0
  100. package/templates/cqrs_scalar/src/app.controller.ts +28 -0
  101. package/templates/cqrs_scalar/src/app.module.ts +12 -0
  102. package/templates/cqrs_scalar/src/app.service.ts +8 -0
  103. package/templates/cqrs_scalar/src/common/filters/http-exception.filter.ts +34 -0
  104. package/templates/cqrs_scalar/src/common/interceptors/response.interceptor.ts +38 -0
  105. package/templates/cqrs_scalar/src/index.ts +38 -0
  106. package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.controller.ts +146 -0
  107. package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.module.ts +10 -0
  108. package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.service.ts +33 -0
  109. package/templates/cqrs_scalar/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
  110. package/templates/cqrs_scalar/src/modules/users/dto/user.dto.ts +64 -0
  111. package/templates/cqrs_scalar/src/modules/users/entities/user.entity.ts +9 -0
  112. package/templates/cqrs_scalar/src/modules/users/users.controller.ts +68 -0
  113. package/templates/cqrs_scalar/src/modules/users/users.module.ts +10 -0
  114. package/templates/cqrs_scalar/src/modules/users/users.service.ts +55 -0
  115. package/templates/cqrs_scalar/src/test-error-scenarios.ts +54 -0
  116. package/templates/cqrs_scalar/src/users/commands/create-user.command.ts +8 -0
  117. package/templates/cqrs_scalar/src/users/commands/index.ts +2 -0
  118. package/templates/cqrs_scalar/src/users/commands/update-user.command.ts +11 -0
  119. package/templates/cqrs_scalar/src/users/entities/index.ts +1 -0
  120. package/templates/cqrs_scalar/src/users/entities/user.entity.ts +22 -0
  121. package/templates/cqrs_scalar/src/users/events/index.ts +2 -0
  122. package/templates/cqrs_scalar/src/users/events/user-created.event.ts +8 -0
  123. package/templates/cqrs_scalar/src/users/events/user-updated.event.ts +8 -0
  124. package/templates/cqrs_scalar/src/users/handlers/create-user.handler.ts +26 -0
  125. package/templates/cqrs_scalar/src/users/handlers/get-all-users.handler.ts +15 -0
  126. package/templates/cqrs_scalar/src/users/handlers/get-user.handler.ts +15 -0
  127. package/templates/cqrs_scalar/src/users/handlers/index.ts +6 -0
  128. package/templates/cqrs_scalar/src/users/handlers/update-user.handler.ts +33 -0
  129. package/templates/cqrs_scalar/src/users/handlers/user-created.handler.ts +15 -0
  130. package/templates/cqrs_scalar/src/users/handlers/user-updated.handler.ts +15 -0
  131. package/templates/cqrs_scalar/src/users/index.ts +8 -0
  132. package/templates/cqrs_scalar/src/users/queries/get-all-users.query.ts +8 -0
  133. package/templates/cqrs_scalar/src/users/queries/get-user.query.ts +12 -0
  134. package/templates/cqrs_scalar/src/users/queries/index.ts +2 -0
  135. package/templates/cqrs_scalar/src/users/repositories/index.ts +1 -0
  136. package/templates/cqrs_scalar/src/users/repositories/user.repository.ts +51 -0
  137. package/templates/cqrs_scalar/src/users/user.controller.ts +66 -0
  138. package/templates/cqrs_scalar/src/users/user.module.ts +30 -0
  139. package/templates/cqrs_scalar/tsconfig.json +19 -0
package/README.md ADDED
@@ -0,0 +1,211 @@
1
+ # create-hest-app
2
+
3
+ The easiest way to get started with HestJS is by using `create-hest-app`. This CLI tool enables you to quickly start building a new HestJS application, with everything set up for you.
4
+
5
+ ## Quick Start
6
+
7
+ To get started, use the following command:
8
+
9
+ ### Interactive
10
+
11
+ You can create a new project interactively by running:
12
+
13
+ ```bash
14
+ npx create-hest-app@latest
15
+ # or
16
+ yarn create hest-app
17
+ # or
18
+ pnpm create hest-app
19
+ # or
20
+ bun create hest-app
21
+ ```
22
+
23
+ # create-hest-app
24
+
25
+ The easiest way to get started with HestJS is by using `create-hest-app`. This CLI tool enables you to quickly start building a new HestJS application, with everything set up for you.
26
+
27
+ ## Quick Start
28
+
29
+ To get started, use the following command:
30
+
31
+ ```bash
32
+ npx create-hest-app@latest
33
+ # or
34
+ yarn create hest-app
35
+ # or
36
+ pnpm create hest-app
37
+ # or
38
+ bun create hest-app
39
+ ```
40
+
41
+ To create a new app in a specific folder, you can send a name as an argument. For example, the following command will create a new HestJS app called `blog-app` in a folder with the same name:
42
+
43
+ ```bash
44
+ npx create-hest-app@latest blog-app
45
+ ```
46
+
47
+ ## Options
48
+
49
+ `create-hest-app` comes with the following options:
50
+
51
+ - **--eslint, --no-eslint** - Initialize with ESLint configuration. (default: true)
52
+ - **--template [name]** - Initialize with a specific template. Available templates: `base`, `cqrs`
53
+ - **--use-npm** - Explicitly tell the CLI to bootstrap the app using npm
54
+ - **--use-pnpm** - Explicitly tell the CLI to bootstrap the app using pnpm
55
+ - **--use-yarn** - Explicitly tell the CLI to bootstrap the app using Yarn
56
+ - **--use-bun** - Explicitly tell the CLI to bootstrap the app using Bun
57
+ - **--skip-install** - Explicitly tell the CLI to skip installing packages
58
+
59
+ ## Interactive Experience
60
+
61
+ When you run `npx create-hest-app@latest` with no arguments, it launches an interactive experience that guides you through setting up a project.
62
+
63
+ ### On installation, you'll see the following prompts:
64
+
65
+ ```
66
+ ✔ Would you like to use ESLint? No
67
+ ✔ Which template would you like to use? Base - A simple HestJS application with basic features
68
+ ✔ Would you like to include Swagger/Scalar API documentation? (adds ~12MB to build size) No
69
+ ✔ Which package manager would you like to use? bun
70
+ ✔ Skip installing dependencies? Yes
71
+ Creating a new HestJS app in /private/tmp/test-hest-app.
72
+
73
+ Using template: base
74
+ Copying files from template...
75
+
76
+ Template files copied successfully!
77
+
78
+ Updated package.json with new app name: test-hest-app
79
+
80
+ Success! Created test-hest-app at test-hest-app
81
+ Inside that directory, you can run several commands:
82
+
83
+ bun dev
84
+ Starts the development server.
85
+
86
+ bun build
87
+ Builds the app for production.
88
+
89
+ bun start
90
+ Runs the built app in production mode.
91
+
92
+ Dependencies were not installed. To install them, run:
93
+
94
+ cd test-hest-app
95
+ bun install
96
+
97
+ Then start the development server:
98
+
99
+ bun dev
100
+ ```
101
+
102
+ ## Templates
103
+
104
+ `create-hest-app` ships with two templates:
105
+
106
+ ### Base Template
107
+ A simple HestJS application with basic features including:
108
+ - Basic controller and service structure
109
+ - Dependency injection with TSyringe
110
+ - Exception handling
111
+ - Request/response interceptors
112
+ - Built on Hono for high performance
113
+
114
+ ### CQRS Template
115
+ A complete application implementing the CQRS (Command Query Responsibility Segregation) pattern:
116
+ - Command and Query handlers
117
+ - Event-driven architecture
118
+ - Domain entities and repositories
119
+ - User management example with CRUD operations
120
+ - Advanced validation and error handling
121
+ - All Base template features included
122
+
123
+ ### Swagger/Scalar Documentation
124
+ Both templates can optionally include Swagger/Scalar API documentation:
125
+ - Interactive API documentation
126
+ - Type-safe schema generation
127
+ - Adds approximately 12MB to the final build size
128
+ - Perfect for API development and testing
129
+
130
+ ## Why use Create HestJS App?
131
+
132
+ `create-hest-app` allows you to create a new HestJS app within seconds. It is officially maintained by the HestJS team, and includes a number of benefits:
133
+
134
+ - **Interactive Experience**: Running `npx create-hest-app@latest` (with no arguments) launches an interactive experience that guides you through setting up a project.
135
+ - **Zero Dependencies**: Initializing a project is as quick as one command. No need to install or configure tools like TypeScript, ESLint, etc.
136
+ - **Tested**: The package is tested against all of its templates to ensure each one boots successfully.
137
+ - **Up to date**: Templates are kept up to date with the latest versions of HestJS and its ecosystem.
138
+
139
+ ## System Requirements
140
+
141
+ - Node.js 18.0 or later
142
+ - macOS, Windows (including WSL), and Linux are supported
143
+
144
+ ## License
145
+
146
+ MIT
147
+
148
+ ### Non-interactive
149
+
150
+ You can also pass command line arguments to set up a new project non-interactively. See `create-hest-app --help`:
151
+
152
+ ```bash
153
+ Usage: create-hest-app [project-directory] [options]
154
+
155
+ Options:
156
+ -V, --version display version number
157
+ --ts, --typescript initialize as a TypeScript project (default)
158
+ --js, --javascript initialize as a JavaScript project
159
+ --eslint initialize with ESLint config
160
+ --use-npm explicitly tell the CLI to bootstrap the app using npm
161
+ --use-pnpm explicitly tell the CLI to bootstrap the app using pnpm
162
+ --use-yarn explicitly tell the CLI to bootstrap the app using Yarn
163
+ --use-bun explicitly tell the CLI to bootstrap the app using Bun
164
+ --skip-install explicitly tell the CLI to skip installing packages
165
+ --template <template-name> specify the template to use (basic, api, full-featured)
166
+ -h, --help display help for command
167
+ ```
168
+
169
+ ## Why use Create HestJS App?
170
+
171
+ `create-hest-app` allows you to create a new HestJS app within seconds. It is officially maintained by the creators of HestJS, and includes a number of benefits:
172
+
173
+ - **Interactive Experience**: Running `npx create-hest-app@latest` (with no arguments) launches an interactive experience that guides you through setting up a project.
174
+ - **Zero Dependencies**: Initializing a project is as quick as one second. Create HestJS App has zero dependencies.
175
+ - **Offline Support**: Create HestJS App will automatically detect if you're offline and bootstrap your project using your local package cache.
176
+ - **Support for Examples**: Create HestJS App can bootstrap your application using different templates (basic, api, full-featured).
177
+ - **Tested**: The package is part of the HestJS monorepo and tested using the same integration test suite as HestJS itself, ensuring it works as expected with every release.
178
+
179
+ ## Templates
180
+
181
+ ### Basic
182
+ A simple HestJS application with minimal setup. Perfect for getting started quickly.
183
+
184
+ ### API
185
+ A RESTful API template with validation, documentation, and best practices for building APIs.
186
+
187
+ ### Full-featured
188
+ A complete application template with all HestJS features including CQRS, validation, logging, and more.
189
+
190
+ ## Getting Started
191
+
192
+ After the installation is complete:
193
+
194
+ - Run `npm run dev` or `yarn dev` or `pnpm dev` or `bun dev` to start the development server on `http://localhost:3000`
195
+ - Visit `http://localhost:3000` to view your application
196
+ - Edit `src/index.ts` and see your changes reflected in the browser
197
+
198
+ ## Learn More
199
+
200
+ To learn more about HestJS, take a look at the following resources:
201
+
202
+ - [HestJS Documentation](https://hestjs.dev) - learn about HestJS features and API
203
+ - [Learn HestJS](https://hestjs.dev/learn) - an interactive HestJS tutorial
204
+
205
+ ## Contributing
206
+
207
+ We welcome contributions to create-hest-app! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
208
+
209
+ ## License
210
+
211
+ MIT