diff --git a/.gitignore b/.gitignore
index cb3c79d..32c41f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ count.txt
.vinxi
todos.json
data.db
+public/uploads
\ No newline at end of file
diff --git a/bknd.config.ts b/bknd.config.ts
index 874ecb4..b34aba2 100644
--- a/bknd.config.ts
+++ b/bknd.config.ts
@@ -1,10 +1,39 @@
-import type { NextjsBkndConfig } from "bknd/adapter/nextjs";
+import { type BkndConfig, em, entity, text, boolean } from "bknd";
+
+// Unrelated to framework adapters
+import { registerLocalMediaAdapter } from "bknd/adapter/node";
+
+const local = registerLocalMediaAdapter();
+
+
+// --------------------- SCHEMA -----------------------
+// this just for testing
+const schema = em({
+ todos: entity("todos", {
+ title: text(),
+ done: boolean(),
+ }),
+ post:entity("posts",{
+ title: text(),
+ content: text(),
+ })
+});
+
+// --------------------- SCHEMA END -----------------------
export default {
connection: {
url: "data.db",
},
- options:{
-
- }
-} satisfies NextjsBkndConfig;
\ No newline at end of file
+ options: {},
+ config: {
+ data: schema.toJSON(),
+ auth: { enabled: true },
+ media: {
+ enabled: true,
+ adapter: local({
+ path: "./public/uploads",
+ }),
+ },
+ },
+} satisfies BkndConfig;
diff --git a/src/bknd.ts b/src/bknd.ts
index 3bdac70..7ff907d 100644
--- a/src/bknd.ts
+++ b/src/bknd.ts
@@ -1,8 +1,8 @@
+// Both work just fine
+// import { getApp as getBkndApp } from "bknd/adapter/react-router";
import { getApp as getBkndApp } from "bknd/adapter/nextjs";
import config from "../bknd.config";
-// import { headers } from "next/headers";
-
export async function getApi({
headers,
verify,
@@ -20,5 +20,3 @@ export async function getApi({
return app.getApi();
}
-
-export { config };
diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx
index 1810d79..f4095a8 100644
--- a/src/routes/__root.tsx
+++ b/src/routes/__root.tsx
@@ -1,33 +1,34 @@
-import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
-import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
-import { TanStackDevtools } from '@tanstack/react-devtools'
+import { HeadContent, Scripts, createRootRoute } from "@tanstack/react-router";
+import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
+import { TanStackDevtools } from "@tanstack/react-devtools";
+import { ClientProvider } from "bknd/client";
-import appCss from '../styles.css?url'
+import appCss from "../styles.css?url";
export const Route = createRootRoute({
head: () => ({
meta: [
{
- charSet: 'utf-8',
+ charSet: "utf-8",
},
{
- name: 'viewport',
- content: 'width=device-width, initial-scale=1',
+ name: "viewport",
+ content: "width=device-width, initial-scale=1",
},
{
- title: 'TanStack Start Starter',
+ title: "TanStack Start Starter",
},
],
links: [
{
- rel: 'stylesheet',
+ rel: "stylesheet",
href: appCss,
},
],
}),
shellComponent: RootDocument,
-})
+});
function RootDocument({ children }: { children: React.ReactNode }) {
return (
@@ -36,14 +37,16 @@ function RootDocument({ children }: { children: React.ReactNode }) {