v0.15.0
bknd-io/bkndv0.15.0Jul 5, 2025by dswbx
AI Summary
This release introduces native SQLite support across different environments and refactors the connection model, along with new plugin capabilities and app drivers.
Key Highlights
- Native SQLite support for Node 22+, Bun, Deno, and Cloudflare D1
- Refactored and generalized connection model
- Enhanced plugins with schema injection and lifecycle events
- New App Drivers for email and caching
Breaking Changes
- Requires Node.js >= 22
- Hard dependency on LibSQL removed
- Connections must be wrapped in `libsql()` for explicit LibSQL usage
New Features
- Native SQLite
- Plugin schema injection
- Plugin lifecycle hooks
- App drivers (Resend, MailChannels, AWS SES, LRU Cache, Cloudflare KV)
Full Release Notes
## ⚠️ Native SQLite and unified connections (https://github.com/bknd-io/bknd/pull/186, https://github.com/bknd-io/bknd/pull/188, https://github.com/bknd-io/bknd/pull/193)
> [!WARNING]
> This is a breaking change, it requires Node.js >= 22, and for non-edge environments to explicitly use the `libsql` function to continue using LibSQL
Previously there was a hard dependency to LibSQL. While it's still recommended and supported as a first-party, bknd will now use the built-in SQLite implementation depending on your environment:
* Node: uses `node:sqlite` – this now requires Node.js >= 22, the current LTS
* Bun: uses `bun:sqlite`
* Deno: uses `node:sqlite`
* Cloudflare: uses D1
To make this maintainable, the connections and especially the SQLite connections have been refactored and generalized. To explicitly use LibSQL as the connection, wrap the connection object around `libsql`:
```ts
// bknd.config.ts
import { libsql } from "bknd/data";
export default {
connection: libsql({ url: "<url>", authToken: "<token>" })
}
```
## Improved plugins (https://github.com/bknd-io/bknd/pull/187)
Plugins got a massive update to allow them to become a lot more powerful. They can now supply additional schema required for the plugin to work, as well as inject into app lifecycle events. To start off, there are a few useful plugins added. E.g. you can now automatically sync your types every time you update your schema:
```ts
// bknd.config.ts
import type { BkndConfig } from "bknd";
import { showRoutes, syncTypes } from "bknd/plugins";
export default {
options: {
plugins: [
// console logs a list of registered routes the first time the app boots
showRoutes({ once: true }),
// writes down the schema types on boot and config change
syncTypes({
enabled: true,
write: async (et) => {
// customize the location and the writer
await Bun.write("bknd-types.d.ts", et.toString());
},
}),
],
},
} as const satisfies BkndConfig;
```
Docs on how to create your own plugins will follow soon, but you can take a look at it [here](https://github.com/bknd-io/bknd/pull/187).
## App drivers (https://github.com/bknd-io/bknd/pull/190)
Unlike adapters (e.g. for storage, or authentication), app drivers can be defined before initialization without the ability to modify them in the UI. Drivers can be used to send emails, or to cache assets.
```ts
// bknd.config.ts
import type { BkndConfig } from "bknd";
import { resendEmail, memoryCache } from "bknd/core";
export default {
options: {
drivers: {
email: resendEmail({ apiKey: "..." }),
cache: memoryCache(),
},
},
} as const satisfies BkndConfig;
```
Currently there are a few built-in drivers available, such as:
* email: Resend, MailChannels, AWS SES
* cache: in-memory (LRU), Cloudflare KV
It's very straightforward to add your own driver, docs will follow soon. Read more about it [here](https://github.com/bknd-io/bknd/pull/190) if you're curious.
## Other Changes
* admin: add options such as logo return path when served static by @dswbx in https://github.com/bknd-io/bknd/pull/191
* fix cloudflare r2 adapter range requests by @dswbx in https://github.com/bknd-io/bknd/pull/195
* Update docker.mdx by @stormbyte in https://github.com/bknd-io/bknd/pull/194
## New Contributors
* @stormbyte made their first contribution in https://github.com/bknd-io/bknd/pull/194
**Full Changelog**: https://github.com/bknd-io/bknd/compare/v0.14.0...v0.15.0