SvelteKit Changes: Session and Cookies

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • sveltekit-auth-cookies

    🍪 SvelteKit authentication using cookies

  • // hook.server.ts import type { Handle } from '@sveltejs/kit'; import { userRepository } from './lib/Redis/dbRepository'; // custom redirect from joy of code `https://github.com/JoysOfCode/sveltekit-auth-cookies/blob/migration/src/hooks.ts` function redirect(location: string, body?: string) { return new Response(body, { status: 303, headers: { location } }); } const unProtectedRoutes: string[] = [ '/', '/login', '/createAdmin', '/features', '/docs', '/deployment' ]; export const handle: Handle = async ({ event, resolve }) => { const session = event.cookies.get('session'); if (!session && !unProtectedRoutes.includes(event.url.pathname)) return redirect('/login', 'No authenticated user.'); const currentUser = await userRepository.fetch(session as string); if (currentUser) { event.locals.user = { isAuthenticated: true, name: currentUser.name, email: currentUser.email, type: currentUser.user_type, active: currentUser.active, phone: currentUser.phone }; } else { if (!unProtectedRoutes.includes(event.url.pathname)) return redirect('/', 'Not a valid user'); } return resolve(event); };

  • OpenCare

    Discontinued Bug Tracking and Project Management

  • The Ether Code Example

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • SvelteKit

    web development, streamlined (by sveltejs)

  • Discussion from Kit for replacing session

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts