mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 16:46:00 +00:00
Refactor web adapter to universal adapter
Rename the web adapter to universal adapter to better reflect its framework-agnostic nature. This change involves updating package.json, file paths, and documentation.
This commit is contained in:
@@ -1,12 +1,3 @@
|
||||
{
|
||||
"pages": [
|
||||
"nextjs",
|
||||
"react-router",
|
||||
"astro",
|
||||
"sveltekit",
|
||||
"tanstack-start",
|
||||
"web",
|
||||
"vite",
|
||||
"nuxt"
|
||||
]
|
||||
"pages": ["nextjs", "react-router", "astro", "sveltekit", "tanstack-start", "universal", "vite", "nuxt"]
|
||||
}
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
---
|
||||
title: "Web Adapter"
|
||||
title: "Universal Adapter"
|
||||
description: "Bring bknd to any web framework or runtime"
|
||||
tags: ["documentation"]
|
||||
---
|
||||
|
||||
## What is the Web Adapter?
|
||||
## What is the Universal Adapter?
|
||||
|
||||
The web adapter (`bknd/adapter/web`) is a framework/runtime agnostic adapter which can integrate `bknd` into **any** web framework or runtime — even ones without a dedicated adapter.
|
||||
The universal adapter (`bknd/adapter/universal`) is a framework/runtime agnostic adapter which can integrate `bknd` into **any** web framework or runtime — even ones without a dedicated adapter.
|
||||
|
||||
**Use the web adapter when:**
|
||||
**Use the universal adapter when:**
|
||||
- Your framework doesn't have a dedicated bknd adapter
|
||||
- You want full control over your server setup
|
||||
- You're building a custom server or edge function
|
||||
@@ -44,7 +44,7 @@ bun add bknd
|
||||
Start by creating a config file:
|
||||
|
||||
```typescript title="bknd.config.ts"
|
||||
import type { Config } from "bknd/adapter/web";
|
||||
import type { Config } from "bknd/adapter/universal";
|
||||
|
||||
export default {
|
||||
connection: {
|
||||
@@ -60,7 +60,7 @@ Use `Config<"api">` when you are using a React-based framework otherwise use `Co
|
||||
|
||||
### Helper Singleton
|
||||
```typescript title="lib/bknd.ts"
|
||||
import { createBknd } from "bknd/adapter/web";
|
||||
import { createBknd } from "bknd/adapter/universal";
|
||||
import config from "../bknd.config";
|
||||
|
||||
export const bknd = createBknd({ mode: "standalone", options: config }, process.env);
|
||||
@@ -112,7 +112,7 @@ No server-side admin configuration needed. The admin UI runs entirely in the bro
|
||||
For non-React frameworks or standalone servers, enable the admin controller:
|
||||
|
||||
```typescript title="src/bknd.ts"
|
||||
import { createBknd } from "bknd/adapter/web";
|
||||
import { createBknd } from "bknd/adapter/universal";
|
||||
import config from "../bknd.config";
|
||||
|
||||
export const bknd = createBknd({ mode: "standalone", options: config }, env);
|
||||
@@ -128,7 +128,7 @@ You'll also need to serve the admin's static assets (JS, CSS). Choose one of thr
|
||||
Use Hono's platform-specific `serveStatic` in `bknd.config.ts` to serve assets from `node_modules/bknd/dist/static/`:
|
||||
|
||||
```typescript title="bknd.config.ts"
|
||||
import type { Config } from "bknd/adapter/web";
|
||||
import type { Config } from "bknd/adapter/universal";
|
||||
import { serveStatic } from "hono/bun"; // or "@hono/node-server/serve-static"
|
||||
|
||||
export default {
|
||||
@@ -173,7 +173,7 @@ Per-framework output paths:
|
||||
For environments without filesystem access:
|
||||
|
||||
```typescript title="bknd.config.ts"
|
||||
import type { Config } from "bknd/adapter/web";
|
||||
import type { Config } from "bknd/adapter/universal";
|
||||
import { serveStaticViaImport } from "bknd/adapter";
|
||||
|
||||
export default {
|
||||
@@ -274,4 +274,4 @@ export type Config<T extends AdapterModeWithOptions["mode"]> = Extract<
|
||||
Parameters<typeof createBknd>[0],
|
||||
{ mode: T }
|
||||
>['options'];
|
||||
```
|
||||
```
|
||||
@@ -45,10 +45,10 @@ bknd seamlessly integrates with popular frameworks, allowing you to use what you
|
||||
href="/integration/nuxt"
|
||||
/>
|
||||
|
||||
<Card
|
||||
icon={<Icon icon="tabler:world" className="text-fd-primary !size-6" />}
|
||||
title="Web Adapter"
|
||||
href="/integration/web"
|
||||
<Card
|
||||
icon={<Icon icon="tabler:world" className="text-fd-primary !size-6" />}
|
||||
title="Universal Web Adapter"
|
||||
href="/integration/universal"
|
||||
/>
|
||||
|
||||
<Card title="Yours missing?" href="https://github.com/bknd-io/bknd/issues/new">
|
||||
|
||||
@@ -168,10 +168,10 @@ Pick your framework or runtime to get started.
|
||||
href="/integration/aws"
|
||||
/>
|
||||
|
||||
<Card
|
||||
icon={<Icon icon="tabler:world" className="text-fd-primary !size-6" />}
|
||||
title="Web Adapter"
|
||||
href="/integration/web"
|
||||
<Card
|
||||
icon={<Icon icon="tabler:world" className="text-fd-primary !size-6" />}
|
||||
title="Universal Web Adapter"
|
||||
href="/integration/universal"
|
||||
/>
|
||||
|
||||
<Card
|
||||
|
||||
Reference in New Issue
Block a user