@venizia/ignis-docs 0.0.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 (123) hide show
  1. package/mcp-server/dist/common/config.d.ts +27 -0
  2. package/mcp-server/dist/common/config.d.ts.map +1 -0
  3. package/mcp-server/dist/common/config.js +27 -0
  4. package/mcp-server/dist/common/config.js.map +1 -0
  5. package/mcp-server/dist/common/index.d.ts +3 -0
  6. package/mcp-server/dist/common/index.d.ts.map +1 -0
  7. package/mcp-server/dist/common/index.js +19 -0
  8. package/mcp-server/dist/common/index.js.map +1 -0
  9. package/mcp-server/dist/common/paths.d.ts +13 -0
  10. package/mcp-server/dist/common/paths.d.ts.map +1 -0
  11. package/mcp-server/dist/common/paths.js +23 -0
  12. package/mcp-server/dist/common/paths.js.map +1 -0
  13. package/mcp-server/dist/helpers/docs.helper.d.ts +81 -0
  14. package/mcp-server/dist/helpers/docs.helper.d.ts.map +1 -0
  15. package/mcp-server/dist/helpers/docs.helper.js +171 -0
  16. package/mcp-server/dist/helpers/docs.helper.js.map +1 -0
  17. package/mcp-server/dist/helpers/index.d.ts +3 -0
  18. package/mcp-server/dist/helpers/index.d.ts.map +1 -0
  19. package/mcp-server/dist/helpers/index.js +19 -0
  20. package/mcp-server/dist/helpers/index.js.map +1 -0
  21. package/mcp-server/dist/helpers/logger.helper.d.ts +7 -0
  22. package/mcp-server/dist/helpers/logger.helper.d.ts.map +1 -0
  23. package/mcp-server/dist/helpers/logger.helper.js +22 -0
  24. package/mcp-server/dist/helpers/logger.helper.js.map +1 -0
  25. package/mcp-server/dist/index.d.ts +3 -0
  26. package/mcp-server/dist/index.d.ts.map +1 -0
  27. package/mcp-server/dist/index.js +62 -0
  28. package/mcp-server/dist/index.js.map +1 -0
  29. package/mcp-server/dist/tools/base.tool.d.ts +98 -0
  30. package/mcp-server/dist/tools/base.tool.d.ts.map +1 -0
  31. package/mcp-server/dist/tools/base.tool.js +47 -0
  32. package/mcp-server/dist/tools/base.tool.js.map +1 -0
  33. package/mcp-server/dist/tools/get-doc-content.tool.d.ts +30 -0
  34. package/mcp-server/dist/tools/get-doc-content.tool.d.ts.map +1 -0
  35. package/mcp-server/dist/tools/get-doc-content.tool.js +127 -0
  36. package/mcp-server/dist/tools/get-doc-content.tool.js.map +1 -0
  37. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts +40 -0
  38. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts.map +1 -0
  39. package/mcp-server/dist/tools/get-doc-metadata.tool.js +121 -0
  40. package/mcp-server/dist/tools/get-doc-metadata.tool.js.map +1 -0
  41. package/mcp-server/dist/tools/index.d.ts +8 -0
  42. package/mcp-server/dist/tools/index.d.ts.map +1 -0
  43. package/mcp-server/dist/tools/index.js +18 -0
  44. package/mcp-server/dist/tools/index.js.map +1 -0
  45. package/mcp-server/dist/tools/list-categories.tool.d.ts +20 -0
  46. package/mcp-server/dist/tools/list-categories.tool.d.ts.map +1 -0
  47. package/mcp-server/dist/tools/list-categories.tool.js +105 -0
  48. package/mcp-server/dist/tools/list-categories.tool.js.map +1 -0
  49. package/mcp-server/dist/tools/list-docs.tool.d.ts +32 -0
  50. package/mcp-server/dist/tools/list-docs.tool.d.ts.map +1 -0
  51. package/mcp-server/dist/tools/list-docs.tool.js +121 -0
  52. package/mcp-server/dist/tools/list-docs.tool.js.map +1 -0
  53. package/mcp-server/dist/tools/search-docs.tool.d.ts +32 -0
  54. package/mcp-server/dist/tools/search-docs.tool.d.ts.map +1 -0
  55. package/mcp-server/dist/tools/search-docs.tool.js +120 -0
  56. package/mcp-server/dist/tools/search-docs.tool.js.map +1 -0
  57. package/package.json +102 -0
  58. package/wiki/get-started/5-minute-quickstart.md +266 -0
  59. package/wiki/get-started/best-practices/api-usage-examples.md +222 -0
  60. package/wiki/get-started/best-practices/architectural-patterns.md +129 -0
  61. package/wiki/get-started/best-practices/code-style-standards.md +122 -0
  62. package/wiki/get-started/best-practices/common-pitfalls.md +136 -0
  63. package/wiki/get-started/best-practices/contribution-workflow.md +145 -0
  64. package/wiki/get-started/best-practices/deployment-strategies.md +121 -0
  65. package/wiki/get-started/best-practices/performance-optimization.md +88 -0
  66. package/wiki/get-started/best-practices/security-guidelines.md +97 -0
  67. package/wiki/get-started/best-practices/troubleshooting-tips.md +100 -0
  68. package/wiki/get-started/building-a-crud-api.md +717 -0
  69. package/wiki/get-started/core-concepts/application.md +168 -0
  70. package/wiki/get-started/core-concepts/components.md +96 -0
  71. package/wiki/get-started/core-concepts/controllers.md +441 -0
  72. package/wiki/get-started/core-concepts/dependency-injection.md +160 -0
  73. package/wiki/get-started/core-concepts/persistent.md +591 -0
  74. package/wiki/get-started/core-concepts/services.md +88 -0
  75. package/wiki/get-started/index.md +65 -0
  76. package/wiki/get-started/mcp-docs-server.md +840 -0
  77. package/wiki/get-started/philosophy.md +123 -0
  78. package/wiki/get-started/prerequisites.md +113 -0
  79. package/wiki/get-started/quickstart.md +382 -0
  80. package/wiki/index.md +48 -0
  81. package/wiki/references/base/application.md +67 -0
  82. package/wiki/references/base/components.md +80 -0
  83. package/wiki/references/base/controllers.md +361 -0
  84. package/wiki/references/base/datasources.md +105 -0
  85. package/wiki/references/base/dependency-injection.md +83 -0
  86. package/wiki/references/base/models.md +104 -0
  87. package/wiki/references/base/repositories.md +118 -0
  88. package/wiki/references/base/services.md +97 -0
  89. package/wiki/references/components/authentication.md +224 -0
  90. package/wiki/references/components/health-check.md +190 -0
  91. package/wiki/references/components/index.md +61 -0
  92. package/wiki/references/components/request-tracker.md +35 -0
  93. package/wiki/references/components/socket-io.md +127 -0
  94. package/wiki/references/components/swagger.md +175 -0
  95. package/wiki/references/helpers/cron.md +94 -0
  96. package/wiki/references/helpers/crypto.md +117 -0
  97. package/wiki/references/helpers/env.md +67 -0
  98. package/wiki/references/helpers/error.md +80 -0
  99. package/wiki/references/helpers/index.md +21 -0
  100. package/wiki/references/helpers/inversion.md +141 -0
  101. package/wiki/references/helpers/logger.md +98 -0
  102. package/wiki/references/helpers/network.md +143 -0
  103. package/wiki/references/helpers/queue.md +131 -0
  104. package/wiki/references/helpers/redis.md +121 -0
  105. package/wiki/references/helpers/socket-io.md +103 -0
  106. package/wiki/references/helpers/storage.md +130 -0
  107. package/wiki/references/helpers/testing.md +115 -0
  108. package/wiki/references/helpers/worker-thread.md +162 -0
  109. package/wiki/references/src-details/core.md +249 -0
  110. package/wiki/references/src-details/dev-configs.md +302 -0
  111. package/wiki/references/src-details/docs.md +61 -0
  112. package/wiki/references/src-details/helpers.md +211 -0
  113. package/wiki/references/src-details/inversion.md +345 -0
  114. package/wiki/references/src-details/mcp-server.md +726 -0
  115. package/wiki/references/utilities/crypto.md +39 -0
  116. package/wiki/references/utilities/date.md +72 -0
  117. package/wiki/references/utilities/index.md +12 -0
  118. package/wiki/references/utilities/module.md +40 -0
  119. package/wiki/references/utilities/parse.md +68 -0
  120. package/wiki/references/utilities/performance.md +64 -0
  121. package/wiki/references/utilities/promise.md +83 -0
  122. package/wiki/references/utilities/request.md +66 -0
  123. package/wiki/references/utilities/schema.md +88 -0
