Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the authentication and database handling mechanisms in the project. The main changes involve replacing the
better-auth
package with@auth/sveltekit
and@auth/kysely-adapter
, updating the database schema, and refactoring the code to accommodate these changes.Authentication and Authorization Updates:
.env.example
: Updated the environment variable name fromBETTER_AUTH_SECRET
toAUTH_SECRET
.src/lib/hooks/h0_auth.ts
: Replacedbetter-auth/svelte-kit
with@auth/sveltekit
and@auth/kysely-adapter
for handling authentication.src/lib/auth-client.ts
: Removed the oldbetter-auth
client implementation.src/routes/+page.svelte
: Updated the sign-in and sign-out functions to use@auth/sveltekit/client
.Database and Schema Changes:
src/server/db/migrations/1732442418885_0-start.ts
: Updated the database schema to align with the new authentication system, including creating new tables forAccount
,Session
,User
, andVerificationToken
.src/server/db/types/schema.prisma
: Modified the Prisma schema to reflect the new database structure.src/server/db/index.ts
: Updated the database connection to use the new environment variableenv.DB_URL
.Code Refactoring:
src/hooks.server.ts
: Added a new hookh1LocalsPopulation
to populate user session information.src/lib/hooks/h1_locals_population.ts
: Implemented the new hook to populate user session information using theAuthService
.src/server/services/AuthService.ts
: Added a method to populate user session information and handle database errors.Error Handling:
src/server/errors/DbError.ts
: Introduced a newDbError
class for handling database-related errors.src/server/errors/AuthenticationError.ts
: Added acode
property to theAuthenticationError
class.