diff --git a/docs/content/docs/(documentation)/modules/auth.mdx b/docs/content/docs/(documentation)/modules/auth.mdx
index 3060578..a3b5a89 100644
--- a/docs/content/docs/(documentation)/modules/auth.mdx
+++ b/docs/content/docs/(documentation)/modules/auth.mdx
@@ -4,6 +4,12 @@ description: "Easily implement reliable authentication strategies."
tags: ["documentation"]
---
+
+ Check back soon — or stay updated on our progress on
+ [GitHub](https://github.com/bknd-io/bknd) and join the conversation in
+ [Discord](https://discord.gg/952SFk8Tb8).
+
+
Authentication is essential for securing applications, and **bknd** provides a straightforward approach to implementing robust strategies.
### **Core Features**
diff --git a/docs/content/docs/(documentation)/modules/data.mdx b/docs/content/docs/(documentation)/modules/data.mdx
index 728d9a9..72e062f 100644
--- a/docs/content/docs/(documentation)/modules/data.mdx
+++ b/docs/content/docs/(documentation)/modules/data.mdx
@@ -4,6 +4,12 @@ description: "Define, query, and control your data with ease."
tags: ["documentation"]
---
+
+ Check back soon — or stay updated on our progress on
+ [GitHub](https://github.com/bknd-io/bknd) and join the conversation in
+ [Discord](https://discord.gg/952SFk8Tb8).
+
+
Data is the lifeblood of any application, and **bknd** provides the tools to handle it effortlessly. From defining entities to executing complex queries, bknd offers a developer-friendly, intuitive, and powerful data management experience.
### **Define Your Data**
diff --git a/docs/content/docs/(documentation)/modules/media.mdx b/docs/content/docs/(documentation)/modules/media.mdx
index 7edecb2..40b89a0 100644
--- a/docs/content/docs/(documentation)/modules/media.mdx
+++ b/docs/content/docs/(documentation)/modules/media.mdx
@@ -4,6 +4,12 @@ description: "Effortlessly manage and serve all your media files."
tags: ["documentation"]
---
+
+ Check back soon — or stay updated on our progress on
+ [GitHub](https://github.com/bknd-io/bknd) and join the conversation in
+ [Discord](https://discord.gg/952SFk8Tb8).
+
+
**bknd** provides a flexible and efficient way to handle media files, making it easy to upload, manage, and deliver content across various platforms.
### **Core Features**
@@ -36,13 +42,13 @@ There are two ways to enable S3 or S3 compatible storage in bknd.
2. Enable programmatically.
- To enable using a code-first approach, create an [Initial Structure](/usage/database#initial-structure) using the `initialConfig` option in your `bknd.config.ts` file.
+ To enable using a code-first approach, create corresponding configuration using the `config` option in your `bknd.config.ts` file.
```typescript title="bknd.config.ts"
import type { BkndConfig } from "bknd/adapter";
export default {
- initialConfig: {
+ config: {
media: {
enabled: true,
adapter: {
@@ -70,7 +76,7 @@ import type { BkndConfig } from "bknd/adapter";
const local = registerLocalMediaAdapter();
export default {
- initialConfig: {
+ config: {
media: {
enabled: true,
adapter: local({
diff --git a/docs/content/docs/(documentation)/modules/overview.mdx b/docs/content/docs/(documentation)/modules/overview.mdx
index 2eec497..bedaccb 100644
--- a/docs/content/docs/(documentation)/modules/overview.mdx
+++ b/docs/content/docs/(documentation)/modules/overview.mdx
@@ -6,6 +6,12 @@ tags: ["documentation"]
import { Icon } from "@iconify/react";
+
+ Check back soon — or stay updated on our progress on
+ [GitHub](https://github.com/bknd-io/bknd) and join the conversation in
+ [Discord](https://discord.gg/952SFk8Tb8).
+
+
This backend system focuses on 4 essential building blocks which can be tightly connected:
Data, Auth, Media and Flows.
The main idea is to supply all baseline functionality required in order to accomplish complex
diff --git a/docs/content/docs/(documentation)/usage/cli.mdx b/docs/content/docs/(documentation)/usage/cli.mdx
index daa3303..72b46f5 100644
--- a/docs/content/docs/(documentation)/usage/cli.mdx
+++ b/docs/content/docs/(documentation)/usage/cli.mdx
@@ -274,6 +274,7 @@ sync database
Options:
-c, --config config file
--db-url database url, can be any valid sqlite url
+ --seed perform seeding operations
--force perform database syncing operations
--drop include destructive DDL operations
--out output file
diff --git a/docs/content/docs/(documentation)/usage/database.mdx b/docs/content/docs/(documentation)/usage/database.mdx
index b714ada..9a2fe11 100644
--- a/docs/content/docs/(documentation)/usage/database.mdx
+++ b/docs/content/docs/(documentation)/usage/database.mdx
@@ -314,15 +314,11 @@ const connection = new CustomConnection();
const app = createApp({ connection });
```
-## Initial Structure
+## Data Structure
-To provide an initial database structure, you can pass `initialConfig` to the creation of an app. This will only be used if there isn't an existing configuration found in the database given. Here is a quick example:
-
-
- The initial structure is only respected if the database is empty! If you made
- updates, ensure to delete the database first, or perform updates through the
- Admin UI.
-
+To provide a database structure, you can pass `config` to the creation of an app. In [`db` mode](/usage/introduction#ui-only-mode), the data structure is only respected if the database is empty. If you made updates, ensure to delete the database first, or perform updates through the Admin UI.
+
+Here is a quick example:
```typescript
import { createApp, em, entity, text, number } from "bknd";
@@ -367,10 +363,7 @@ type Database = (typeof schema)["DB"];
// pass the schema to the app
const app = createApp({
- connection: {
- /* ... */
- },
- initialConfig: {
+ config: {
data: schema.toJSON(),
},
});
@@ -473,7 +466,7 @@ const schema = em(
To get type completion, there are two options:
-1. Use the CLI to [generate the types](/usage/cli#generating-types-types)
+1. Use the CLI to [generate the types](/usage/cli#generating-types-types) (recommended)
2. If you have an initial structure created with the prototype functions, you can extend the `DB` interface with your own schema.
All entity related functions use the types defined in `DB` from `bknd`. To get type completion, you can extend that interface with your own schema:
@@ -482,18 +475,14 @@ All entity related functions use the types defined in `DB` from `bknd`. To get t
import { em } from "bknd";
import { Api } from "bknd/client";
-const schema = em({
- /* ... */
-});
+const schema = em({ /* ... */ });
type Database = (typeof schema)["DB"];
declare module "bknd" {
interface DB extends Database {}
}
-const api = new Api({
- /* ... */
-});
+const api = new Api({ /* ... */ });
const { data: posts } = await api.data.readMany("posts", {});
// `posts` is now typed as Database["posts"]
```
@@ -505,21 +494,13 @@ The type completion is available for the API as well as all provided [React hook
To seed your database with initial data, you can pass a `seed` function to the configuration. It
provides the `ModuleBuildContext` as the first argument.
-
- Note that the seed function will only be executed on app's first boot. If a
- configuration already exists in the database, it will not be executed.
-
```typescript
import { createApp, type ModuleBuildContext } from "bknd";
const app = createApp({
- connection: {
- /* ... */
- },
- initialConfig: {
- /* ... */
- },
+ connection: { /* ... */ },
+ config: { /* ... */ },
options: {
seed: async (ctx: ModuleBuildContext) => {
await ctx.em.mutator("posts").insertMany([
@@ -530,3 +511,13 @@ const app = createApp({
},
});
```
+
+Note that in [`db` mode](/usage/introduction#ui-only-mode), the seed function will only be executed on app's first boot. If a configuration already exists in the database, it will not be executed.
+
+In [`code` mode](/usage/introduction#code-only-mode), the seed function will not be automatically executed. You can manually execute it by running the following command:
+
+```bash
+npx bknd sync --seed --force
+```
+
+See the [sync command](/usage/cli#syncing-the-database-sync) documentation for more details.
diff --git a/docs/content/docs/(documentation)/usage/mcp/overview.mdx b/docs/content/docs/(documentation)/usage/mcp/overview.mdx
index 32f4354..03b1e03 100644
--- a/docs/content/docs/(documentation)/usage/mcp/overview.mdx
+++ b/docs/content/docs/(documentation)/usage/mcp/overview.mdx
@@ -28,13 +28,13 @@ Once enabled, you can access the MCP UI at `/mcp`, or choose "MCP" from the top
## Enable MCP
-If you're using `initialConfig`, you can enable the MCP server by setting the `server.mcp.enabled` property to `true`.
+If you're using a `config`, you can enable the MCP server by setting the `server.mcp.enabled` property to `true`.
```typescript
import type { BkndConfig } from "bknd";
export default {
- initialConfig: {
+ config: {
server: {
mcp: {
enabled: true,
diff --git a/examples/node/index.js b/examples/node/index.js
index 1464017..46e319f 100644
--- a/examples/node/index.js
+++ b/examples/node/index.js
@@ -9,7 +9,7 @@ const config = {
connection: {
url: "file:data.db",
},
- initialConfig: {
+ config: {
media: {
enabled: true,
adapter: {
diff --git a/examples/react/src/App.tsx b/examples/react/src/App.tsx
index d72cfb5..b933893 100644
--- a/examples/react/src/App.tsx
+++ b/examples/react/src/App.tsx
@@ -87,7 +87,7 @@ async function setup(opts?: {
const app = App.create({
connection,
// an initial config is only applied if the database is empty
- initialConfig: {
+ config: {
data: schema.toJSON(),
},
options: {