@venizia/ignis-docs 0.2.0 → 0.2.1-1

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 (174) hide show
  1. package/README.md +14 -14
  2. package/content/best-practices/api-usage-examples.md +39 -19
  3. package/content/best-practices/architectural-patterns.md +24 -13
  4. package/content/best-practices/architecture-decisions.md +29 -16
  5. package/content/best-practices/code-style-standards/advanced-patterns.md +43 -31
  6. package/content/best-practices/code-style-standards/constants-configuration.md +19 -4
  7. package/content/best-practices/code-style-standards/control-flow.md +33 -1
  8. package/content/best-practices/code-style-standards/documentation.md +28 -8
  9. package/content/best-practices/code-style-standards/function-patterns.md +15 -4
  10. package/content/best-practices/code-style-standards/index.md +7 -2
  11. package/content/best-practices/code-style-standards/naming-conventions.md +27 -3
  12. package/content/best-practices/code-style-standards/route-definitions.md +9 -5
  13. package/content/best-practices/code-style-standards/tooling.md +14 -1
  14. package/content/best-practices/code-style-standards/type-safety.md +39 -6
  15. package/content/best-practices/common-pitfalls.md +59 -35
  16. package/content/best-practices/contribution-workflow.md +8 -4
  17. package/content/best-practices/data-modeling.md +78 -62
  18. package/content/best-practices/deployment-strategies.md +56 -19
  19. package/content/best-practices/error-handling.md +247 -153
  20. package/content/best-practices/index.md +6 -0
  21. package/content/best-practices/performance-optimization.md +26 -13
  22. package/content/best-practices/security-guidelines.md +35 -9
  23. package/content/best-practices/testing-strategies.md +7 -2
  24. package/content/best-practices/troubleshooting-tips.md +27 -17
  25. package/content/extensions/components/api-reference.md +109 -323
  26. package/content/extensions/components/authentication/api.md +489 -602
  27. package/content/extensions/components/authentication/errors.md +135 -498
  28. package/content/extensions/components/authentication/index.md +89 -801
  29. package/content/extensions/components/authentication/usage.md +231 -955
  30. package/content/extensions/components/authorization/api.md +991 -644
  31. package/content/extensions/components/authorization/errors.md +204 -208
  32. package/content/extensions/components/authorization/getting-started.md +227 -0
  33. package/content/extensions/components/authorization/index.md +88 -795
  34. package/content/extensions/components/authorization/usage.md +219 -528
  35. package/content/extensions/components/health-check.md +77 -243
  36. package/content/extensions/components/index.md +24 -90
  37. package/content/extensions/components/mail/api.md +553 -285
  38. package/content/extensions/components/mail/errors.md +76 -62
  39. package/content/extensions/components/mail/index.md +111 -463
  40. package/content/extensions/components/mail/usage.md +139 -173
  41. package/content/extensions/components/request-tracker.md +70 -173
  42. package/content/extensions/components/socket-io/api.md +462 -785
  43. package/content/extensions/components/socket-io/errors.md +49 -51
  44. package/content/extensions/components/socket-io/index.md +69 -372
  45. package/content/extensions/components/socket-io/usage.md +212 -105
  46. package/content/extensions/components/static-asset/api.md +461 -141
  47. package/content/extensions/components/static-asset/errors.md +121 -53
  48. package/content/extensions/components/static-asset/index.md +84 -606
  49. package/content/extensions/components/static-asset/usage.md +184 -299
  50. package/content/extensions/components/template/index.md +3 -3
  51. package/content/extensions/components/websocket/api.md +311 -404
  52. package/content/extensions/components/websocket/errors.md +47 -56
  53. package/content/extensions/components/websocket/index.md +75 -407
  54. package/content/extensions/components/websocket/usage.md +120 -338
  55. package/content/extensions/helpers/cron/index.md +52 -160
  56. package/content/extensions/helpers/crypto/index.md +67 -480
  57. package/content/extensions/helpers/crypto/reference.md +528 -0
  58. package/content/extensions/helpers/env/index.md +64 -178
  59. package/content/extensions/helpers/error/index.md +286 -196
  60. package/content/extensions/helpers/index.md +61 -47
  61. package/content/extensions/helpers/inversion/index.md +76 -550
  62. package/content/extensions/helpers/inversion/reference.md +530 -0
  63. package/content/extensions/helpers/kafka/admin.md +23 -3
  64. package/content/extensions/helpers/kafka/compile-binary.md +83 -52
  65. package/content/extensions/helpers/kafka/consumer.md +65 -28
  66. package/content/extensions/helpers/kafka/examples.md +46 -253
  67. package/content/extensions/helpers/kafka/index.md +55 -617
  68. package/content/extensions/helpers/kafka/producer.md +156 -22
  69. package/content/extensions/helpers/kafka/schema-registry.md +59 -79
  70. package/content/extensions/helpers/logger/hf-logger.md +220 -0
  71. package/content/extensions/helpers/logger/index.md +78 -552
  72. package/content/extensions/helpers/logger/pino.md +105 -0
  73. package/content/extensions/helpers/logger/reference.md +937 -0
  74. package/content/extensions/helpers/network/api.md +276 -195
  75. package/content/extensions/helpers/network/index.md +87 -524
  76. package/content/extensions/helpers/queue/index.md +80 -897
  77. package/content/extensions/helpers/queue/reference.md +494 -0
  78. package/content/extensions/helpers/redis/index.md +86 -640
  79. package/content/extensions/helpers/redis/reference.md +784 -0
  80. package/content/extensions/helpers/secrets/index.md +136 -0
  81. package/content/extensions/helpers/socket-io/api.md +325 -204
  82. package/content/extensions/helpers/socket-io/index.md +79 -429
  83. package/content/extensions/helpers/storage/api.md +584 -464
  84. package/content/extensions/helpers/storage/index.md +80 -573
  85. package/content/extensions/helpers/types/index.md +75 -495
  86. package/content/extensions/helpers/types/reference.md +689 -0
  87. package/content/extensions/helpers/uid/index.md +176 -189
  88. package/content/extensions/helpers/websocket/api.md +366 -214
  89. package/content/extensions/helpers/websocket/index.md +68 -503
  90. package/content/extensions/helpers/worker-thread/index.md +62 -396
  91. package/content/extensions/helpers/worker-thread/reference.md +428 -0
  92. package/content/extensions/index.md +38 -39
  93. package/content/extensions/src-details/mcp-server.md +96 -548
  94. package/content/guides/core-concepts/persistent/datasources.md +2 -2
  95. package/content/guides/core-concepts/persistent/index.md +5 -1
  96. package/content/guides/core-concepts/persistent/models.md +1 -1
  97. package/content/guides/core-concepts/persistent/pglite.md +218 -0
  98. package/content/guides/core-concepts/persistent/postgres-drivers.md +21 -15
  99. package/content/guides/core-concepts/persistent/search-meilisearch.md +22 -12
  100. package/content/guides/core-concepts/persistent/search-typesense.md +28 -16
  101. package/content/guides/core-concepts/persistent/sqlite.md +296 -0
  102. package/content/guides/core-concepts/persistent/transactions.md +12 -11
  103. package/content/guides/core-concepts/secrets-vault.md +177 -0
  104. package/content/guides/core-concepts/services.md +1 -1
  105. package/content/guides/get-started/5-minute-quickstart.md +59 -206
  106. package/content/guides/get-started/philosophy.md +135 -670
  107. package/content/guides/get-started/setup.md +53 -74
  108. package/content/guides/migrations/redis-helpers-migration.md +5 -4
  109. package/content/guides/migrations/scoped-rbac-migration.md +5 -5
  110. package/content/guides/migrations/unified-connectors-migration.md +8 -7
  111. package/content/guides/tutorials/ecommerce-api.md +3 -8
  112. package/content/guides/tutorials/realtime-chat.md +1 -1
  113. package/content/references/base/application.md +64 -22
  114. package/content/references/base/components.md +3 -3
  115. package/content/references/base/connectors.md +79 -136
  116. package/content/references/base/controllers.md +12 -12
  117. package/content/references/base/datasources-reference.md +600 -0
  118. package/content/references/base/datasources.md +84 -444
  119. package/content/references/base/dependency-injection.md +25 -46
  120. package/content/references/base/filter-system/application-usage.md +95 -123
  121. package/content/references/base/filter-system/array-operators.md +33 -43
  122. package/content/references/base/filter-system/comparison-operators.md +55 -63
  123. package/content/references/base/filter-system/default-filter.md +144 -350
  124. package/content/references/base/filter-system/fields-order-pagination.md +116 -148
  125. package/content/references/base/filter-system/index.md +114 -253
  126. package/content/references/base/filter-system/json-filtering.md +52 -181
  127. package/content/references/base/filter-system/list-operators.md +28 -44
  128. package/content/references/base/filter-system/logical-operators.md +69 -114
  129. package/content/references/base/filter-system/null-operators.md +41 -98
  130. package/content/references/base/filter-system/pattern-matching.md +48 -51
  131. package/content/references/base/filter-system/quick-reference.md +93 -196
  132. package/content/references/base/filter-system/range-operators.md +22 -38
  133. package/content/references/base/filter-system/tips.md +70 -133
  134. package/content/references/base/filter-system/use-cases.md +173 -232
  135. package/content/references/base/grpc-controllers.md +53 -17
  136. package/content/references/base/index.md +5 -3
  137. package/content/references/base/middlewares.md +43 -28
  138. package/content/references/base/models-reference.md +886 -0
  139. package/content/references/base/models.md +81 -1452
  140. package/content/references/base/providers.md +8 -8
  141. package/content/references/base/repositories/advanced.md +281 -419
  142. package/content/references/base/repositories/index.md +84 -644
  143. package/content/references/base/repositories/mixins.md +25 -21
  144. package/content/references/base/repositories/relations.md +194 -375
  145. package/content/references/base/repositories/soft-deletable.md +67 -55
  146. package/content/references/base/secrets.md +267 -0
  147. package/content/references/base/services.md +8 -6
  148. package/content/references/configuration/environment-variables.md +73 -21
  149. package/content/references/configuration/index.md +51 -31
  150. package/content/references/index.md +1 -1
  151. package/content/references/quick-reference.md +3 -16
  152. package/content/references/utilities/crypto.md +35 -76
  153. package/content/references/utilities/date.md +33 -73
  154. package/content/references/utilities/duration.md +85 -0
  155. package/content/references/utilities/index.md +6 -2
  156. package/content/references/utilities/jsx-reference.md +298 -0
  157. package/content/references/utilities/jsx.md +82 -525
  158. package/content/references/utilities/module.md +81 -61
  159. package/content/references/utilities/parse.md +34 -64
  160. package/content/references/utilities/performance.md +33 -58
  161. package/content/references/utilities/promise.md +28 -62
  162. package/content/references/utilities/request.md +58 -218
  163. package/content/references/utilities/retry.md +139 -0
  164. package/content/references/utilities/schema.md +43 -137
  165. package/content/references/utilities/statuses-reference.md +361 -0
  166. package/content/references/utilities/statuses.md +63 -667
  167. package/dist/mcp-server/index.js +0 -0
  168. package/dist/mcp-server/tools/github/list-project-files.tool.d.ts +1 -1
  169. package/dist/mcp-server/tools/github/list-project-files.tool.d.ts.map +1 -1
  170. package/dist/mcp-server/tools/github/list-project-files.tool.js +3 -3
  171. package/dist/mcp-server/tools/github/search-code.tool.js +1 -1
  172. package/dist/mcp-server/tools/github/verify-dependencies.tool.js +1 -1
  173. package/dist/mcp-server/tools/github/view-source-file.tool.js +1 -1
  174. package/package.json +24 -23
