Skip to content

Commit ee17581

Browse files
committed
Refactor package structure and prepare for 0.3.0 release
- Remove unused plugin packages (cors, body-limit, file-plugin, security-headers, send-file, serve-static) - Rename nodejs-adapter to nodejs-server - Replace openapi-scalar-ui-plugin with openapi-swagger-ui-plugin - Add comprehensive README files for all packages - Update documentation and example code - Add changeset for version 0.3.0 upgrade
1 parent 2cab957 commit ee17581

File tree

212 files changed

+4181
-12990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+4181
-12990
lines changed

.changeset/nodejs-adapter-improvements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'@korix/nodejs-adapter': patch
2+
'@korix/nodejs-server': patch
33
---
44

55
Improve Node.js adapter with better documentation, error handling, and graceful shutdown

.changeset/refactor-schema-adapter-architecture.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
---
2-
'@korix/body-limit-plugin': minor
3-
'@korix/cors-plugin': minor
42
'@korix/eslint-config': minor
5-
'@korix/file-plugin-nodejs': minor
63
'@korix/kori': minor
7-
'@korix/nodejs-adapter': minor
4+
'@korix/nodejs-server': minor
85
'@korix/openapi-plugin': minor
9-
'@korix/openapi-scalar-ui-plugin': minor
106
'@korix/script': minor
11-
'@korix/security-headers-plugin': minor
127
'@korix/standard-schema-adapter': minor
138
'@korix/zod-openapi-plugin': minor
149
'@korix/zod-schema-adapter': minor

