created simple auth system using betterauth

This commit is contained in:
averel10
2026-02-27 14:36:27 +01:00
parent 0285cf0956
commit cc1c904167
17 changed files with 1120 additions and 3 deletions

5
src/lib/auth-client.ts Normal file
View File

@@ -0,0 +1,5 @@
import { createAuthClient } from "better-auth/react"
export const authClient = createAuthClient({
/** The base URL of the server (optional if you're using the same domain) */
baseURL: "http://localhost:3000"
})

18
src/lib/auth.ts Normal file
View File

@@ -0,0 +1,18 @@
import { betterAuth } from "better-auth";
import Database from "better-sqlite3";
import { localization } from "better-auth-localization";
export const auth = betterAuth({
database: new Database("./sqlite_users.db"),
emailAndPassword: {
enabled: true,
},
plugins: [
localization({
defaultLocale: "de-DE", // Default to German
fallbackLocale: "default" // Fallback to English
})
]
});