mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
82 lines
2.1 KiB
Handlebars
82 lines
2.1 KiB
Handlebars
{{#if (eq orm "prisma")}}
|
|
import { betterAuth } from "better-auth";
|
|
import { prismaAdapter } from "better-auth/adapters/prisma";
|
|
{{#if (includes frontend "native")}}
|
|
import { expo } from "@better-auth/expo";
|
|
{{/if}}
|
|
import prisma from "../../prisma";
|
|
|
|
export const auth = betterAuth({
|
|
database: prismaAdapter(prisma, {
|
|
{{#if (eq database "postgres")}}provider: "postgresql"{{/if}}
|
|
{{#if (eq database "sqlite")}}provider: "sqlite"{{/if}}
|
|
{{#if (eq database "mysql")}}provider: "mysql"{{/if}}
|
|
}),
|
|
trustedOrigins: [
|
|
process.env.CORS_ORIGIN || "",{{#if (includes frontend "native")}}
|
|
"my-better-t-app://",{{/if}}
|
|
],
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
}
|
|
|
|
{{~#if (includes frontend "native")}}
|
|
,
|
|
plugins: [expo()]
|
|
{{/if~}}
|
|
});
|
|
{{/if}}
|
|
|
|
{{#if (eq orm "drizzle")}}
|
|
import { betterAuth } from "better-auth";
|
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
{{#if (includes frontend "native")}}
|
|
import { expo } from "@better-auth/expo";
|
|
{{/if}}
|
|
import { db } from "../db";
|
|
import * as schema from "../db/schema/auth";
|
|
|
|
export const auth = betterAuth({
|
|
database: drizzleAdapter(db, {
|
|
{{#if (eq database "postgres")}}provider: "pg",{{/if}}
|
|
{{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
|
|
{{#if (eq database "mysql")}}provider: "mysql",{{/if}}
|
|
schema: schema,
|
|
}),
|
|
trustedOrigins: [
|
|
process.env.CORS_ORIGIN || "",{{#if (includes frontend "native")}}
|
|
"my-better-t-app://",{{/if}}
|
|
],
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
}
|
|
|
|
{{~#if (includes frontend "native")}}
|
|
,
|
|
plugins: [expo()]
|
|
{{/if~}}
|
|
});
|
|
{{/if}}
|
|
|
|
{{#if (eq orm "none")}}
|
|
import { betterAuth } from "better-auth";
|
|
{{#if (includes frontend "native")}}
|
|
import { expo } from "@better-auth/expo";
|
|
{{/if}}
|
|
|
|
export const auth = betterAuth({
|
|
database: "", // Invalid configuration
|
|
trustedOrigins: [
|
|
process.env.CORS_ORIGIN || "",{{#if (includes frontend "native")}}
|
|
"my-better-t-app://", // Use hardcoded scheme{{/if}}
|
|
],
|
|
emailAndPassword: {
|
|
enabled: true,
|
|
}
|
|
|
|
{{~#if (includes frontend "native")}}
|
|
,
|
|
plugins: [expo()]
|
|
{{/if~}}
|
|
});
|
|
{{/if}} |