Files
bknd/docs/integration/introduction.mdx
2025-03-14 15:32:43 +01:00

101 lines
3.1 KiB
Plaintext

---
title: 'Introduction'
description: 'Integrate bknd into your runtime/framework of choice'
---
import { cloudflare, nextjs, reactRouter, astro, bun, node, docker, vite, aws } from "/snippets/integration-icons.mdx"
## Start with a Framework
bknd seamlessly integrates with popular frameworks, allowing you to use what you're already familar with. The following guides will help you get started with your framework of choice.
<CardGroup cols={2}>
<Card
title="Next.js"
icon={<div className="text-primary-light">{nextjs}</div>}
href="/integration/nextjs"
/>
<Card
title="React Router"
icon={<div className="text-primary-light">{reactRouter}</div>}
href="/integration/react-router"
/>
<Card
title="Astro"
icon={<div className="text-primary-light">{astro}</div>}
href="/integration/astro"
/>
<Card
horizontal
title="Yours missing?"
href="https://github.com/bknd-io/bknd/issues/new"
>
Create a new issue to request a guide for your framework.
</Card>
</CardGroup>
## Start with a Runtime
If you prefer to use a runtime instead of a framework, you can choose from the following options. These runtimes allow you to serve the API and UI in the runtime's native server and serve the UI assets statically from `node_modules`.
<CardGroup cols={2}>
<Card
title="Node"
icon={<div className="text-primary-light">{node}</div>}
href="/integration/node"
/>
<Card
title="Bun"
icon={<div className="text-primary-light">{bun}</div>}
href="/integration/bun"
/>
<Card
title="Cloudflare"
icon={<div className="text-primary-light">{cloudflare}</div>}
href="/integration/cloudflare"
/>
<Card
title="AWS Lambda"
icon={<div className="text-primary-light">{aws}</div>}
href="/integration/aws"
/>
<Card
title="Vite"
icon={<div className="text-primary-light">{vite}</div>}
href="/integration/vite"
/>
<Card
title="Docker"
icon={<div className="text-primary-light">{docker}</div>}
href="/integration/docker"
/>
<div style={{ gridColumn: "span 2" }}>
<Card
horizontal
title="Yours missing?"
href="https://github.com/bknd-io/bknd/issues/new"
>
Create a new issue to request a guide for your runtime.
</Card>
</div>
</CardGroup>
## Overview
### Serving the backend (API)
Serve the backend as an API for any JS runtime or framework. The latter is especially handy, as it allows you to deploy your frontend and backend bundled together. Furthermore it allows adding additional logic in a way you're already familar with. Just add another route and you're good to go.
Here is an example of serving the API using node:
```js index.js
import { serve } from "bknd/adapter/node"
serve();
```
### Serving the Admin UI
The admin UI allows to manage your data including full configuration of your backend using a graphical user interface. Using `vite`, your admin route looks like this:
```tsx admin.tsx
import { Admin } from "bknd/ui"
import "bknd/dist/styles.css";
export default function AdminPage() {
return <Admin withProvider />
}
```