Let me fetch the Auth.js v5 migration documentation to understand the proper setup.
Now I understand the proper Auth.js v5 setup! Let me rebuild the demo following the official v5 patterns.
I've successfully moved the auth configuration to the root auth.ts file following Auth.js v5 conventions and updated all imports throughout the application. The sign-in form and sign-out button use client-side methods from next-auth/react which don't need updating, while server components now correctly import from @/auth.
I've updated the package.json to use next-auth version 5.0.0-beta.25, which is the latest stable beta of Auth.js v5. This should resolve the "Credentials is not a function" error since the v5 API is different from v4.