bknd is dead long live userbase
Run Tests / test (pull_request) Successful in 4m57s

This commit is contained in:
2026-09-27 19:34:06 +05:30
parent 05e0086fcd
commit 0bfcb5ad71
529 changed files with 2385 additions and 2924 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
# bknd starter: Astro
A minimal Astro project with bknd integration.
# userbase starter: Astro
A minimal Astro project with userbase integration.
## Project Structure
@@ -19,7 +19,7 @@ Inside of your Astro project, you'll see the following folders and files:
└── package.json
```
To update `bknd` config, check `src/api/[...api].astro` and `src/admin/[...admin].astro`.
To update `userbase` config, check `src/api/[...api].astro` and `src/admin/[...admin].astro`.
## Commands
@@ -36,4 +36,4 @@ All commands are run from the root of the project, from a terminal:
## Want to learn more?
Feel free to check [our documentation](https://docs.bknd.io/integration/astro) or jump into our [Discord server](https://discord.gg/952SFk8Tb8).
Feel free to check [our documentation](https://docs.userbase.io/integration/astro) or jump into our [Discord server](https://discord.gg/952SFk8Tb8).
+9 -9
View File
@@ -1,7 +1,7 @@
import type { AstroBkndConfig } from "bknd/adapter/astro";
import { registerLocalMediaAdapter } from "bknd/adapter/node";
import { boolean, em, entity, text } from "bknd";
import { secureRandomString } from "bknd/utils";
import type { AstroUserbaseConfig } from "userbase/adapter/astro";
import { registerLocalMediaAdapter } from "userbase/adapter/node";
import { boolean, em, entity, text } from "userbase";
import { secureRandomString } from "userbase/utils";
// since we're running in node, we can register the local media adapter
const local = registerLocalMediaAdapter();
@@ -16,7 +16,7 @@ const schema = em({
// register your schema to get automatic type completion
type Database = (typeof schema)["DB"];
declare module "bknd" {
declare module "userbase" {
interface DB extends Database {}
}
@@ -34,7 +34,7 @@ export default {
auth: {
enabled: true,
jwt: {
issuer: "bknd-astro-example",
issuer: "userbase-astro-example",
secret: secureRandomString(64),
},
},
@@ -51,15 +51,15 @@ export default {
seed: async (ctx) => {
// create some entries
await ctx.em.mutator("todos").insertMany([
{ title: "Learn bknd", done: true },
{ title: "Learn userbase", done: true },
{ title: "Build something cool", done: false },
]);
// and create a user
await ctx.app.module.auth.createUser({
email: "test@bknd.io",
email: "test@userbase.io",
password: "12345678",
});
},
},
} as const satisfies AstroBkndConfig;
} as const satisfies AstroUserbaseConfig;
+1 -1
View File
@@ -15,7 +15,7 @@
"@types/react": "^19.0.12",
"@types/react-dom": "^19.0.4",
"astro": "^5.16.9",
"bknd": "file:../../app",
"userbase": "file:../../app",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"typescript": "^5.7.2"
+3 -3
View File
@@ -1,11 +1,11 @@
import type { AstroGlobal } from "astro";
import { getApp as getBkndApp } from "bknd/adapter/astro";
import config from "../bknd.config";
import { getApp as getUserbaseApp } from "userbase/adapter/astro";
import config from "../userbase.config";
export { config };
export async function getApp() {
return await getBkndApp(config);
return await getUserbaseApp(config);
}
export async function getApi(
+1 -1
View File
@@ -31,7 +31,7 @@ const items = [
</nav>
<main>
<div class="center">
<h1>bknd + <span class="text-gradient">Astro</span></h1>
<h1>userbase + <span class="text-gradient">Astro</span></h1>
<slot name="context" />
</div>
@@ -1,8 +1,8 @@
---
import { Admin } from "bknd/ui";
import "bknd/dist/styles.css";
import { Admin } from "userbase/ui";
import "userbase/dist/styles.css";
import { getApi } from "../../bknd";
import { getApi } from "../../userbase";
const api = await getApi(Astro, { verify: true });
const user = api.getUser();
+2 -2
View File
@@ -1,6 +1,6 @@
import type { APIContext } from "astro";
import { serve } from "bknd/adapter/astro";
import { config } from "../../bknd";
import { serve } from "userbase/adapter/astro";
import { config } from "../../userbase";
export const prerender = false;
export const ALL = serve<APIContext>(config);
+1 -1
View File
@@ -1,5 +1,5 @@
---
import { getApi } from "../bknd";
import { getApi } from "../userbase";
import Card from "../components/Card.astro";
import Layout from "../layouts/Layout.astro";
+1 -1
View File
@@ -1,5 +1,5 @@
---
import { getApi } from "../bknd";
import { getApi } from "../userbase";
import Card from "../components/Card.astro";
import Layout from "../layouts/Layout.astro";
const api = await getApi(Astro, { verify: true });