This commit is contained in:
+11
-11
@@ -1,5 +1,5 @@
|
||||
# bknd starter: Solid Start
|
||||
A minimal example of a Solid Start project with bknd integration.
|
||||
# userbase starter: Solid Start
|
||||
A minimal example of a Solid Start project with userbase integration.
|
||||
|
||||
## Project Structure
|
||||
|
||||
@@ -7,13 +7,13 @@ Inside of your Solid Start project, you'll see the following folders and files:
|
||||
|
||||
```text
|
||||
.
|
||||
├── bknd.config.ts
|
||||
├── userbase.config.ts
|
||||
├── bun.lock
|
||||
├── package.json
|
||||
├── public
|
||||
│ ├── admin # generated by bknd and contains the admin UI
|
||||
│ ├── bknd.ico
|
||||
│ ├── bknd.svg
|
||||
│ ├── admin # generated by userbase and contains the admin UI
|
||||
│ ├── userbase.ico
|
||||
│ ├── userbase.svg
|
||||
│ ├── file.svg
|
||||
│ ├── globe.svg
|
||||
│ ├── solid.svg
|
||||
@@ -29,9 +29,9 @@ Inside of your Solid Start project, you'll see the following folders and files:
|
||||
│ ├── entry-server.tsx
|
||||
│ ├── global.d.ts
|
||||
│ ├── lib
|
||||
│ │ └── bknd.ts # initializes bknd instance
|
||||
│ │ └── userbase.ts # initializes userbase instance
|
||||
│ ├── middleware
|
||||
│ │ └── index.ts # mounts bknd middleware
|
||||
│ │ └── index.ts # mounts userbase middleware
|
||||
│ └── routes
|
||||
│ ├── [...404].tsx
|
||||
│ ├── index.tsx
|
||||
@@ -40,8 +40,8 @@ Inside of your Solid Start project, you'll see the following folders and files:
|
||||
└── vite.config.ts
|
||||
```
|
||||
|
||||
Here is a quick overview about how to adjust the behavior of `bknd`:
|
||||
* Initialization of the `bknd` config with helper functions are located at `src/lib/bknd.ts`
|
||||
Here is a quick overview about how to adjust the behavior of `userbase`:
|
||||
* Initialization of the `userbase` config with helper functions are located at `src/lib/userbase.ts`
|
||||
* Admin UI is rendered using `src/middleware/index.ts`
|
||||
|
||||
## Commands
|
||||
@@ -56,4 +56,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/solid-start) or jump into our [Discord server](https://discord.gg/952SFk8Tb8).
|
||||
Feel free to check [our documentation](https://docs.userbase.io/integration/solid-start) or jump into our [Discord server](https://discord.gg/952SFk8Tb8).
|
||||
@@ -1,6 +1,6 @@
|
||||
import { em, entity, text, boolean } from "bknd";
|
||||
import { secureRandomString } from "bknd/utils";
|
||||
import type { SolidStartBkndConfig } from "bknd/adapter/solid-start";
|
||||
import { em, entity, text, boolean } from "userbase";
|
||||
import { secureRandomString } from "userbase/utils";
|
||||
import type { SolidStartUserbaseConfig } from "userbase/adapter/solid-start";
|
||||
|
||||
const schema = em({
|
||||
todos: entity("todos", {
|
||||
@@ -11,7 +11,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 { }
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ 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",
|
||||
});
|
||||
},
|
||||
@@ -47,5 +47,5 @@ export default {
|
||||
assetsPath: "/admin/",
|
||||
logoReturnPath: "../..",
|
||||
},
|
||||
} satisfies SolidStartBkndConfig;
|
||||
} satisfies SolidStartUserbaseConfig;
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
"build": "vite build",
|
||||
"start": "vite start",
|
||||
"preview": "vite preview",
|
||||
"typegen": "bunx tsx node_modules/.bin/bknd types --outfile bknd-types.d.ts",
|
||||
"postinstall": "bun run bknd copy-assets --out public/admin"
|
||||
"typegen": "bunx tsx node_modules/.bin/userbase types --outfile userbase-types.d.ts",
|
||||
"postinstall": "bun run userbase copy-assets --out public/admin"
|
||||
},
|
||||
"dependencies": {
|
||||
"@solidjs/meta": "^0.29.4",
|
||||
"@solidjs/router": "^1.0.0",
|
||||
"@solidjs/start": "2.0.5",
|
||||
"bknd": "file:../../app",
|
||||
"userbase": "file:../../app",
|
||||
"nitro": "3.0.260903-beta",
|
||||
"solid-js": "^1.9.5",
|
||||
"vite": "^8.3.0"
|
||||
|
||||
@@ -9,7 +9,7 @@ export default function App() {
|
||||
<Router
|
||||
root={props => (
|
||||
<MetaProvider>
|
||||
<Title>Solid Start 🤝 Bknd.io</Title>
|
||||
<Title>Solid Start 🤝 Userbase.io</Title>
|
||||
<Suspense>{props.children}</Suspense>
|
||||
</MetaProvider>
|
||||
)}
|
||||
|
||||
@@ -35,7 +35,7 @@ export function Footer() {
|
||||
</A>
|
||||
<a
|
||||
class="flex items-center gap-2 hover:underline hover:underline-offset-4"
|
||||
href={"https://bknd.io"}
|
||||
href={"https://userbase.io"}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
@@ -46,7 +46,7 @@ export function Footer() {
|
||||
width={16}
|
||||
height={16}
|
||||
/>
|
||||
Go to bknd.io →
|
||||
Go to userbase.io →
|
||||
</a>
|
||||
</footer>
|
||||
);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { getApp as getBkndApp } from "bknd/adapter/solid-start";
|
||||
import bkndConfig from "../../bknd.config";
|
||||
import type { App } from "bknd";
|
||||
import { getApp as getUserbaseApp } from "userbase/adapter/solid-start";
|
||||
import userbaseConfig from "../../userbase.config";
|
||||
import type { App } from "userbase";
|
||||
|
||||
let client: App | null = null;
|
||||
|
||||
export const getApp = async () => {
|
||||
if (!client) {
|
||||
client = await getBkndApp(bkndConfig);
|
||||
client = await getUserbaseApp(userbaseConfig);
|
||||
}
|
||||
return client;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createMiddleware } from "@solidjs/start/middleware";
|
||||
import config from "../../bknd.config";
|
||||
import { serve } from "bknd/adapter/solid-start";
|
||||
import config from "../../userbase.config";
|
||||
import { serve } from "userbase/adapter/solid-start";
|
||||
|
||||
const handler = serve(config);
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { DB } from "bknd";
|
||||
import type { DB } from "userbase";
|
||||
import { For, Suspense } from "solid-js";
|
||||
import { Footer } from "~/components/Footer";
|
||||
import { List } from "~/components/List";
|
||||
import { getApi } from "~/lib/bknd";
|
||||
import { getApi } from "~/lib/userbase";
|
||||
import { action, redirect, useAction, useSubmission } from "@solidjs/router";
|
||||
import { query, createAsync } from "@solidjs/router";
|
||||
|
||||
@@ -67,8 +67,8 @@ export default function Home() {
|
||||
<div class="ml-3.5 mr-2 opacity-70">&</div>
|
||||
<img
|
||||
class="dark:invert"
|
||||
src="/bknd.svg"
|
||||
alt="bknd logo"
|
||||
src="/userbase.svg"
|
||||
alt="userbase logo"
|
||||
width={183}
|
||||
height={59}
|
||||
/>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { A } from "@solidjs/router";
|
||||
import type { DB } from "bknd";
|
||||
import type { DB } from "userbase";
|
||||
import { createResource, Suspense } from "solid-js";
|
||||
import { getRequestEvent } from "solid-js/web";
|
||||
import { Footer } from "~/components/Footer";
|
||||
import { List } from "~/components/List";
|
||||
import { getApi } from "~/lib/bknd";
|
||||
import { getApi } from "~/lib/userbase";
|
||||
|
||||
|
||||
const getUser = async () => {
|
||||
@@ -52,8 +52,8 @@ export default function Home() {
|
||||
<div class="ml-3.5 mr-2 opacity-70">&</div>
|
||||
<img
|
||||
class="dark:invert"
|
||||
src="/bknd.svg"
|
||||
alt="bknd logo"
|
||||
src="/userbase.svg"
|
||||
alt="userbase logo"
|
||||
width={183}
|
||||
height={59}
|
||||
/>
|
||||
@@ -91,7 +91,7 @@ export default function Home() {
|
||||
<p class="text-xs opacity-50">
|
||||
Sign in with:
|
||||
<b>
|
||||
<code>test@bknd.io</code>
|
||||
<code>test@userbase.io</code>
|
||||
</b>
|
||||
/
|
||||
<b>
|
||||
@@ -113,22 +113,22 @@ function Buttons() {
|
||||
<div class="flex gap-4 items-center flex-col sm:flex-row">
|
||||
<a
|
||||
class="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground gap-2 text-white hover:bg-[#383838] dark:hover:bg-[#ccc] dark:text-black text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
|
||||
href="https://bknd.io/"
|
||||
href="https://userbase.io/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
class="grayscale"
|
||||
src="/bknd.ico"
|
||||
alt="bknd logomark"
|
||||
src="/userbase.ico"
|
||||
alt="userbase logomark"
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
Go To Bknd.io
|
||||
Go To Userbase.io
|
||||
</a>
|
||||
<a
|
||||
class="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
|
||||
href="https://docs.bknd.io/start"
|
||||
href="https://docs.userbase.io/start"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user