import { sendOtp } from "@/actions/auth-actions"; import { PrismaClient } from "@prisma/client"; import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { phoneNumber } from "better-auth/plugins"; const prisma = new PrismaClient(); export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: "sqlite", // or "mysql", "postgresql", ...etc }), plugins: [ phoneNumber({ sendOTP: async ({ phoneNumber, code }) => { // Implement sending OTP code via SMS console.log("Send OTP in auth.ts", phoneNumber, code); await sendOtp(phoneNumber, code); }, }), ], });