@jskit-ai/create-app 0.1.65 → 0.1.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/create-app",
3
- "version": "0.1.65",
3
+ "version": "0.1.67",
4
4
  "description": "Scaffold minimal JSKIT app shells.",
5
5
  "type": "module",
6
6
  "files": [
@@ -3,7 +3,7 @@ export default Object.freeze({
3
3
  packageId: "@local/main",
4
4
  version: "0.1.0",
5
5
  kind: "runtime",
6
- description: "App-local main module scaffold.",
6
+ description: "App-local main composition and glue scaffold.",
7
7
  dependsOn: [],
8
8
  capabilities: {
9
9
  provides: [],
@@ -12,13 +12,11 @@ export default Object.freeze({
12
12
  options: {},
13
13
  runtime: {
14
14
  server: {
15
- providerEntrypoint: "src/server/index.js",
15
+ providerEntrypoint: "src/server/MainServiceProvider.js",
16
16
  providers: [
17
17
  {
18
- discover: {
19
- dir: "src/server/providers",
20
- pattern: "*Provider.js"
21
- }
18
+ entrypoint: "src/server/MainServiceProvider.js",
19
+ export: "MainServiceProvider"
22
20
  }
23
21
  ]
24
22
  },
@@ -32,6 +30,21 @@ export default Object.freeze({
32
30
  }
33
31
  },
34
32
  metadata: {
33
+ jskit: {
34
+ ownershipGuidance: {
35
+ title: "App-local main lane",
36
+ summary: "Keep @local/main focused on app composition and lightweight glue. Substantial server features should become dedicated packages instead of growing inside packages/main.",
37
+ responsibilities: [
38
+ "packages/main server code: bootstraps app-local configuration and lightweight wiring only",
39
+ "substantial non-CRUD server features: scaffold a dedicated package with feature-server-generator",
40
+ "packages/main: do not add service/controller/route/repository feature trees here"
41
+ ],
42
+ examples: [
43
+ "jskit generate feature-server-generator scaffold booking-engine",
44
+ "jskit generate feature-server-generator scaffold availability-engine --mode orchestrator"
45
+ ]
46
+ }
47
+ },
35
48
  server: {
36
49
  routes: []
37
50
  },
@@ -6,7 +6,7 @@
6
6
  "exports": {
7
7
  "./client": "./src/client/index.js",
8
8
  "./server": "./src/server/index.js",
9
- "./server/providers/MainServiceProvider": "./src/server/providers/MainServiceProvider.js",
9
+ "./server/MainServiceProvider": "./src/server/MainServiceProvider.js",
10
10
  "./shared": "./src/shared/index.js"
11
11
  }
12
12
  }
@@ -0,0 +1,20 @@
1
+ import { loadAppConfig } from "./loadAppConfig.js";
2
+
3
+ class MainServiceProvider {
4
+ static id = "local.main";
5
+
6
+ // Register only lightweight app-local composition bindings here.
7
+ async register(app) {
8
+ const appConfig = await loadAppConfig({
9
+ moduleUrl: import.meta.url
10
+ });
11
+ app.instance("appConfig", appConfig);
12
+ }
13
+
14
+ // Keep packages/main as app glue only.
15
+ // When backend behavior becomes substantial, scaffold a dedicated package:
16
+ // jskit generate feature-server-generator scaffold <feature-name>
17
+ boot() {}
18
+ }
19
+
20
+ export { MainServiceProvider };
@@ -1 +1 @@
1
- export { MainServiceProvider } from "./providers/MainServiceProvider.js";
1
+ export { MainServiceProvider } from "./MainServiceProvider.js";
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Shared entrypoint for code used by both client and server.
3
3
  *
4
+ * Keep this for genuinely app-local shared glue only.
5
+ *
4
6
  * Example:
5
7
  * export * from "./schemas/index.js";
6
8
  * export * from "./constants/index.js";
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Shared transport validators/resources live here.
2
+ * App-local shared transport validators/resources live here.
3
+ * Dedicated feature packages should keep their own schemas with the feature.
3
4
  *
4
5
  * Example:
5
6
  * import { createSchema } from "json-rest-schema";
@@ -83,7 +83,14 @@ function canServeStaticFile(distRoot, relativePath) {
83
83
  }
84
84
 
85
85
  async function createServer() {
86
- const app = Fastify({ logger: true });
86
+ const app = Fastify({
87
+ logger: true,
88
+ ajv: {
89
+ customOptions: {
90
+ allowUnionTypes: true
91
+ }
92
+ }
93
+ });
87
94
 
88
95
  app.get("/api/health", async () => {
89
96
  return {
@@ -1,9 +0,0 @@
1
- /**
2
- * Server controller exports.
3
- *
4
- * Controllers adapt HTTP requests to service calls.
5
- *
6
- * Example:
7
- * export { MainHelloController } from "./MainHelloController.js";
8
- */
9
- export {};
@@ -1,22 +0,0 @@
1
- import { loadAppConfig } from "../support/loadAppConfig.js";
2
-
3
- class MainServiceProvider {
4
- static id = "local.main";
5
-
6
- // Optional: register container bindings here (services/singletons).
7
- async register(app) {
8
- const appConfig = await loadAppConfig({
9
- moduleUrl: import.meta.url
10
- });
11
- app.instance("appConfig", appConfig);
12
- }
13
-
14
- // Start backend features here:
15
- // 1) define shared validators/resources in `src/shared/schemas`
16
- // 2) resolve router with `app.make("jskit.http.router")`
17
- // 3) register routes and handlers
18
- // 4) extract to services/controllers/routes as the feature grows
19
- boot() {}
20
- }
21
-
22
- export { MainServiceProvider };
@@ -1,9 +0,0 @@
1
- /**
2
- * Server route definition exports.
3
- *
4
- * Route builders define HTTP method/path/schema/handler wiring.
5
- *
6
- * Example:
7
- * export { buildMainRoutes } from "./mainRoutes.js";
8
- */
9
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * Server service exports.
3
- *
4
- * Services hold domain logic and are called by controllers.
5
- *
6
- * Example:
7
- * export { MainHelloService } from "./MainHelloService.js";
8
- */
9
- export {};