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.
- package/README.md +211 -0
- package/dist/index.js +127 -0
- package/package.json +50 -0
- package/templates/base/.prettierrc +33 -0
- package/templates/base/.vscode/extensions.json +79 -0
- package/templates/base/.vscode/settings.json +70 -0
- package/templates/base/README.md +562 -0
- package/templates/base/eslint.config.ts +26 -0
- package/templates/base/package.json +62 -0
- package/templates/base/src/app.controller.ts +39 -0
- package/templates/base/src/app.module.ts +12 -0
- package/templates/base/src/app.service.ts +30 -0
- package/templates/base/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/base/src/common/interceptors/response.interceptor.ts +38 -0
- package/templates/base/src/index.ts +35 -0
- package/templates/base/src/modules/custom-validation/custom-validation.controller.ts +146 -0
- package/templates/base/src/modules/custom-validation/custom-validation.module.ts +10 -0
- package/templates/base/src/modules/custom-validation/custom-validation.service.ts +33 -0
- package/templates/base/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
- package/templates/base/src/modules/users/dto/user.dto.ts +64 -0
- package/templates/base/src/modules/users/entities/user.entity.ts +9 -0
- package/templates/base/src/modules/users/users.controller.ts +68 -0
- package/templates/base/src/modules/users/users.module.ts +10 -0
- package/templates/base/src/modules/users/users.service.ts +55 -0
- package/templates/base/tsconfig.json +19 -0
- package/templates/base_scalar/.prettierrc +32 -0
- package/templates/base_scalar/.vscode/extensions.json +79 -0
- package/templates/base_scalar/.vscode/settings.json +70 -0
- package/templates/base_scalar/README.md +562 -0
- package/templates/base_scalar/eslint.config.ts +26 -0
- package/templates/base_scalar/package.json +63 -0
- package/templates/base_scalar/src/app.controller.ts +196 -0
- package/templates/base_scalar/src/app.module.ts +12 -0
- package/templates/base_scalar/src/app.service.ts +30 -0
- package/templates/base_scalar/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/base_scalar/src/common/interceptors/response.interceptor.ts +38 -0
- package/templates/base_scalar/src/index.ts +67 -0
- package/templates/base_scalar/src/modules/custom-validation/custom-validation.controller.ts +146 -0
- package/templates/base_scalar/src/modules/custom-validation/custom-validation.module.ts +10 -0
- package/templates/base_scalar/src/modules/custom-validation/custom-validation.service.ts +33 -0
- package/templates/base_scalar/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
- package/templates/base_scalar/src/modules/users/dto/user.dto.ts +64 -0
- package/templates/base_scalar/src/modules/users/entities/user.entity.ts +9 -0
- package/templates/base_scalar/src/modules/users/users.controller.ts +68 -0
- package/templates/base_scalar/src/modules/users/users.module.ts +10 -0
- package/templates/base_scalar/src/modules/users/users.service.ts +55 -0
- package/templates/base_scalar/tsconfig.json +19 -0
- package/templates/cqrs/.prettierrc +33 -0
- package/templates/cqrs/.vscode/extensions.json +79 -0
- package/templates/cqrs/.vscode/settings.json +70 -0
- package/templates/cqrs/README.md +234 -0
- package/templates/cqrs/eslint.config.ts +26 -0
- package/templates/cqrs/package.json +62 -0
- package/templates/cqrs/src/app.controller.ts +28 -0
- package/templates/cqrs/src/app.module.ts +12 -0
- package/templates/cqrs/src/app.service.ts +8 -0
- package/templates/cqrs/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/cqrs/src/common/interceptors/response.interceptor.ts +38 -0
- package/templates/cqrs/src/index.ts +38 -0
- package/templates/cqrs/src/modules/custom-validation/custom-validation.controller.ts +146 -0
- package/templates/cqrs/src/modules/custom-validation/custom-validation.module.ts +10 -0
- package/templates/cqrs/src/modules/custom-validation/custom-validation.service.ts +33 -0
- package/templates/cqrs/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
- package/templates/cqrs/src/modules/users/dto/user.dto.ts +64 -0
- package/templates/cqrs/src/modules/users/entities/user.entity.ts +9 -0
- package/templates/cqrs/src/modules/users/users.controller.ts +68 -0
- package/templates/cqrs/src/modules/users/users.module.ts +10 -0
- package/templates/cqrs/src/modules/users/users.service.ts +55 -0
- package/templates/cqrs/src/test-error-scenarios.ts +54 -0
- package/templates/cqrs/src/users/commands/create-user.command.ts +8 -0
- package/templates/cqrs/src/users/commands/index.ts +2 -0
- package/templates/cqrs/src/users/commands/update-user.command.ts +11 -0
- package/templates/cqrs/src/users/entities/index.ts +1 -0
- package/templates/cqrs/src/users/entities/user.entity.ts +22 -0
- package/templates/cqrs/src/users/events/index.ts +2 -0
- package/templates/cqrs/src/users/events/user-created.event.ts +8 -0
- package/templates/cqrs/src/users/events/user-updated.event.ts +8 -0
- package/templates/cqrs/src/users/handlers/create-user.handler.ts +26 -0
- package/templates/cqrs/src/users/handlers/get-all-users.handler.ts +15 -0
- package/templates/cqrs/src/users/handlers/get-user.handler.ts +15 -0
- package/templates/cqrs/src/users/handlers/index.ts +6 -0
- package/templates/cqrs/src/users/handlers/update-user.handler.ts +33 -0
- package/templates/cqrs/src/users/handlers/user-created.handler.ts +15 -0
- package/templates/cqrs/src/users/handlers/user-updated.handler.ts +15 -0
- package/templates/cqrs/src/users/index.ts +8 -0
- package/templates/cqrs/src/users/queries/get-all-users.query.ts +8 -0
- package/templates/cqrs/src/users/queries/get-user.query.ts +12 -0
- package/templates/cqrs/src/users/queries/index.ts +2 -0
- package/templates/cqrs/src/users/repositories/index.ts +1 -0
- package/templates/cqrs/src/users/repositories/user.repository.ts +51 -0
- package/templates/cqrs/src/users/user.controller.ts +66 -0
- package/templates/cqrs/src/users/user.module.ts +30 -0
- package/templates/cqrs/tsconfig.json +19 -0
- package/templates/cqrs_scalar/.prettierrc +33 -0
- package/templates/cqrs_scalar/.vscode/extensions.json +79 -0
- package/templates/cqrs_scalar/.vscode/settings.json +70 -0
- package/templates/cqrs_scalar/README.md +234 -0
- package/templates/cqrs_scalar/eslint.config.ts +26 -0
- package/templates/cqrs_scalar/package.json +62 -0
- package/templates/cqrs_scalar/src/app.controller.ts +28 -0
- package/templates/cqrs_scalar/src/app.module.ts +12 -0
- package/templates/cqrs_scalar/src/app.service.ts +8 -0
- package/templates/cqrs_scalar/src/common/filters/http-exception.filter.ts +34 -0
- package/templates/cqrs_scalar/src/common/interceptors/response.interceptor.ts +38 -0
- package/templates/cqrs_scalar/src/index.ts +38 -0
- package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.controller.ts +146 -0
- package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.module.ts +10 -0
- package/templates/cqrs_scalar/src/modules/custom-validation/custom-validation.service.ts +33 -0
- package/templates/cqrs_scalar/src/modules/custom-validation/dto/custom-validation.dto.ts +132 -0
- package/templates/cqrs_scalar/src/modules/users/dto/user.dto.ts +64 -0
- package/templates/cqrs_scalar/src/modules/users/entities/user.entity.ts +9 -0
- package/templates/cqrs_scalar/src/modules/users/users.controller.ts +68 -0
- package/templates/cqrs_scalar/src/modules/users/users.module.ts +10 -0
- package/templates/cqrs_scalar/src/modules/users/users.service.ts +55 -0
- package/templates/cqrs_scalar/src/test-error-scenarios.ts +54 -0
- package/templates/cqrs_scalar/src/users/commands/create-user.command.ts +8 -0
- package/templates/cqrs_scalar/src/users/commands/index.ts +2 -0
- package/templates/cqrs_scalar/src/users/commands/update-user.command.ts +11 -0
- package/templates/cqrs_scalar/src/users/entities/index.ts +1 -0
- package/templates/cqrs_scalar/src/users/entities/user.entity.ts +22 -0
- package/templates/cqrs_scalar/src/users/events/index.ts +2 -0
- package/templates/cqrs_scalar/src/users/events/user-created.event.ts +8 -0
- package/templates/cqrs_scalar/src/users/events/user-updated.event.ts +8 -0
- package/templates/cqrs_scalar/src/users/handlers/create-user.handler.ts +26 -0
- package/templates/cqrs_scalar/src/users/handlers/get-all-users.handler.ts +15 -0
- package/templates/cqrs_scalar/src/users/handlers/get-user.handler.ts +15 -0
- package/templates/cqrs_scalar/src/users/handlers/index.ts +6 -0
- package/templates/cqrs_scalar/src/users/handlers/update-user.handler.ts +33 -0
- package/templates/cqrs_scalar/src/users/handlers/user-created.handler.ts +15 -0
- package/templates/cqrs_scalar/src/users/handlers/user-updated.handler.ts +15 -0
- package/templates/cqrs_scalar/src/users/index.ts +8 -0
- package/templates/cqrs_scalar/src/users/queries/get-all-users.query.ts +8 -0
- package/templates/cqrs_scalar/src/users/queries/get-user.query.ts +12 -0
- package/templates/cqrs_scalar/src/users/queries/index.ts +2 -0
- package/templates/cqrs_scalar/src/users/repositories/index.ts +1 -0
- package/templates/cqrs_scalar/src/users/repositories/user.repository.ts +51 -0
- package/templates/cqrs_scalar/src/users/user.controller.ts +66 -0
- package/templates/cqrs_scalar/src/users/user.module.ts +30 -0
- 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
|