Loading...
Loading...
[Pragmatic DDD Architecture] Guide for Authentication configuration and the `auth` Bounded Context. Use when modifying auth flows, adding social providers, configuring email templates/Resend, working with the Better Auth client/server configurations, or modifying `src/auth/` components and components dependent on session handling.
npx skill4agent add leif-sync/pragmatic-ddd authauth.tsauth-client.tscreateAuthClient"use client"signIn.magicLinkgetSession.tsauth.tsauth.tsdrizzleAdaptersrc/shared/infrastructure/postgres/schema.tsdrizzle-postgres/advanced: {
generateId: false, // Let Postgres/Drizzle default generate the UUIDv7
}
// or if strictly handled within the library:
advanced: {
database: {
generateId: "uuid", // Assuming standard UUID mapping
}
}GOOGLE_CLIENT_IDRESEND_API_KEYsrc/shared/infrastructure/load-env.tsprocess.envmagicLinkemailOTPreact-emailmagicLinkemailOTPresendauth.ts@react-email/components<Html><Head><Button>https://better-auth.com/docs/authentication/googleGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET.envsrc/shared/infrastructure/load-env.tsimport { auth } from "@/auth/auth";
import { headers } from "next/headers";
// Inside the server action
const session = await auth.api.getSession({ headers: await headers() });
if (!session) {
return { success: false, error: "UNAUTHORIZED" };
}import { auth } from "@/auth/auth";
import { headers } from "next/headers";
const session = await auth.api.getSession({ headers: await headers() });auth-client.tsuseSession()Better AuthParamsauth.api.getSession()session.user.idserviceContainer.module.useCase.execute({ userId: session.user.id, ...params })drizzleAdaptermagicLinkemailOTP