initial commit
This commit is contained in:
commit
33e75c056f
77 changed files with 4329 additions and 0 deletions
33
packages/auth/src/index.ts
Normal file
33
packages/auth/src/index.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { createDb } from "@minmon/db";
|
||||
import * as schema from "@minmon/db/schema/auth";
|
||||
import { env } from "@minmon/env/server";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
|
||||
export function createAuth() {
|
||||
const db = createDb();
|
||||
|
||||
return betterAuth({
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
|
||||
schema: schema,
|
||||
}),
|
||||
trustedOrigins: [env.CORS_ORIGIN],
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
secret: env.BETTER_AUTH_SECRET,
|
||||
baseURL: env.BETTER_AUTH_URL,
|
||||
advanced: {
|
||||
defaultCookieAttributes: {
|
||||
sameSite: "none",
|
||||
secure: true,
|
||||
httpOnly: true,
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
});
|
||||
}
|
||||
|
||||
export const auth = createAuth();
|
||||
Loading…
Add table
Add a link
Reference in a new issue