@@ -1,6 +1,6 @@
1
1
  # Health Check
2
2
 
3
- Simple endpoint for monitoring application health -- essential for microservices and containerized deployments.
3
+ A minimal status endpoint for uptime monitoring - the default target for load balancer health checks and Kubernetes liveness probes.
4
4
 
5
5
  ## Quick Reference
6
6
 
@@ -17,200 +17,112 @@ import { HealthCheckComponent, HealthCheckBindingKeys } from '@venizia/ignis';
17
17
  import type { IHealthCheckOptions } from '@venizia/ignis';
18
18
  ```
19
19
 
20
- ## Setup
20
+ ## In one example
21
21
 
22
- ### Step 1: Bind Configuration (Optional)
23
-
24
- Skip this step to use the default `/health` path. To customize the path:
25
-
26
- ```typescript
27
- import { HealthCheckBindingKeys, IHealthCheckOptions } from '@venizia/ignis';
28
-
29
- // In your Application class's preConfigure method
30
- this.bind<IHealthCheckOptions>({
31
- key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
32
- }).toValue({
33
- restOptions: { path: '/health-check' },
34
- });
35
- ```
36
-
37
- ### Step 2: Register Component
22
+ Register the component with no configuration - `GET /health` and `POST /health/ping` are live immediately.
38
23
 
39
24
  ```typescript
