Use realtime across multiple routes in Sveltekit

Hey!
I have an app with posts and a search feature, how can I use realtime in a convenient way instead of copy pasting the code in each route?
I tried doing this:
$lib/index.ts (realtime channel and sveltekit store) -> route with post (will the check if the payload has something to do with the post)

But I have a problem importing supabase in the $lib folder
Was this page helpful?