.changeset/upgrade-to-0-3-0.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@korix/kori': minor
3+
'@korix/eslint-config': minor
4+
'@korix/nodejs-server': minor
5+
'@korix/openapi-plugin': minor
6+
'@korix/openapi-swagger-ui-plugin': minor
7+
'@korix/script': minor
8+
'@korix/standard-schema-adapter': minor
9+
'@korix/zod-openapi-plugin': minor
10+
'@korix/zod-schema-adapter': minor
11+
---
12+
13+
Upgrade all packages to version 0.3.0

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
id: changesets
5858
uses: changesets/action@v1
5959
with:
60+
version: pnpm changeset:version
6061
commit: 'chore: release packages'
6162
title: 'chore: release packages'
6263
publish: pnpm changeset:publish

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ tsconfig.tsbuildinfo
3535
# VitePress
3636
docs/.vitepress/dist
3737
docs/.vitepress/cache
38+
39+
# Claude
40+
.claude/settings.local.json

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
dist
22
**/pnpm-lock.yaml
3+
4+
# Auto-generated assets
5+
packages/openapi-swagger-ui-plugin/src/assets/

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Kori
2+
3+
A modern, type-safe web framework for TypeScript, built on [Hono](https://hono.dev/)'s battle-tested router.
4+
5+
## Features
6+
7+
- Fast and lightweight routing powered by Hono's router
8+
- Full TypeScript type inference throughout your application
9+
- Automatic OpenAPI specification generation
10+
- Schema validation with Zod and other libraries
11+
- Extensible plugin architecture
12+
13+
## Installation
14+
15+
```bash
16+
npm install @korix/kori
17+
```
18+
19+
## Quick Example
20+
21+
```typescript
22+
import { createKori } from '@korix/kori';
23+
24+
const app = createKori()
25+
.get('/hello/:name', (ctx) => {
26+
const { name } = ctx.req.pathParams();
27+
return ctx.res.json({ message: `Hello, ${name}!` });
28+
})
29+
.post('/users', async (ctx) => {
30+
const body = await ctx.req.bodyJson();
31+
return ctx.res.status(201).json({ id: 1, ...body });
32+
});
33+
34+
// Generate the fetch handler
35+
const { fetchHandler } = await app.generate().onStart();
36+
37+
// Use with any platform that supports Fetch API
38+
const response = await fetchHandler(new Request('http://localhost/hello/world'));
39+
```
40+
41+
## With Validation
42+
43+
```typescript
44+
import { createKori } from '@korix/kori';
45+
import { zodRequestSchema, zodResponseSchema, enableZodRequestValidation } from '@korix/zod-schema-adapter';
46+
import { z } from 'zod';
47+
48+
const app = createKori({
49+
...enableZodRequestValidation(),
50+
});
51+
52+
app.post('/users', {
53+
requestSchema: zodRequestSchema({
54+
body: z.object({
55+
name: z.string(),
56+
age: z.number(),
57+
}),
58+
}),
59+
responseSchema: zodResponseSchema({
60+
201: z.object({
61+
id: z.number(),
62+
name: z.string(),
63+
age: z.number(),
64+
}),
65+
}),
66+
handler: (ctx) => {
67+
// Types are automatically inferred from schemas
68+
const { name, age } = ctx.req.validatedBody();
69+
return ctx.res.status(201).json({ id: 1, name, age });
70+
},
71+
});
72+
```
73+
74+
## And OpenAPI
75+
76+
```typescript
77+
import { createKori } from '@korix/kori';
78+
import { zodOpenApiPlugin, openApiMeta } from '@korix/zod-openapi-plugin';
79+
import { swaggerUiPlugin } from '@korix/openapi-swagger-ui-plugin';
80+
import { startNodejsServer } from '@korix/nodejs-server';
81+
82+
const app = createKori()
83+
.applyPlugin(
84+
zodOpenApiPlugin({
85+
info: { title: 'My API', version: '1.0.0' },
86+
}),
87+
)
88+
.applyPlugin(swaggerUiPlugin())
89+
.get('/hello/:name', {
90+
pluginMeta: openApiMeta({
91+
summary: 'Say hello',
92+
description: 'Returns a personalized greeting',
93+
tags: ['Greetings'],
94+
}),
95+
handler: (ctx) => {
96+
const { name } = ctx.req.pathParams();
97+
return ctx.res.json({ message: `Hello, ${name}!` });
98+
},
99+
});
100+
101+
await startNodejsServer(app, { port: 3000 });
102+
103+
// Visit http://localhost:3000/docs for interactive API documentation
104+
```
105+
106+
## Documentation
107+
108+
📖 [Read the full documentation](https://bufferings.github.io/kori)
109+
110+
## Packages
111+
112+
- [`@korix/kori`](./packages/kori) - Core framework
113+
- [`@korix/zod-openapi-plugin`](./packages/zod-openapi-plugin) - Zod schema validation with OpenAPI generation
114+
- [`@korix/openapi-swagger-ui-plugin`](./packages/openapi-swagger-ui-plugin) - Interactive API documentation with Swagger UI
115+
- [`@korix/nodejs-server`](./packages/nodejs-server) - Node.js HTTP server adapter
116+
117+
[View all packages →](./packages)
118+
119+
## Built With
120+
121+
Kori is built on top of excellent open source projects:
122+
123+
- [Hono Router](https://hono.dev/) - Fast, lightweight, and battle-tested routing engine
124+
- [Swagger UI](https://swagger.io/tools/swagger-ui/) - Interactive API documentation
125+
126+
## License
127+
128+
MIT

docs/en/examples/rest-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { corsPlugin } from '@korix/cors-plugin';
1111
import { bodyLimitPlugin } from '@korix/body-limit-plugin';
1212
import { securityHeadersPlugin } from '@korix/security-headers-plugin';
1313
import { zodOpenApiPlugin, openApiMeta } from '@korix/zod-openapi-plugin';
14-
import { scalarUiPlugin } from '@korix/openapi-scalar-ui-plugin';
14+
import { swaggerUiPlugin } from '@korix/openapi-swagger-ui-plugin';
1515
import { zodRequestSchema } from '@korix/zod-schema';
1616
import {
1717
createKoriZodRequestValidator,
@@ -86,7 +86,7 @@ const app = createKori({
8686
}),
8787
)
8888
.applyPlugin(
89-
scalarUiPlugin({
89+
swaggerUiPlugin({
9090
path: '/docs',
9191
title: 'Users API Documentation',
9292
}),

docs/en/extensions/zod-openapi-plugin.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The `@korix/zod-openapi-plugin` transforms your existing Zod schemas into beauti
1111
The Zod OpenAPI Plugin provides:
1212

1313
- 📖 **Auto Documentation** - Generate OpenAPI specs from your schemas
14-
- 🎨 **Interactive UI** - Beautiful documentation with Scalar UI integration
14+
- 🎨 **Interactive UI** - Beautiful documentation with Swagger UI integration
1515
- 🔄 **Zero Maintenance** - Documentation stays in sync with your code
1616
- 🎯 **Type-Safe Metadata** - Rich, validated documentation metadata
1717

@@ -20,7 +20,7 @@ The Zod OpenAPI Plugin provides:
2020
```typescript
2121
import { createKori } from '@korix/kori';
2222
import { zodOpenApiPlugin, openApiMeta } from '@korix/zod-openapi-plugin';
23-
import { scalarUiPlugin } from '@korix/openapi-scalar-ui-plugin';
23+
import { swaggerUiPlugin } from '@korix/openapi-swagger-ui-plugin';
2424
import { zodRequestSchema } from '@korix/zod-schema';
2525

2626
const app = createKori()
@@ -36,7 +36,7 @@ const app = createKori()
3636
)
3737
// Serve interactive documentation
3838
.applyPlugin(
39-
scalarUiPlugin({
39+
swaggerUiPlugin({
4040
path: '/docs',
4141
title: 'My API Documentation',
4242
}),
@@ -221,22 +221,15 @@ app.post('/auth/login', {
221221

222222
## UI Customization
223223

224-
### Scalar UI Configuration
224+
### Swagger UI Configuration
225225

226-
Customize the documentation interface:
226+
Configure the documentation interface:
227227

228228
```typescript
229-
const appWithScalarUi = app.applyPlugin(
230-
scalarUiPlugin({
229+
app.applyPlugin(
230+
swaggerUiPlugin({
231231
path: '/docs',
232232
title: 'My API Documentation',
233-
theme: 'auto', // 'light', 'dark', or 'auto'
234-
customCss: `
235-
.scalar-app {
236-
--scalar-color-1: #2563eb;
237-
--scalar-color-accent: #3b82f6;
238-
}
239-
`,
240233
}),
241234
);
242235
```
@@ -247,20 +240,18 @@ Serve different documentation for different audiences:
247240

248241
```typescript
249242
// Public API docs
250-
const appWithPublicDocs = app.applyPlugin(
251-
scalarUiPlugin({
243+
app.applyPlugin(
244+
swaggerUiPlugin({
252245
path: '/docs',
253246
title: 'Public API',
254-
theme: 'light',
255247
}),
256248
);
257249

258250
// Internal API docs
259-
const appWithInternalDocs = app.applyPlugin(
260-
scalarUiPlugin({
251+
app.applyPlugin(
252+
swaggerUiPlugin({
261253
path: '/internal-docs',
262254
title: 'Internal API',
263-
theme: 'dark',
264255
}),
265256
);
266257
```
@@ -333,7 +324,7 @@ Use schemas for documentation only (no runtime validation):
333324
// No validator - documentation only
334325
const app = createKori()
335326
.applyPlugin(zodOpenApiPlugin())
336-
.applyPlugin(scalarUiPlugin({ path: '/docs' }));
327+
.applyPlugin(swaggerUiPlugin({ path: '/docs' }));
337328

338329
app.post('/users', {
339330
requestSchema: zodRequestSchema({ body: UserSchema }), // Docs only

docs/en/guide/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ import { createKori } from '@korix/kori';
193193
import { createKoriZodRequestValidator } from '@korix/zod-validator';
194194
import { zodRequestSchema } from '@korix/zod-schema';
195195
import { zodOpenApiPlugin } from '@korix/zod-openapi-plugin';
196-
import { scalarUiPlugin } from '@korix/openapi-scalar-ui-plugin';
196+
import { swaggerUiPlugin } from '@korix/openapi-swagger-ui-plugin';
197197
import { z } from 'zod';
198198

199199
const CreateUserSchema = z.object({
@@ -211,7 +211,7 @@ const app = createKori({
211211
}),
212212
)
213213
// Serve interactive documentation UI
214-
.applyPlugin(scalarUiPlugin());
214+
.applyPlugin(swaggerUiPlugin());
215215

216216
app.post('/users', {
217217
requestSchema: zodRequestSchema({ body: CreateUserSchema }),

0 commit comments

Comments
 (0)