@@ -0,0 +1,168 @@
1
+ # The Application Class
2
+
3
+ The Application class orchestrates your application's configuration, lifecycle, and resource registration (components, controllers, services).
4
+
5
+ > **Deep Dive:** See [Application Reference](../../references/base/application.md) for technical details.
6
+
7
+ ## Creating an Application
8
+
9
+ Extend `BaseApplication` and implement the hook methods:
10
+
11
+ ```typescript
12
+ // src/application.ts
13
+ import {
14
+ BaseApplication,
15
+ IApplicationConfigs,
16
+ IApplicationInfo,
17
+ ValueOrPromise,
18
+ } from "@venizia/ignis";
19
+ import packageJson from "./../package.json";
20
+
21
+ // Application configurations
22
+ export const appConfigs: IApplicationConfigs = {
23
+ host: process.env.APP_ENV_SERVER_HOST,
24
+ port: +(process.env.APP_ENV_SERVER_PORT ?? 3000),
25
+ path: {
26
+ base: process.env.APP_ENV_SERVER_BASE_PATH,
27
+ isStrict: true,
28
+ },
29
+ debug: {
30
+ showRoutes: process.env.NODE_ENV !== "production",
31
+ },
32
+ };
33
+
34
+ // Main Application class
35
+ export class Application extends BaseApplication {
36
+ override getAppInfo(): ValueOrPromise<IApplicationInfo> {
37
+ return packageJson;
38
+ }
39
+
40
+ staticConfigure(): void {
41
+ // e.g., this.static({ folderPath: './public' })
42
+ }
43
+
44
+ preConfigure(): ValueOrPromise<void> {
45
+ // Register all your resources here
46
+ this.dataSource(MyDataSource);
47
+ this.service(MyService);
48
+ this.controller(MyController);
49
+ }
50
+
51
+ postConfigure(): ValueOrPromise<void> {
52
+ // Logic to run after everything is configured
53
+ }
54
+
55
+ setupMiddlewares(): ValueOrPromise<void> {
56
+ // Add any custom application-wide middlewares
57
+ }
58
+ }
59
+ ```
60
+
61
+ ## Application Lifecycle
62
+
63
+ The `Ignis` application has a well-defined lifecycle, managed primarily by the `start()` and `initialize()` methods.
64
+
65
+ | Method | Description |
66
+ | :--- | :--- |
67
+ | **`constructor(opts)`** | Initializes the application, sets up the Hono server, and detects the runtime (Bun/Node). |
68
+ | **`start()`** | The main entry point. It calls `initialize()`, sets up middlewares, and starts the HTTP server. |
69
+ | **`stop()`** | Stops the application server. |
70
+ | **`initialize()`** | Orchestrates the entire setup process, calling the various configuration and registration methods in the correct order. |
71
+
72
+ The `BaseApplication` class provides several **overridable hook methods** that allow you to customize the startup process. These are the primary places you'll write your application-specific setup code.
73
+
74
+ | Hook Method | Purpose |
75
+ | :--- | :--- |
76
+ | `getAppInfo()` | **Required.** Return application metadata, usually from `package.json`. Used for OpenAPI docs. |
77
+ | `staticConfigure()` | Configure static file serving. |
78
+ | `preConfigure()` | **Most Important Hook.** Set up application resources like components, controllers, services, and datasources. |
79
+ | `postConfigure()` | Perform actions *after* all resources have been configured and instantiated. |
80
+ | `setupMiddlewares()`| Add custom application-level middlewares to the Hono instance. |
81
+
82
+ ## Lifecycle Diagram
83
+
84
+ This diagram shows the sequence of operations during application startup. The methods you can override are highlighted.
85
+
86
+ ```mermaid
87
+ %%{init: { "flowchart": { "useMaxWidth": true } } }%%
88
+ graph TD
89
+ A["start()"] --> B["initialize()"];
90
+
91
+ subgraph "initialize() Sequence"
92
+ direction TB
93
+ B --> B1["printStartUpInfo"];
94
+ B1 --> B2["validateEnvs"];
95
+ B2 --> B3["registerDefaultMiddlewares"];
96
+ B3 --> B4["staticConfigure()"];
97
+ B4 --> B5["preConfigure()"];
98
+ B5 --> B6["registerDataSources"];
99
+ B6 --> B7["registerComponents"];
100
+ B7 --> B8["registerControllers"];
101
+ B8 --> B9["postConfigure()"];
102
+ end
103
+
104
+ B9 --> C["setupMiddlewares()"];
105
+ C --> D["Mount Root Router"];
106
+ D --> E["Start HTTP Server"];
107
+
108
+ subgraph "Overridable Hooks"
109
+ style B4 fill:#ffc0cb,stroke:#333
110
+ style B5 fill:#ffc0cb,stroke:#333
111
+ style B9 fill:#ffc0cb,stroke:#333
112
+ style C fill:#ffc0cb,stroke:#333
113
+ end
114
+
115
+ classDef default fill:#fff,stroke:#333,stroke-width:2px;
116
+ ```
117
+
118
+ ## Configuration
119
+
120
+ Application configuration is passed to the `BaseApplication` constructor via an `IApplicationConfigs` object.
121
+
122
+ ### Configuration Options
123
+
124
+ | Option | Type | Default | Description |
125
+ | :--- | :--- | :--- | :--- |
126
+ | `host` | `string` | `'localhost'` | The host address to bind the server to. |
127
+ | `port` | `number` | `3000` | The port to listen on. |
128
+ | `path.base`| `string` | `'/'` | The base path for all application routes (e.g., `/api`). |
129
+ | `path.isStrict`| `boolean`| `true` | If `true`, the router is strict about trailing slashes. |
130
+ | `debug.showRoutes`| `boolean`| `false`| If `true`, prints all registered routes to the console on startup. |
131
+ | `favicon` | `string` | `'🔥'` | An emoji to be used as the application's favicon. |
132
+
133
+ ### Example Configuration
134
+
135
+ ```typescript
136
+ export const appConfigs: IApplicationConfigs = {
137
+ host: "0.0.0.0",
138
+ port: 3000,
139
+ path: {
140
+ base: "/api",
141
+ isStrict: true,
142
+ },
143
+ debug: {
144
+ showRoutes: true,
145
+ },
146
+ };
147
+ ```
148
+
149
+ ## Registering Resources
150
+
151
+ Register resources in `preConfigure()` to tell the DI container about your classes:
152
+
153
+ | Method | Example | When to Use |
154
+ |--------|---------|-------------|
155
+ | `this.controller(...)` | `this.controller(UserController)` | Register API endpoints |
156
+ | `this.service(...)` | `this.service(UserService)` | Register business logic |
157
+ | `this.repository(...)` | `this.repository(UserRepository)` | Register data access |
158
+ | `this.dataSource(...)` | `this.dataSource(PostgresDataSource)` | Register database connection |
159
+ | `this.component(...)` | `this.component(AuthComponent)` | Register reusable modules |
160
+
161
+ **Registration order:**
162
+ 1. DataSources first (database connections)
163
+ 2. Repositories (depend on DataSources)
164
+ 3. Services (depend on Repositories)
165
+ 4. Controllers (depend on Services)
166
+ 5. Components last
167
+
168
+ > **Deep Dive:** See [Dependency Injection](./dependency-injection.md) for how registration and injection work together.
@@ -0,0 +1,96 @@
1
+ # Components
2
+
3
+ Components are reusable, pluggable modules that encapsulate features like authentication, logging, or API documentation.
4
+
5
+ > **Deep Dive:** See [Components Reference](../../references/base/components.md) for technical details.
6
+
7
+ ## What is a Component?
8
+
9
+ A component is a class that extends `BaseComponent` and is responsible for:
10
+
11
+ - **Binding Dependencies**: Registering services, controllers, providers, or other resources with the application's dependency injection container.
12
+ - **Configuring Features**: Setting up middlewares, initializing services, or performing any other setup required for the feature to work.
13
+
14
+ `Ignis` comes with several built-in components, which you can explore in the [**Components Reference**](../../references/components/) section:
15
+
16
+ - **`AuthenticateComponent`**: Sets up JWT-based authentication.
17
+ - **`SwaggerComponent`**: Generates interactive OpenAPI documentation.
18
+ - **`HealthCheckComponent`**: Adds a health check endpoint.
19
+ - **`RequestTrackerComponent`**: Adds request logging and tracing.
20
+ - **`SocketIOComponent`**: Integrates Socket.IO for real-time communication.
21
+
22
+ ## Creating a Component
23
+
24
+ To create a new component, extend the `BaseComponent` class. The constructor is the ideal place to define any **default bindings** that the component provides.
25
+
26
+ ```typescript
27
+ import { BaseApplication, BaseComponent, inject, CoreBindings, ValueOrPromise, Binding, BindingScopes } from '@venizia/ignis';
28
+
29
+ // An example service that the component will provide
30
+ class MyFeatureService {
31
+ // ... business logic
32
+ }
33
+
34
+ // A controller that depends on the service
35
+ @controller({ path: '/my-feature' })
36
+ class MyFeatureController {
37
+ constructor(
38
+ @inject({ key: 'services.MyFeatureService' })
39
+ private myFeatureService: MyFeatureService
40
+ ) { /* ... */ }
41
+ }
42
+
43
+ export class MyFeatureComponent extends BaseComponent {
44
+ constructor(
45
+ @inject({ key: CoreBindings.APPLICATION_INSTANCE })
46
+ private application: BaseApplication,
47
+ ) {
48
+ super({
49
+ scope: MyFeatureComponent.name,
50
+ // Enable default bindings for this component
51
+ initDefault: { enable: true, container: application },
52
+ // Define the default bindings this component provides
53
+ bindings: {
54
+ 'services.MyFeatureService': Binding.bind({ key: 'services.MyFeatureService' })
55
+ .toClass(MyFeatureService)
56
+ .setScope(BindingScopes.SINGLETON), // Make it a singleton
57
+ },
58
+ });
59
+ }
60
+
61
+ override binding(): ValueOrPromise<void> {
62
+ // This is where you configure logic that USES the bindings.
63
+ // Here, we register a controller that depends on the service
64
+ // we just bound in the constructor.
65
+ this.application.controller(MyFeatureController);
66
+ }
67
+ }
68
+ ```
69
+
70
+ ## Component Lifecycle
71
+
72
+ Components have a simple, two-stage lifecycle managed by the application.
73
+
74
+ | Stage | Method | Description |
75
+ | :--- | :--- | :--- |
76
+ | **1. Instantiation** | `constructor()` | The component is created by the DI container. This is where you call `super()` and define the component's `bindings`. If `initDefault` is enabled, these bindings are registered with the application container immediately. |
77
+ | **2. Configuration**| `binding()` | Called by the application during the `registerComponents` startup phase. This is where you should set up resources (like controllers) that *depend* on the bindings you defined in the constructor. |
78
+
79
+ ## Registering a Component
80
+
81
+ To activate a component, you must register it with the application instance, usually in the `preConfigure` method of your `Application` class.
82
+
83
+ ```typescript
84
+ // in src/application.ts
85
+ import { MyFeatureComponent } from './components/my-feature.component';
86
+
87
+ // ... inside your Application class
88
+
89
+ preConfigure(): ValueOrPromise<void> {
90
+ // ...
91
+ this.component(MyFeatureComponent);
92
+ // ...
93
+ }
94
+ ```
95
+
96
+ When the application starts, it will find the `MyFeatureComponent` binding, instantiate it, and then call its `binding()` method at the appropriate time. This modular approach keeps your main application class clean and makes it easy to toggle features on and off.