@kurdel/facade 0.1.0-beta.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Andrii Sorokin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @kurdel/facade
2
+
3
+ Simplified **application entry point** for the Kurdel framework.
4
+ Provides ready-to-use factories for Node and Express runtimes.
5
+
6
+ ---
7
+
8
+ ## 📦 Installation
9
+
10
+ ```bash
11
+ npm install @kurdel/facade
12
+ ```
13
+
14
+ ---
15
+
16
+ ## 🚀 Usage
17
+
18
+ ```ts
19
+ import { createNodeApplication } from '@kurdel/facade';
20
+ import { Controller, route, Ok } from '@kurdel/core/http';
21
+
22
+ class HelloController extends Controller {
23
+ readonly routes = { hello: route({ method: 'GET', path: '/hello' })(this.hello) };
24
+ async hello() { return Ok({ message: 'Hello, kurdel!' }); }
25
+ }
26
+
27
+ const app = await createNodeApplication({
28
+ modules: [{ controllers: [{ use: HelloController }] }],
29
+ });
30
+ app.listen(3000);
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 🧩 Exports
36
+
37
+ | Function | Runtime | Description |
38
+ | ---------------------------- | ------- | ------------------------------- |
39
+ | `createNodeApplication()` | Node.js | Uses native HTTP server |
40
+ | `createExpressApplication()` | Express | Uses Express middleware adapter |
41
+
42
+ ---
43
+
44
+ ## 📄 License
45
+
46
+ MIT © Andrii Sorokin
@@ -0,0 +1,6 @@
1
+ import type { AppConfig, Application } from '@kurdel/core/app';
2
+ /**
3
+ * Runtime façade that constructs and bootstraps the application,
4
+ * returning only the public Application interface.
5
+ */
6
+ export declare function createApplication(config: AppConfig): Promise<Application>;
@@ -0,0 +1,11 @@
1
+ import { RuntimeApplication } from '@kurdel/runtime/app';
2
+ /**
3
+ * Runtime façade that constructs and bootstraps the application,
4
+ * returning only the public Application interface.
5
+ */
6
+ export async function createApplication(config) {
7
+ const app = new RuntimeApplication(config);
8
+ await app.bootstrap();
9
+ return app;
10
+ }
11
+ //# sourceMappingURL=create-application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-application.js","sourceRoot":"","sources":["../src/create-application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,MAAiB;IACvD,MAAM,GAAG,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;IACtB,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { AppConfig } from '@kurdel/core/app';
2
+ /**
3
+ * Factory for initializing a Kurdel application on the Express.js platform.
4
+ *
5
+ * ## Responsibilities
6
+ * - Registers the Express-specific platform module (`ExpressPlatformModule`), which provides:
7
+ * - `ExpressServerAdapter` — platform-specific `ServerAdapter` implementation
8
+ * - `ExpressResponseRenderer` — response renderer compatible with Express `Response`
9
+ * - Bootstraps a fully platform-agnostic Kurdel `RuntimeApplication` instance
10
+ *
11
+ * ## Usage
12
+ * ```ts
13
+ * import { createExpressApplication } from '@kurdel/facade';
14
+ *
15
+ * const app = await createExpressApplication({
16
+ * modules: [MyHttpModule],
17
+ * db: false,
18
+ * });
19
+ *
20
+ * const server = app.listen(3000, () => console.log('Running on Express'));
21
+ * ```
22
+ *
23
+ * @param config - Application configuration object (controllers, db, modules, etc.)
24
+ * @returns Fully configured application instance using the Express runtime.
25
+ */
26
+ export declare function createExpressApplication({ modules, ...config }: AppConfig): Promise<import("@kurdel/core/app").Application>;
@@ -0,0 +1,33 @@
1
+ import { ExpressPlatformModule } from '@kurdel/runtime-express/modules';
2
+ import { createApplication } from './create-application.js';
3
+ /**
4
+ * Factory for initializing a Kurdel application on the Express.js platform.
5
+ *
6
+ * ## Responsibilities
7
+ * - Registers the Express-specific platform module (`ExpressPlatformModule`), which provides:
8
+ * - `ExpressServerAdapter` — platform-specific `ServerAdapter` implementation
9
+ * - `ExpressResponseRenderer` — response renderer compatible with Express `Response`
10
+ * - Bootstraps a fully platform-agnostic Kurdel `RuntimeApplication` instance
11
+ *
12
+ * ## Usage
13
+ * ```ts
14
+ * import { createExpressApplication } from '@kurdel/facade';
15
+ *
16
+ * const app = await createExpressApplication({
17
+ * modules: [MyHttpModule],
18
+ * db: false,
19
+ * });
20
+ *
21
+ * const server = app.listen(3000, () => console.log('Running on Express'));
22
+ * ```
23
+ *
24
+ * @param config - Application configuration object (controllers, db, modules, etc.)
25
+ * @returns Fully configured application instance using the Express runtime.
26
+ */
27
+ export function createExpressApplication({ modules = [], ...config }) {
28
+ return createApplication({
29
+ ...config,
30
+ modules: [...modules, ExpressPlatformModule],
31
+ });
32
+ }
33
+ //# sourceMappingURL=create-express-application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-express-application.js","sourceRoot":"","sources":["../src/create-express-application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,wBAAwB,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,EAAa;IAC7E,OAAO,iBAAiB,CAAC;QACvB,GAAG,MAAM;QACT,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,qBAAqB,CAAC;KAC7C,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { AppConfig } from '@kurdel/core/app';
2
+ /**
3
+ * Factory for initializing a Kurdel application on the native Node.js platform.
4
+ *
5
+ * ## Responsibilities
6
+ * - Registers the Node-specific platform module (`NodePlatformModule`), which provides:
7
+ * - `NativeHttpServerAdapter` — platform-specific `ServerAdapter` implementation
8
+ * - `NodeResponseRenderer` — renderer for native Node.js HTTP responses
9
+ * - Bootstraps a fully platform-agnostic Kurdel `RuntimeApplication` instance
10
+ *
11
+ * ## Usage
12
+ * ```ts
13
+ * import { createNodeApplication } from '@kurdel/facade';
14
+ *
15
+ * const app = await createNodeApplication({
16
+ * modules: [MyHttpModule],
17
+ * db: false,
18
+ * });
19
+ *
20
+ * const server = app.listen(3000, () => console.log('Running on native Node.js'));
21
+ * ```
22
+ *
23
+ * @param config - Application configuration object (controllers, db, modules, etc.)
24
+ * @returns Fully configured application instance using the Node.js runtime.
25
+ */
26
+ export declare function createNodeApplication({ modules, ...config }: AppConfig): Promise<import("@kurdel/core/app").Application>;
@@ -0,0 +1,33 @@
1
+ import { NodePlatformModule } from '@kurdel/runtime-node/modules';
2
+ import { createApplication } from './create-application.js';
3
+ /**
4
+ * Factory for initializing a Kurdel application on the native Node.js platform.
5
+ *
6
+ * ## Responsibilities
7
+ * - Registers the Node-specific platform module (`NodePlatformModule`), which provides:
8
+ * - `NativeHttpServerAdapter` — platform-specific `ServerAdapter` implementation
9
+ * - `NodeResponseRenderer` — renderer for native Node.js HTTP responses
10
+ * - Bootstraps a fully platform-agnostic Kurdel `RuntimeApplication` instance
11
+ *
12
+ * ## Usage
13
+ * ```ts
14
+ * import { createNodeApplication } from '@kurdel/facade';
15
+ *
16
+ * const app = await createNodeApplication({
17
+ * modules: [MyHttpModule],
18
+ * db: false,
19
+ * });
20
+ *
21
+ * const server = app.listen(3000, () => console.log('Running on native Node.js'));
22
+ * ```
23
+ *
24
+ * @param config - Application configuration object (controllers, db, modules, etc.)
25
+ * @returns Fully configured application instance using the Node.js runtime.
26
+ */
27
+ export function createNodeApplication({ modules = [], ...config }) {
28
+ return createApplication({
29
+ ...config,
30
+ modules: [...modules, NodePlatformModule],
31
+ });
32
+ }
33
+ //# sourceMappingURL=create-node-application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-node-application.js","sourceRoot":"","sources":["../src/create-node-application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,EAAa;IAC1E,OAAO,iBAAiB,CAAC;QACvB,GAAG,MAAM;QACT,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,kBAAkB,CAAC;KAC1C,CAAC,CAAC;AACL,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './create-application.js';
2
+ export * from './create-node-application.js';
3
+ export * from './create-express-application.js';
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './create-application.js';
2
+ export * from './create-node-application.js';
3
+ export * from './create-express-application.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@kurdel/facade",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "High-level application factories and public facade for Kurdel",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./lib/index.js"
8
+ },
9
+ "main": "./lib/index.js",
10
+ "types": "./lib/index.d.ts",
11
+ "files": [
12
+ "lib"
13
+ ],
14
+ "scripts": {
15
+ "prepack": "npm run build",
16
+ "test": "vitest run",
17
+ "test:ui": "vitest",
18
+ "test:watch": "vitest --watch",
19
+ "coverage": "vitest run --coverage",
20
+ "clean": "rimraf lib ../../.cache/tsconfig.facade.build.tsbuildinfo",
21
+ "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
22
+ "build:force": "npm run clean && tsc -p tsconfig.build.json --force && tsc-alias -p tsconfig.build.json"
23
+ },
24
+ "keywords": [
25
+ "kurdel",
26
+ "framework",
27
+ "application",
28
+ "http"
29
+ ],
30
+ "author": "Andrii Sorokin",
31
+ "license": "MIT",
32
+ "engines": {
33
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/ignorantic/kurdel.git",
38
+ "directory": "packages/facade"
39
+ },
40
+ "homepage": "https://github.com/ignorantic/kurdel/tree/main/packages/facade#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/ignorantic/kurdel/issues"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "tag": "beta"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^20.9.0",
50
+ "@types/supertest": "^6.0.3",
51
+ "@vitest/coverage-v8": "^3.2.4",
52
+ "rimraf": "^6.0.1",
53
+ "supertest": "^7.1.4",
54
+ "tsc-alias": "^1.8.16"
55
+ },
56
+ "dependencies": {
57
+ "@kurdel/core": "0.1.0-beta.1",
58
+ "@kurdel/runtime": "0.1.0-beta.1",
59
+ "@kurdel/runtime-express": "0.1.0-beta.1",
60
+ "@kurdel/runtime-node": "0.1.0-beta.1"
61
+ }
62
+ }