diff --git a/packages/runtime/README.md b/packages/runtime/README.md index 9136c94a4..5cab3f697 100644 --- a/packages/runtime/README.md +++ b/packages/runtime/README.md @@ -126,17 +126,21 @@ new AppManifestPlugin(appConfig) #### IHttpServer -Abstract interface for HTTP server capabilities. Allows plugins to work with any HTTP framework (Express, Fastify, Hono, etc.) without tight coupling. +Abstract interface for HTTP server capabilities. + +**Primary Implementation:** Hono (@objectstack/plugin-hono-server) is the canonical HTTP framework for ObjectStack - lightweight, fast, and edge-ready. + +**Alternative Implementations:** Express, Fastify, Koa, etc. can also implement this interface. ```typescript import { IHttpServer, IHttpRequest, IHttpResponse } from '@objectstack/runtime'; -// In your HTTP server plugin +// In your HTTP server plugin (using Hono or any other framework) class MyHttpServerPlugin implements Plugin { name = 'http-server'; async init(ctx: PluginContext) { - const server: IHttpServer = createMyServer(); // Express, Hono, etc. + const server: IHttpServer = createMyServer(); // Hono, Express, etc. ctx.registerService('http-server', server); } } @@ -169,12 +173,16 @@ class MyApiPlugin implements Plugin { #### IDataEngine -Abstract interface for data persistence. Allows plugins to work with any data layer (ObjectQL, Prisma, TypeORM, etc.) without tight coupling. +Abstract interface for data persistence. + +**Primary Implementation:** ObjectQL (@objectstack/objectql) is the canonical data engine for ObjectStack - provides metadata-driven CRUD operations with driver abstraction. + +**Alternative Implementations:** Prisma, TypeORM, Mongoose, etc. can also implement this interface. ```typescript import { IDataEngine } from '@objectstack/runtime'; -// In your data plugin +// In your data plugin (using ObjectQL or any other data layer) class MyDataPlugin implements Plugin { name = 'data'; diff --git a/packages/runtime/src/interfaces/data-engine.ts b/packages/runtime/src/interfaces/data-engine.ts index afe3c4e02..ab4a363cc 100644 --- a/packages/runtime/src/interfaces/data-engine.ts +++ b/packages/runtime/src/interfaces/data-engine.ts @@ -3,7 +3,13 @@ * * Abstract interface for data persistence capabilities. * This allows plugins to interact with data engines without knowing - * the underlying implementation (SQL, MongoDB, Memory, etc.). + * the underlying implementation. + * + * **Primary Implementation:** ObjectQL (@objectstack/objectql) + * - ObjectQL is the canonical data engine for ObjectStack + * - Provides metadata-driven CRUD operations with driver abstraction + * + * **Alternative Implementations:** Prisma, TypeORM, Mongoose, etc. * * Follows Dependency Inversion Principle - plugins depend on this interface, * not on concrete database implementations. @@ -38,7 +44,9 @@ export interface QueryOptions { * IDataEngine - Data persistence capability interface * * Defines the contract for data engine implementations. - * Concrete implementations (ObjectQL, Prisma, TypeORM) should implement this interface. + * + * **Primary Implementation:** ObjectQL is the canonical implementation for ObjectStack. + * Alternative implementations (Prisma, TypeORM) can also implement this interface. */ export interface IDataEngine { /** diff --git a/packages/runtime/src/interfaces/http-server.ts b/packages/runtime/src/interfaces/http-server.ts index e3f384912..036ca761b 100644 --- a/packages/runtime/src/interfaces/http-server.ts +++ b/packages/runtime/src/interfaces/http-server.ts @@ -3,7 +3,13 @@ * * Abstract interface for HTTP server capabilities. * This allows plugins to interact with HTTP servers without knowing - * the underlying implementation (Express, Fastify, Hono, etc.). + * the underlying implementation. + * + * **Primary Implementation:** Hono (@objectstack/plugin-hono-server) + * - Hono is the canonical HTTP framework for ObjectStack + * - Lightweight, fast, and edge-ready + * + * **Alternative Implementations:** Express, Fastify, Koa, etc. * * Follows Dependency Inversion Principle - plugins depend on this interface, * not on concrete HTTP framework implementations. @@ -80,7 +86,9 @@ export type Middleware = ( * IHttpServer - HTTP Server capability interface * * Defines the contract for HTTP server implementations. - * Concrete implementations (Express, Fastify, Hono) should implement this interface. + * + * **Primary Implementation:** Hono is the canonical implementation for ObjectStack. + * Alternative implementations (Express, Fastify) can also implement this interface. */ export interface IHttpServer { /** diff --git a/packages/runtime/src/test-interfaces.ts b/packages/runtime/src/test-interfaces.ts index 47e3f280f..3421692e1 100644 --- a/packages/runtime/src/test-interfaces.ts +++ b/packages/runtime/src/test-interfaces.ts @@ -3,6 +3,12 @@ * * This file demonstrates how plugins can implement the IHttpServer * and IDataEngine interfaces without depending on concrete implementations. + * + * Primary Implementations in ObjectStack: + * - IHttpServer → Hono (@objectstack/plugin-hono-server) + * - IDataEngine → ObjectQL (@objectstack/objectql) + * + * This mock implementation is for testing purposes only. */ import { IHttpServer, IDataEngine, RouteHandler, IHttpRequest, IHttpResponse, Middleware, QueryOptions } from './index.js'; @@ -10,8 +16,11 @@ import { IHttpServer, IDataEngine, RouteHandler, IHttpRequest, IHttpResponse, Mi /** * Example: Mock HTTP Server Plugin * - * Shows how a plugin can implement the IHttpServer interface - * without depending on Express, Fastify, or any specific framework. + * Shows how a plugin can implement the IHttpServer interface. + * + * Note: In production ObjectStack applications, use Hono via + * @objectstack/plugin-hono-server as the canonical implementation. + * This mock is for testing the interface contract only. */ class MockHttpServer implements IHttpServer { private routes: Map = new Map(); @@ -57,8 +66,11 @@ class MockHttpServer implements IHttpServer { /** * Example: Mock Data Engine Plugin * - * Shows how a plugin can implement the IDataEngine interface - * without depending on ObjectQL, Prisma, or any specific database. + * Shows how a plugin can implement the IDataEngine interface. + * + * Note: In production ObjectStack applications, use ObjectQL via + * @objectstack/objectql as the canonical implementation. + * This mock is for testing the interface contract only. */ class MockDataEngine implements IDataEngine { private store: Map> = new Map();