🚧 Breaking changes
Data API Endpoint changed #83
Data Entity API routes are now prefixed with /entity
– this is required to add more data API routes without conflicting with entity names. If you were using HTTP endpoints, change as follows:
-[...]/api/data/posts?[...]
+[...]/api/data/entity/posts?[...]
If you were using the Admin Panel or the included SDK, there is no change required.
Module Manager Configuration relocation #85
If you were creating an app using module manager options, these have moved now in order to allow future app configuration options.
const app = createApp({
connection: { /* ... */ },
initialConfig: { /* ... */ },
{
- /* ... manager options ... */
- verbosity: 2
+ manager: {
+ /* ... manager options ... */
+ verbosity: 2
+ }
}
});
🚀 New Features
The CLI now includes project starters! #79
v0.8_cli_create.mp4
To start off a new project with bknd, you can run (in the video you see a different command, it was recorded during development):
npx bknd create
Currently these starters are available: Node.js, Bun, Cloudflare, Next.js, Remix and Astro. There will be more in the future! It's also planned to include community built templates.
Connection is now set to libsql
by default #77
You can now omit the type
for the connection object, since it's all libsql by default. Custom connections must be used with Connection
instances directly. Adding the type of libsql
is still supported but will be removed in future releases.
serve({
connection: {
- type: "libsql",
- config: {
- url: "..."
- }
+ url: "..."
}
});
Added Cloudflare D1 and R2 bindings #73
If you're using the Cloudflare adapter, you can now use D1 as your database and R2 binding for media assets. The adapter automatically scans your environment for D1 and R2 bindings:
- if you haven't specified any connection, it uses the first D1 binding it finds
- you can manually specify a D1 binding using the
binding
option - if you want to use LibSQL instead, you can define a connection object
import { serve, d1 } from "bknd/adapter/cloudflare";
// scans your environment for the first D1 binding it finds
export default serve();
// manually specifying a D1 binding:
export default serve<Env>({
app: ({ env }) => d1({ binding.your_d1_binding })
});
// or specify binding using `bindings`
export default serve<Env>({
bindings: ({ env }) => ({ db: env.your_d1_binding })
});
// or use LibSQL
export default serve<Env>({
app: ({ env }) => ({ url: env.DB_URL })
});
R2 bindings are also automatically discovered and offered as selection choices when configuring an adapter in UI:
Media API improvements #80
Previously, there wasn't a way of using the API to upload media assets. That has changed! And since you may not know in which situation you need a file to be uploaded, you can literally pass any argument to the upload handler for it to land on bknd:
// via external url
api.media.upload("https://example.com/image.png", "image.png");
// via request
api.media.upload(fetch("https://example.com/image.png"), "image.png");
// via response
api.media.upload(await fetch("https://example.com/image.png"), "image.png");
// via readable stream
api.media.upload((await fetch("https://example.com/image.png")).body, "image.png");
// via file input
<input type="file" onChange={async (e) => {
const file = e.target.files?.[0];
if (file) {
// file name not required, as it can be extracted from `File`
await api.upload(file);
}
}} />
Configuration changes now run in sandbox first #76
If you make any configuration change like adding an entity, enabling auth, or changing the theme: Configuration changes now run sandboxed before they get applied and stored. If it fails, the previous (well, actually "current") state is kept and continued.
CLI now checks env
#78
Previously, to run bknd using the CLI, you had to specify the --db-url
(and --db-token
) in order to point to your instance. You can still do this, but if these options aren't present, the CLI now checks for DB_URL
and DB_TOKEN
environment variables (let me know if you encounter any conflicts with the name, we could also prefix them with BKND_*
).
Instead of running:
npx bknd run --db-url file:data.db
You can now create an .env
file, and start it directly:
DB_URL=file:data.db
npx bknd run
This will be especially useful for future commands which lets you directly interact with your app without a GUI.
CLI prefers a database file by default #86
Previously, if you ran npx bknd run
without any argument, it was launching with an in-memory database. Now instead, it creates a database using a data.db
file in the directly where you run the command. This is more intuitive. You can still choose an in-memory database by running npx bknd run --memory
.
Other Changes
- fixing ui modal styling and make sure schema reloads on media setting changes by @dswbx in #74
- moved auth ctx to request context by @dswbx in #81
- add admin "system" theme option that checks user prefs by @dswbx in #82
- added debug routes cli action by @dswbx in #84
- fix persisting of many to many entity by @dswbx in #87
- refactor/improve-remix-example by @dswbx in #88
Full Changelog: v0.7.1...v0.8.0