SvelteKitError: Not found: /api/auth/sign-up/email

I'm using SvelteKit, and I encounter the following error when trying to sign up with email:
SvelteKitError: Not found: /api/auth/sign-up/email.
I have hooks.server.ts inside the src folder, and auth.ts and auth-client.ts inside lib. How can I fix this?
Screenshot_2025-03-17_120257.png
Solution
I implemented it in Sveltekit like this

hooks.server.ts
import type { Handle, RequestEvent } from '@sveltejs/kit';
import { auth } from '$lib/auth';
import { svelteKitHandler } from 'better-auth/svelte-kit';

export const handle: Handle = async ({ event, resolve }) => {
  return svelteKitHandler({ event, resolve, auth });
};
Was this page helpful?