Skip to content

Commit fa3237e

Browse files
committed
docs: multiple updates
1 parent 521a25f commit fa3237e

34 files changed

Lines changed: 153 additions & 168 deletions

docs/backend/building-for-production.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pnpm build # all source folders
1616
pnpm build front # specific folder
1717
```
1818

19-
## 📦 Build Output
19+
## Build Output
2020

2121
```txt
2222
dist/
@@ -34,7 +34,7 @@ dist/
3434

3535
The SSR output is only present when [SSR is enabled](/frontend/server-side-render).
3636

37-
## 🚀 Running in Production
37+
## Running in Production
3838

3939
The simplest deployment - just run the bundled server directly:
4040

docs/backend/cascading-middleware.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ head:
1313
Place a `use.ts` file in any folder, and its middleware automatically wraps all routes
1414
in that folder and its subfolders - no imports or wiring required.
1515

16-
## 🎯 How it Works
16+
## How it Works
1717

1818
```txt
1919
api/users/
@@ -60,7 +60,7 @@ Beside the default exported middleware, every `use.ts` exports an `ExtendT` type
6060
This type extends the context for all routes underneath, giving you
6161
automatic type safety for anything the middleware adds.
6262

63-
## 🔗 Type-Safe Context Extension
63+
## Type-Safe Context Extension
6464

6565
The whole point of cascading middleware is to avoid manual wiring.
6666
That applies to types too - if your auth middleware adds `user` to the context,
@@ -149,7 +149,7 @@ alongside the middleware itself.
149149
> };
150150
> ```
151151
152-
## 💼 Common Use Cases
152+
## Common Use Cases
153153
154154
### Authentication
155155
@@ -289,7 +289,7 @@ export default [
289289
```
290290
:::
291291

292-
## ⚠️ Parameter Availability
292+
## Parameter Availability
293293

294294
Cascading middleware runs for all routes in the hierarchy, including ones that don't
295295
define the parameters you might expect:
@@ -304,7 +304,7 @@ api/users/
304304
`ctx.params.id` is undefined for `/users`. Keep cascading middleware generic -
305305
authentication, logging, rate limiting. Parameter-specific logic belongs in the route handler.
306306

307-
## 🎨 Multiple Middleware + Method Filtering
307+
## Multiple Middleware + Method Filtering
308308

309309
A single `use.ts` can define multiple functions, and each supports the `on` option:
310310

docs/backend/context.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ head:
1212
`KosmoJS` extends the standard Koa/Hono context with two additions:
1313
a unified bodyparser API and `ctx.validated` for type-safe access to validated request data.
1414

15-
## 🔋 Unified Bodyparser
15+
## Unified Bodyparser
1616

1717
`ctx.bodyparser` works the same regardless of framework:
1818

@@ -27,7 +27,7 @@ Results are cached - calling the same parser multiple times doesn't re-parse the
2727
In practice you rarely call this directly. Define a validation schema in your handler
2828
and the appropriate parser runs automatically, placing the result in `ctx.validated`.
2929

30-
## Validated Data Access
30+
## Validated Data Access
3131

3232
`ctx.validated` holds the validated, typed result for each target you defined:
3333

@@ -45,7 +45,7 @@ export default defineRoute(({ POST }) => [
4545
]);
4646
```
4747

48-
## 🔗 Route Parameters
48+
## Route Parameters
4949

5050
Validated params are available at `ctx.validated.params`, typed according to your refinements:
5151

docs/backend/development-workflow.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Each source folder serves a specific concern - marketing site, customer app, adm
1313

1414
Yet, development workflow is identical.
1515

16-
## 🚀 Starting the Dev Server
16+
## Starting the Dev Server
1717

1818
```sh
1919
pnpm dev # all source folders
@@ -22,14 +22,14 @@ pnpm dev front # specific folder (front, admin, app, etc.)
2222

2323
Default port is `4556`, configured as `devPort` in `package.json`.
2424

25-
## 🔀 What Happens on Start
25+
## What Happens on Start
2626

2727
1. `Vite` compiles `api/app.ts`
2828
2. Dev server starts, serving both client pages and your API routes
2929
3. Requests are routed between Vite and your API
3030
4. File watcher monitors API files for changes
3131

32-
## ⚙️ api/dev.ts
32+
## api/dev.ts
3333

3434
`api/dev.ts` exposes three hooks for customizing the dev experience.
3535

@@ -101,7 +101,7 @@ export default devSetup({
101101

102102
Without cleanup, frequent rebuilds during active development can exhaust database connections.
103103

104-
## 👀 Inspecting Routes
104+
## Inspecting Routes
105105

106106
Each route returned by `createRoutes` has a `debug` property. Enable it via `DEBUG=api`:
107107

docs/backend/error-handling.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ head:
1212
`KosmoJS` generates `api/errors.ts` file with a working default error handler when you create a source folder.
1313
It's a regular file - customize it freely.
1414

15-
## 📦 Default Error Handler
15+
## Default Error Handler
1616

1717
::: code-group
1818
```ts [Koa: api/errors.ts]
@@ -76,7 +76,7 @@ export default errorHandlerFactory(
7676
The Koa handler is wired into global middleware at `api/use.ts` via `errorHandler` slot.
7777
The Hono handler is wired into `app.onError()` in the `api/app.ts`.
7878

79-
## 🎨 Customization
79+
## Customization
8080

8181
Add logging, monitoring, or structured error responses directly in `api/errors.ts`:
8282

@@ -118,7 +118,7 @@ export default appFactory(({ createApp }) => {
118118
});
119119
```
120120

121-
## 🎯 Route-Level Overrides (Koa)
121+
## Route-Level Overrides (Koa)
122122

123123
Koa supports overriding the error handler per-route or per-subtree via `errorHandler` slot:
124124

@@ -156,7 +156,7 @@ export default [
156156
Hono has a single `app.onError()` for the entire application - branch on `ctx.req.path`
157157
inside the handler if you need route-specific behavior.
158158

159-
## 🔄 Let Handlers Fail
159+
## Let Handlers Fail
160160

161161
Don't wrap handler logic in try-catch. Let errors propagate to the error handler:
162162

@@ -201,7 +201,7 @@ GET(async (ctx) => {
201201
```
202202
:::
203203

204-
## Koa vs Hono - Key Differences
204+
## Koa vs Hono - Key Differences
205205

206206
| | Koa | Hono |
207207
|---|---|---|

docs/backend/intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ head:
1818
Route organization, middleware patterns, and validation are identical between the two.
1919
The difference is the context API inside handlers - each framework has its own.
2020

21-
## 🔧 Defining Endpoints
21+
## Defining Endpoints
2222

2323
Every API route exports a `defineRoute` definition as its default export.
2424
The factory function receives HTTP method builders and `use` for middleware,
@@ -53,14 +53,14 @@ Available builders: `HEAD`, `OPTIONS`, `GET`, `POST`, `PUT`, `PATCH`, `DELETE`.
5353
This method-based routing style draws inspiration from [Sinatra](https://sinatrarb.com/) -
5454
the Ruby framework that pioneered it back in 2007.
5555

56-
## 🛡️ Type Safety
56+
## Type Safety
5757

5858
Parameters, payloads, and responses are all typed through `TypeScript` type arguments -
5959
the same definitions drive both compile-time checking and runtime validation.
6060
No separate schema language, no DSL switching.
6161
([Details ➜ ](/backend/type-safety))
6262

63-
## ▶️ Middleware
63+
## Middleware
6464

6565
The `use` function gives you fine-grained middleware control at the route level,
6666
complementing global and cascading middleware.

docs/backend/middleware.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Beyond the standard HTTP method handlers, you often need to run custom middlewar
1414
code that executes before your main handler to perform tasks like authentication,
1515
logging, or data transformation.
1616

17-
## 🔧 Basic Usage
17+
## Basic Usage
1818

1919
KosmoJS provides the `use` function for applying middleware,
2020
with the same API for both `Koa` and `Hono` routes.
@@ -35,7 +35,7 @@ export default defineRoute<"example">(({ GET, POST, use }) => [
3535
Middleware must call `next()` to pass control to the next layer.
3636
Skipping `next()` short-circuits the chain - useful for early rejections.
3737

38-
## 🔄 Execution Order (Onion Model)
38+
## Execution Order (Onion Model)
3939

4040
Middleware runs in definition order going in, then unwinds in reverse after the handler.
4141

@@ -87,7 +87,7 @@ export default defineRoute(({ use, GET, POST }) => [
8787
]);
8888
```
8989

90-
## 🎯 Method-Specific Middleware
90+
## Method-Specific Middleware
9191

9292
Use the `on` option to restrict middleware to specific HTTP methods:
9393

@@ -110,7 +110,7 @@ export default defineRoute<"example">(({ GET, POST, PUT, DELETE, use }) => [
110110
]);
111111
```
112112

113-
## 🎛️ Slot Composition
113+
## Slot Composition
114114

115115
Slots are named positions in the middleware chain. Middleware with the same slot name
116116
replaces earlier middleware at that position - useful for overriding global defaults per-route.

docs/backend/type-safety.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Type safety in `KosmoJS` covers the full request-response cycle:
1313
path parameters, payloads, responses, and context/state properties -
1414
all driving both compile-time checking and runtime validation from the same type definitions.
1515

16-
## 🔗 Typing Params
16+
## Typing Params
1717

1818
Parameters are strings by default. Refine them via the second type argument to `defineRoute`
1919
by providing a tuple where each position maps to the corresponding parameter in the path:
@@ -51,7 +51,7 @@ defineRoute<"[id]/[action]", Params>
5151
Refinements also generate runtime validation - invalid params are rejected before your handler runs.
5252
([Details ➜ ](/validation/params))
5353

54-
## 🔋 Typing Payload & Response
54+
## Typing Payload & Response
5555

5656
The first type argument to each method handler defines payload and response schemas:
5757

@@ -75,7 +75,7 @@ export default defineRoute<"example">(({ POST }) => [
7575
Both payload and response are validated at runtime, not just at compile time.
7676
([Details ➜ ](/validation/payload))
7777

78-
## 📋 Typing State & Context
78+
## Typing State & Context
7979

8080
`defineRoute` accepts four type arguments:
8181

@@ -136,7 +136,7 @@ export default defineRoute<
136136
If you find yourself declaring the same properties across many routes,
137137
move them to the global declarations in `api/env.d.ts` instead.
138138

139-
## ⚙️ Global Context Types - `api/env.d.ts`
139+
## Global Context Types - `api/env.d.ts`
140140

141141
`api/env.d.ts` extends the default context and state interfaces globally,
142142
so every route handler picks them up automatically:

docs/features.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ head:
1212

1313
Everything `KosmoJS` provides, at a glance.
1414

15-
## 🗂️ Multiple Source Folders
15+
## Multiple Source Folders
1616

1717
Organize distinct concerns - public site, customer app, admin dashboard -
1818
as independent source folders within a single `Vite` project.
1919
Each gets its own set of frameworks, base URL, development workflow and build pipeline.
2020

2121
[Read more ➜](/start#📁-create-your-first-source-folder)
2222

23-
## 🛣️ Directory-Based Routing
23+
## Directory-Based Routing
2424

2525
Your folder structure defines your routes - for both API and client pages.
2626

@@ -41,7 +41,7 @@ files/[name].[ext]/index.ts ➜ files/document.pdf, /files/logo.png
4141

4242
[Read more ➜](/routing/intro)
4343

44-
## Power Syntax for Params
44+
## Power Syntax for Params
4545

4646
When standard named parameters aren't enough, use raw [path-to-regexp v8](https://github.com/pillarjs/path-to-regexp)
4747
patterns directly in your folder names:
@@ -58,7 +58,7 @@ without sacrificing the directory-based routing model.
5858

5959
[Read more ➜](/routing/params#power-syntax)
6060

61-
## 🛡️ End-to-End Type Safety
61+
## End-to-End Type Safety
6262

6363
Write `TypeScript` types once - `KosmoJS` generates runtime validators automatically.
6464
The same definition drives compile-time checking, runtime validation, type-safe fetch clients, and OpenAPI specs.
@@ -81,7 +81,7 @@ export default defineRoute(({ POST }) => [
8181

8282
[Read more ➜](/validation/intro)
8383

84-
## 🔗 Generated Fetch Clients + OpenAPI
84+
## Generated Fetch Clients + OpenAPI
8585

8686
For every API route, `KosmoJS` generates a fully-typed fetch client
8787
and an OpenAPI 3.1 spec - both derived from the same type definitions.
@@ -95,7 +95,7 @@ const user = await fetchClients["users/[id]"].GET([123]);
9595

9696
[Fetch Clients ➜](/fetch/intro) · [OpenAPI ➜](/openapi)
9797

98-
## 🎛️ Composable Middleware (Slots)
98+
## Composable Middleware (Slots)
9999

100100
Global middleware defined in `api/use.ts` can be overridden per-route or per-subtree
101101
using named slots - without removing or bypassing parent middleware entirely.
@@ -114,7 +114,7 @@ Custom slot names are supported by extending the `UseSlots` interface.
114114

115115
[Read more ➜](/backend/middleware)
116116

117-
## 🌊 Cascading Middleware
117+
## Cascading Middleware
118118

119119
Place a `use.ts` file in any folder and its middleware automatically wraps
120120
all routes in that folder and its subfolders - no imports or wiring needed.
@@ -129,7 +129,7 @@ Combine with slots to override globals for entire route subtrees.
129129

130130
[Read more ➜](/backend/cascading-middleware)
131131

132-
## 🪆 Nested Layouts
132+
## Nested Layouts
133133

134134
Frontend pages support nested layout components that wrap child routes -
135135
compose shared UI (nav, sidebars, auth shells) at any level of the route hierarchy.
@@ -147,7 +147,7 @@ pages/
147147

148148
[Read more ➜](/frontend/routing)
149149

150-
## 🎨 Multiple Frameworks
150+
## Multiple Frameworks
151151

152152
**Backend:** `Koa` or `Hono` - same routing architecture, same type safety.
153153
**Frontend:** `React`, `Vue`, `SolidJS`, `MDX` - same routing/layout/SSR conventions.
@@ -159,7 +159,7 @@ Switch frameworks per folder without learning a new set of conventions.
159159

160160
[Read more ➜](/frontend/intro)
161161

162-
## 🔧 Built on Proven Tools
162+
## Built on Proven Tools
163163

164164
No proprietary runtime, no custom bundler, no framework lock-in.
165165
Every layer is a tool you can use, debug, and replace independently.

docs/fetch/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The result is a fully-typed client that mirrors your route definition exactly.
1616
Parameters, payload shape, response type - all derived from the same source.
1717
Change your API, and the client updates with it. No manual sync required.
1818

19-
## 🤖 What Gets Generated
19+
## What Gets Generated
2020

2121
Each route's client module exports:
2222

@@ -33,7 +33,7 @@ exposed for client-side form validation with `check`, `errors`, `errorMessage`,
3333
`errorSummary`, and `validate` methods.
3434
([Details ➜ ](/fetch/validation))
3535

36-
## 🏗️ Using the Generated Client
36+
## Using the Generated Client
3737

3838
Import the fetch map and pick the client for your route by path:
3939

0 commit comments

Comments
 (0)