40
- import { HealthCheckComponent } from '@venizia/ignis';
25
+ import { HealthCheckComponent, BaseApplication, ValueOrPromise } from '@venizia/ignis';
41
26
 
42
- preConfigure(): ValueOrPromise<void> {
43
- // ... optional bindings from Step 1
44
- this.component(HealthCheckComponent);
27
+ export class Application extends BaseApplication {
28
+ preConfigure(): ValueOrPromise<void> {
29
+ this.component(HealthCheckComponent);
30
+ }
45
31
  }
46
32
  ```
47
33
 
48
- ### Step 3: Use
34
+ ```bash
35
+ curl localhost:3000/health
36
+ # { "status": "ok" }
37
+ ```
49
38
 
50
- The health check endpoints are auto-registered -- no injection needed. Once the component is registered, `GET /health` and `POST /health/ping` are available immediately.
39
+ ## How it works
51
40
 
52
- > [!TIP]
53
- > If you customized the path in Step 1, the endpoints will be at your custom path instead (e.g., `GET /health-check` and `POST /health-check/ping`).
41
+ - **Auto-registered controller.** `HealthCheckComponent.binding()` applies `@controller({ path })` to `HealthCheckController` via `Reflect.decorate` at runtime, then calls `this.application.controller(HealthCheckController)`. The path comes from DI, not a hardcoded class decorator.
42
+ - **Options are optional, field by field.** `IHealthCheckOptions.restOptions.path` is optional; a partially-filled binding (e.g., `{ restOptions: {} }`) still resolves. The component reads `healthOptions?.restOptions?.path ?? '/health'`, falling back per field rather than discarding the whole binding.
43
+ - **The default binding wins the race if you're late.** The constructor pre-binds `HEALTH_CHECK_OPTIONS` via `initDefault`, filling only an unbound key. A custom binding must exist BEFORE `this.component(HealthCheckComponent)` runs - otherwise the default has already claimed the slot.
44
+ - **Three route styles, one controller.** `HealthCheckController` demonstrates all three IGNIS route patterns - use it as a reference when picking a style for your own controllers:
54
45
 
55
- ## Configuration
46
+ | Style | API | Route |
47
+ |-------|-----|-------|
48
+ | Fluent | `bindRoute().to()` | `GET /` |
49
+ | Decorator | `@api()` | `POST /ping` |
50
+ | Imperative | `defineRoute()` (commented out in source) | - |
56
51
 
57
- | Option | Type | Default | Description |
58
- |--------|------|---------|-------------|
59
- | `restOptions.path` | `string` | `'/health'` | Base path for health endpoints |
52
+ ## Common tasks
60
53
 
61
- The component uses `IHealthCheckOptions` bound to `HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS`. If no custom binding is found, it falls back to:
54
+ ### Customize the health check path
55
+ Bind `IHealthCheckOptions` BEFORE registering the component - order matters (see above).
62
56
 
63
57
  ```typescript
64
- const DEFAULT_OPTIONS: IHealthCheckOptions = {
65
- restOptions: { path: '/health' },
66
- };
67
- ```
58
+ import { HealthCheckBindingKeys, IHealthCheckOptions } from '@venizia/ignis';
68
59
 
69
- #### IHealthCheckOptions -- Full Reference
70
- ```typescript
71
- interface IHealthCheckOptions {
72
- restOptions: { path: string };
73
- }
60
+ this.bind<IHealthCheckOptions>({
61
+ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
62
+ }).toValue({ restOptions: { path: '/health-check' } });
63
+
64
+ this.component(HealthCheckComponent); // AFTER the bind
74
65
  ```
75
66
 
76
- The `path` value is applied via `@controller({ path })` decorator on `HealthCheckController` during the component's `binding()` phase. All controller routes are relative to this base path.
67
+ ### Call the ping endpoint
68
+ `POST /health/ping` echoes `message` back with a server timestamp - useful for round-trip latency checks and body-parsing smoke tests.
77
69
 
78
- ### Component Lifecycle
70
+ ```bash
71
+ curl -X POST localhost:3000/health/ping \
72
+ -H 'content-type: application/json' \
73
+ -d '{"message":"hello"}'
74
+ # { "type": "PONG", "date": "2026-02-11T12:00:00.000Z", "message": "hello" }
75
+ ```
79
76
 
80
- 1. **`constructor()`** -- Receives `BaseApplication` via `@inject({ key: CoreBindings.APPLICATION_INSTANCE })`. Calls `super()` with `initDefault: { enable: true, container: application }` and provides default bindings for `HEALTH_CHECK_OPTIONS`:
77
+ | Field | Type | Required | Constraints |
78
+ |-------|------|----------|-------------|
79
+ | `type` | `string` | No | Defaults to `"PING"` |
80
+ | `message` | `string` | Yes | Min 1, max 255 characters |
81
+
82
+ ### Fix "health check endpoint returns 404"
83
+ Register the component in `preConfigure()`, before any controller registration completes.
81
84
 
82
85
  ```typescript
83
- constructor(
84
- @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,
85
- ) {
86
- super({
87
- scope: HealthCheckComponent.name,
88
- initDefault: { enable: true, container: application },
89
- bindings: {
90
- [HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS]: Binding.bind<IHealthCheckOptions>({
91
- key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
92
- }).toValue(DEFAULT_OPTIONS),
93
- },
94
- });
86
+ preConfigure(): ValueOrPromise<void> {
87
+ this.component(HealthCheckComponent);
88
+ // ... other registrations
95
89
  }
96
90
  ```
97
91
 
98
- The `initDefault: { enable: true, container: application }` option tells `BaseComponent` to automatically register all entries in `this.bindings` into the DI container before `binding()` is called. This happens inside `BaseComponent.configure()` via `initDefaultBindings()`, which iterates over `this.bindings` and calls `container.set()` for any key not already bound. This means users who bind their own `HEALTH_CHECK_OPTIONS` before registering the component will keep their custom value -- the default is only applied if the key is unbound.
92
+ ## Reference
99
93
 
100
- 2. **`binding()`** -- Reads options from the DI container using `application.get()` with `isOptional: true` and falls back to `DEFAULT_OPTIONS` via the `??` operator. Applies `@controller({ path })` decorator dynamically to `HealthCheckController` using `Reflect.decorate`. Registers the controller with the application:
94
+ ### Configuration
95
+ | Option | Type | Default | Description |
96
+ |--------|------|---------|-------------|
97
+ | `restOptions.path` | `string` (optional) | `'/health'` | Base path for health endpoints |
101
98
 
102
99
  ```typescript
103
- override binding(): ValueOrPromise<void> {
104
- const healthOptions =
105
- this.application.get<IHealthCheckOptions>({
106
- key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
107
- isOptional: true,
108
- }) ?? DEFAULT_OPTIONS;
109
-
110
- Reflect.decorate(
111
- [controller({ path: healthOptions.restOptions.path })],
112
- HealthCheckController,
113
- );
114
- this.application.controller(HealthCheckController);
100
+ interface IHealthCheckOptions {
101
+ /** Partially-filled bindings are accepted; every missing field falls back to its default. */
102
+ restOptions?: { path?: string };
115
103
  }
116
104
  ```
117
105
 
118
- > [!NOTE]
119
- > The `@controller` decorator is applied dynamically during `binding()`, not statically on the class definition. This allows the path to be configured at runtime via DI bindings.
120
-
121
- ## Binding Keys
122
-
106
+ ### Binding keys
123
107
  | Key | Constant | Type | Required | Default |
124
108
  |-----|----------|------|----------|---------|
125
109
  | `@app/health-check/options` | `HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS` | `IHealthCheckOptions` | No | `{ restOptions: { path: '/health' } }` |
126
110
 
127
- > [!NOTE]
128
- > The component provides a default binding for `HEALTH_CHECK_OPTIONS` via `initDefault`. You only need to bind this key if you want to customize the endpoint path. If you do bind it, do so **before** calling `this.component(HealthCheckComponent)` -- the `initDefaultBindings()` check uses `isBound()` and will skip keys that already exist in the container.
129
-
130
- ### Rest Paths
131
-
132
- | Constant | Value | Full Path (default) |
111
+ ### REST paths
112
+ | Constant | Value | Full path (default) |
133
113
  |----------|-------|---------------------|
134
114
  | `HealthCheckRestPaths.ROOT` | `/` | `GET /health` |
135
115
  | `HealthCheckRestPaths.PING` | `/ping` | `POST /health/ping` |
136
116
 
137
- ### Rest Path Constants
138
-
139
- ```typescript
140
- class HealthCheckRestPaths {
141
- static readonly ROOT = '/'; // GET /health (or custom base path)
142
- static readonly PING = '/ping'; // POST /health/ping (or custom base path + /ping)
143
- }
144
- ```
145
-
146
- The controller defines two internal route paths via `HealthCheckRestPaths`. These paths are relative to the base path configured in `IHealthCheckOptions.restOptions.path`.
147
-
148
- ## API Endpoints
117
+ Paths are relative to the base path configured in `IHealthCheckOptions.restOptions.path`.
149
118
 
119
+ ### API endpoints
150
120
  | Method | Path | Description | Response |
151
121
  |--------|------|-------------|----------|
152
122
  | `GET` | `/health` | Basic health check | `{ "status": "ok" }` |
153
123
  | `POST` | `/health/ping` | Echo test | `{ "type": "PONG", "date": "...", "message": "..." }` |
154
124
 
155
- ### GET /health
156
-
157
- Returns a simple health status object. Used by load balancers, Kubernetes liveness probes, and monitoring tools to verify the application is running.
158
-
159
- ### POST /health/ping
160
-
161
- Echoes a message back with a server timestamp. Useful for:
162
- - Verifying end-to-end connectivity
163
- - Measuring round-trip latency
164
- - Testing request body parsing
165
-
166
- #### Request & Response Specifications
167
-
168
- **GET /health**
169
-
170
- Response `200`:
171
- ```json
172
- {
173
- "status": "ok"
174
- }
175
- ```
176
-
177
- **POST /health/ping**
178
-
179
- Request body:
180
- ```json
181
- {
182
- "type": "PING",
183
- "message": "Any string here"
184
- }
185
- ```
186
-
187
- | Field | Type | Required | Constraints |
188
- |-------|------|----------|-------------|
189
- | `type` | `string` | No | Defaults to `"PING"` |
190
- | `message` | `string` | Yes | Min 1, max 255 characters |
191
-
192
- Response `200`:
193
- ```json
194
- {
195
- "type": "PONG",
196
- "date": "2026-02-11T12:00:00.000Z",
197
- "message": "Any string here"
198
- }
199
- ```
200
-
201
- ### Route Definition Patterns
202
-
203
- The `HealthCheckController` demonstrates all three route definition patterns supported by IGNIS:
204
-
205
- | Pattern | Method | Used For |
206
- |---------|--------|----------|
207
- | **Fluent API** (`bindRoute().to()`) | Root health check (`GET /`) | Inline handlers, method chaining |
208
- | **Imperative API** (`defineRoute()`) | (commented out in source) | Direct handler assignment in `binding()` |
209
- | **Decorator API** (`@api()`) | Ping endpoint (`POST /ping`) | Class method handlers with OpenAPI metadata |
210
-
211
- The controller uses `this.definitions = RouteConfigs` to store route configurations for introspection. This is optional but enables tools to discover available routes without invoking `binding()`.
212
-
213
- #### Controller Source
125
+ ### Controller source
214
126
  ```typescript
215
127
  import {
216
128
  BaseRestController, IControllerOptions, TRouteContext,
@@ -286,101 +198,15 @@ export class HealthCheckController extends BaseRestController {
286
198
  }
287
199
  ```
288
200
 
289
- #### Route Configuration Schemas
290
-
291
- **Root endpoint (`GET /`):**
292
- ```typescript
293
- const RouteConfigs = {
294
- ROOT: {
295
- method: HTTP.Methods.GET,
296
- path: HealthCheckRestPaths.ROOT,
297
- responses: jsonResponse({
298
- schema: z.object({ status: z.string() }).openapi({
299
- description: 'HealthCheck Schema',
300
- examples: [{ status: 'ok' }],
301
- }),
302
- description: 'Health check status',
303
- }),
304
- },
305
- ```
306
-
307
- **Ping endpoint (`POST /ping`):**
308
- ```typescript
309
- PING: {
310
- method: HTTP.Methods.POST,
311
- path: HealthCheckRestPaths.PING,
312
- request: {
313
- body: jsonContent({
314
- description: 'PING | Request body',
315
- schema: z.object({
316
- type: z.string().optional().default('PING'),
317
- message: z.string().min(1).max(255),
318
- }),
319
- }),
320
- },
321
- responses: jsonResponse({
322
- schema: z.object({
323
- type: z.string().optional().default('PONG'),
324
- date: z.iso.datetime(),
325
- message: z.string(),
326
- }).openapi({
327
- description: 'HealthCheck PingPong Schema',
328
- examples: [{ date: new Date().toISOString(), message: 'ok' }],
329
- }),
330
- description: 'HealthCheck PingPong Message',
331
- }),
332
- },
333
- } as const;
334
- ```
335
-
336
201
  ## Troubleshooting
337
202
 
338
- ### "Health check endpoint returns 404"
339
-
340
- **Cause:** The `HealthCheckComponent` was not registered in your application, or it was registered after controllers were already mounted.
341
-
342
- **Fix:** Register the component in `preConfigure()` before any controller registration:
343
-
344
- ```typescript
345
- preConfigure(): ValueOrPromise<void> {
346
- this.component(HealthCheckComponent);
347
- // ... other registrations
348
- }
349
- ```
350
-
351
- ### "Custom path is not applied"
203
+ | Symptom | Cause | Fix |
204
+ |---------|-------|-----|
205
+ | `GET /health` returns 404 | `HealthCheckComponent` not registered, or registered after controllers were already mounted | Call `this.component(HealthCheckComponent)` in `preConfigure()` |
206
+ | Custom path not applied | Custom `IHealthCheckOptions` bound AFTER `this.component()` ran - the default binding already claimed the DI key | Bind options BEFORE calling `this.component(HealthCheckComponent)` |
207
+ | `POST /health/ping` returns a validation error | `message` is missing, or exceeds 255 characters | Send a `message` string between 1 and 255 characters |
352
208
 
353
- **Cause:** The custom `IHealthCheckOptions` binding was registered after the component. The component reads options during its `binding()` phase -- if no binding exists at that point, it uses the default `/health` path. However, because `HealthCheckComponent` uses `initDefault: { enable: true }`, it also registers a default binding before `binding()` runs. If you bind your custom options after calling `this.component()`, the default has already been set and your override will not take effect during the current lifecycle.
354
-
355
- **Fix:** Bind your custom options before calling `this.component(HealthCheckComponent)`:
356
-
357
- ```typescript
358
- preConfigure(): ValueOrPromise<void> {
359
- // Bind options FIRST
360
- this.bind<IHealthCheckOptions>({
361
- key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS,
362
- }).toValue({
363
- restOptions: { path: '/custom-health' },
364
- });
365
-
366
- // THEN register component
367
- this.component(HealthCheckComponent);
368
- }
369
- ```
370
-
371
- ### "POST /health/ping returns validation error"
372
-
373
- **Cause:** The request body is missing the required `message` field, or the `message` value exceeds the 255-character limit.
374
-
375
- **Fix:** Ensure the request body includes a `message` string between 1 and 255 characters:
376
-
377
- ```json
378
- {
379
- "message": "hello"
380
- }
381
- ```
382
-
383
- ## See Also
209
+ ## See also
384
210
 
385
211
  - **Guides:**
386
212
  - [Components Overview](/guides/core-concepts/components) - Component system basics
@@ -391,3 +217,11 @@ preConfigure(): ValueOrPromise<void> {
391
217
 
392
218
  - **Best Practices:**
393
219
  - [Deployment Strategies](/best-practices/deployment-strategies) - Production monitoring
220
+
221
+ **Files:**
222
+
223
+ - [`packages/core-server/src/components/health-check/component.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/health-check/component.ts) - `HealthCheckComponent`
224
+ - [`packages/core-server/src/components/health-check/controller.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/health-check/controller.ts) - `HealthCheckController`
225
+ - [`packages/core-server/src/components/health-check/common/types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/health-check/common/types.ts) - `IHealthCheckOptions`
226
+ - [`packages/core-server/src/components/health-check/common/keys.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/health-check/common/keys.ts) - `HealthCheckBindingKeys`
227
+ - [`packages/core-server/src/components/health-check/common/rest-paths.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/health-check/common/rest-paths.ts) - `HealthCheckRestPaths`
@@ -1,92 +1,26 @@
1
1
  # Components
2
2
 
3
- Reusable, pluggable modules that group together related features. A component can encapsulate various resources such as providers, services, controllers, repositories, or even an entire mini-application, providing a clean way to modularize and share complex logic across IGNIS applications.
4
-
5
- ## Built-in Components
6
-
7
- | Component | Purpose | Key Features |
8
- |-----------|---------|--------------|
9
- | [Authentication](./authentication/) | JWT/Basic auth | Token generation, protected routes, multi-strategy |
10
- | [Authorization](./authorization/) <Badge type="warning" text="Experimental" /> | Enforcer-based authz | RBAC, ABAC, voters, Casbin integration, role shortcuts |
11
- | [Health Check](./health-check) | Monitoring endpoint | `/health` endpoint, ping/pong functionality |
12
- | [Mail](./mail/) | Email sending system | Multiple transports, templating, queue-based processing |
13
- | [Request Tracker](./request-tracker) | Request logging | Request ID generation, timing, structured logging |
14
- | [Socket.IO](./socket-io/) | Real-time communication | WebSocket support, Redis adapter, event-based |
15
- | [WebSocket](./websocket/) | Real-time communication | Bun native WebSocket, Redis Pub/Sub, heartbeat |
16
- | [Static Asset](./static-asset/) | File management | Upload/download files, MinIO, Bun S3 & local filesystem support |
17
- | [Swagger](./api-reference) | API documentation | OpenAPI generation, Swagger UI, Scalar UI |
18
- | [gRPC](/references/base/grpc-controllers) | gRPC transport | ConnectRPC integration, unary RPC, decorator-based |
19
-
20
- ## Creating a Component
21
-
22
- To create a new component, you need to create a class that extends `BaseComponent`.
23
-
24
- ```typescript
25
- import { BaseApplication, BaseComponent, inject, CoreBindings, ValueOrPromise } from '@venizia/ignis';
26
-
27
- export class MyCustomComponent extends BaseComponent {
28
- constructor(
29
- @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,
30
- ) {
31
- super({ scope: MyCustomComponent.name });
32
- }
33
-
34
- override binding(): ValueOrPromise<void> {
35
- // This is where you bind your component's resources.
36
- this.application.service(MyCustomService);
37
- this.application.controller(MyCustomController);
38
- }
39
- }
40
- ```
41
-
42
- ## Component Lifecycle
43
-
44
- | Phase | When | Purpose |
45
- |-------|------|---------|
46
- | **`constructor()`** | Component instantiation | Receive dependencies, define default bindings |
47
- | **`binding()`** | Application startup | Register controllers, services, repositories with DI container |
48
-
49
- ## Registering a Component
50
-
51
- To use a component, you need to register it with the application instance, usually in the `preConfigure` method of your `Application` class.
52
-
53
- ```typescript
54
- // in src/application.ts
55
- import { MyCustomComponent } from './components/my-custom.component';
56
-
57
- // ... inside your Application class
58
-
59
- preConfigure(): ValueOrPromise<void> {
60
- // ...
61
- this.component(MyCustomComponent);
62
- }
63
- ```
64
-
65
- When the application starts, it will automatically call the `binding()` method of the registered component, setting up all the resources it provides.
66
-
67
- Using components is a great way to organize your application's features into modular, reusable pieces of code, keeping your main application class clean and focused on high-level configuration.
68
-
69
- ## See Also
70
-
71
- - **Component Guides:**
72
- - [Components Overview](/guides/core-concepts/components) - What components are
73
- - [Creating Components](/guides/core-concepts/components-guide) - Build your own components
74
-
75
- - **Built-in Components:**
76
- - [Authentication](./authentication/) - JWT/Basic authentication
77
- - [Authorization](./authorization/) - Enforcer-based authorization
78
- - [Health Check](./health-check) - Health check endpoints
79
- - [Mail](./mail/) - Email functionality
80
- - [Request Tracker](./request-tracker) - Request tracking
81
- - [Socket.IO](./socket-io/) - Socket.IO WebSocket support
82
- - [WebSocket](./websocket/) - Bun native WebSocket
83
- - [Static Asset](./static-asset/) - File upload/download management
84
- - [Swagger](./api-reference) - API documentation
85
- - [gRPC](/references/base/grpc-controllers) - gRPC transport (ConnectRPC)
86
-
87
- - **References:**
88
- - [BaseComponent API](/references/base/components) - Component base class
89
- - [Application](/references/base/application) - Registering components
90
-
91
- - **Best Practices:**
92
- - [Architectural Patterns](/best-practices/architectural-patterns) - Component design patterns
3
+ Self-contained feature modules you register with `this.component(SomeComponent)`.
4
+
5
+ ## Built-in components
6
+
7
+ | Component | What it does | When you reach for it |
8
+ |---|---|---|
9
+ | [Authentication](./authentication/) | JWT and Basic auth - token generation, protected routes, multi-strategy | A route needs to know who the caller is |
10
+ | [Authorization](./authorization/) <Badge type="warning" text="Experimental" /> | Enforcer-based RBAC/ABAC, voters, Casbin integration | A route needs a permission check beyond authentication |
11
+ | [Health Check](./health-check) | `/health` endpoint, ping/pong | A load balancer or Kubernetes needs a liveness probe |
12
+ | [Mail](./mail/) | Email sending - multiple transports, templating, queue-based | The app sends transactional or templated email |
13
+ | [Request Tracker](./request-tracker) | Request ID, timing, structured request logging | Always on - registered automatically, nothing to configure |
14
+ | [Socket.IO](./socket-io/) | Real-time over Socket.IO - Redis adapter, event-based | Clients need rooms or Socket.IO-specific features |
15
+ | [WebSocket](./websocket/) | Native Bun WebSocket, Redis pub/sub, heartbeat | Clients need a raw WebSocket without Socket.IO |
16
+ | [Static Asset](./static-asset/) | Upload/download files - MinIO, Bun S3, local disk | The app stores or serves user-uploaded files |
17
+ | [API Reference](./api-reference) | OpenAPI generation, Scalar UI by default, Swagger UI optional | You want a browsable UI for your REST routes |
18
+ | [gRPC](/references/base/grpc-controllers) | ConnectRPC transport, unary RPC, decorator-based | The app serves gRPC alongside or instead of REST |
19
+
20
+ ## See also
21
+
22
+ - [Components Overview](/guides/core-concepts/components) - What components are
23
+ - [Creating Components](/guides/core-concepts/components-guide) - Build your own
24
+ - [BaseComponent API](/references/base/components) - Component base class
25
+ - [Application](/references/base/application) - Registering components
26
+ - [Architectural Patterns](/best-practices/architectural-patterns) - Component design patterns