Skip to content

Commit 9139b1b

Browse files
committed
feat: enhance README for Hono server plugin with usage examples and architecture details
1 parent 9c6c7bb commit 9139b1b

File tree

2 files changed

+41
-10
lines changed

2 files changed

+41
-10
lines changed

packages/plugins/plugin-hono-server/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,33 @@ HTTP Server adapter for ObjectStack using Hono.
44

55
## Features
66

7+
- **Standard Runtime**: Uses the unified `HttpDispatcher` and standard Hono adapter via `@objectstack/hono`.
78
- **Fast**: Built on Hono, a high-performance web framework.
8-
- **Protocol Compliant**: Implements the `IHttpServer` interface required by `@objectstack/runtime`.
9-
- **Middleware**: Supports standard ObjectStack middleware.
9+
- **Full Protocol Support**: Automatically provides all ObjectStack Runtime endpoints (Auth, Data, Metadata, etc.).
10+
- **Middleware**: Supports standard Hono middleware.
1011

1112
## Usage
1213

1314
```typescript
14-
import { ObjectKernel } from '@objectstack/core';
15+
import { ObjectKernel } from '@objectstack/runtime';
1516
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
1617

1718
const kernel = new ObjectKernel();
18-
kernel.use(new HonoServerPlugin({ port: 3000 }));
19+
20+
// Register the server plugin
21+
kernel.use(new HonoServerPlugin({
22+
port: 3000,
23+
restConfig: {
24+
api: {
25+
apiPath: '/api/v1' // Customize API prefix
26+
}
27+
}
28+
}));
29+
30+
await kernel.start();
1931
```
32+
33+
## Architecture
34+
35+
This plugin wraps `@objectstack/hono` to provide a turnkey HTTP server solution for the Runtime. It binds the standard `HttpDispatcher` to a Hono application and starts listening on the configured port.
36+

packages/plugins/plugin-msw/README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ See [objectstack.config.ts](./objectstack.config.ts) for the complete capability
2121

2222
## Features
2323

24-
- 🎯 **Automatic API Mocking**: Automatically generates MSW handlers for all ObjectStack API endpoints
25-
- 🔄 **Runtime Integration**: Seamlessly integrates with ObjectStack Runtime Protocol
26-
- 🧪 **Testing Ready**: Perfect for unit tests, integration tests, and development
27-
- 🌐 **Browser & Node Support**: Works in both browser and Node.js environments
28-
- 🎨 **Custom Handlers**: Easily add custom MSW handlers alongside standard ones
29-
- 📝 **TypeScript First**: Fully typed with TypeScript
24+
- 🎯 **Unified Dispatcher**: Uses `@objectstack/runtime`'s `HttpDispatcher` to ensure mocks behave exactly like the real server.
25+
- 🔄 **Full Protocol Support**: Mocks **all** Runtime endpoints:
26+
- Auth (`/auth`)
27+
- Metadata (`/metadata`)
28+
- Data (`/data` - with filtering, batching, relations)
29+
- Storage (`/storage`)
30+
- Analytics (`/analytics`)
31+
- Automation (`/automation`)
32+
- 🌐 **Universal Support**: Works in Browser (Service Worker) and Node.js (Interceptor).
33+
- 🎨 **Custom Handlers**: Easily inject custom MSW handlers that take precedence.
34+
- 📝 **TypeScript First**: Fully typed configuration.
3035

3136
## Installation
3237

@@ -44,12 +49,21 @@ import { ObjectKernel } from '@objectstack/runtime';
4449

4550
const kernel = new ObjectKernel();
4651

52+
// The MSW Plugin will initialize the HttpDispatcher and intercept requests
4753
kernel.use(new MSWPlugin({
4854
enableBrowser: true,
4955
baseUrl: '/api/v1',
5056
logRequests: true
5157
}));
5258

59+
await kernel.start();
60+
```
61+
62+
### Architecture
63+
64+
The plugin uses the `HttpDispatcher` from the Runtime to process requests intercepted by MSW. This means your mock server runs the **actual** ObjectStack business logic (permissions, validation, flow execution) in-memory, providing a high-fidelity simulation of the backend.
65+
}));
66+
5367
await kernel.bootstrap();
5468
```
5569

0 commit comments

Comments
 (0)