Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@macfja/sveltekit-session

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@macfja/sveltekit-session

Session management for SvelteKit

  • 1.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

SvelteKit Session

Session management for SvelteKit

Github CI GitHub Repo stars NPM bundle size Download per week License NPM version Snyk Vulnerabilities for npm package

Installation

npm install @macfja/sveltekit-session

Usage

// src/hooks.server.ts
import type { Handle } from "@sveltejs/kit";
import { serverHook } from "@macfja/sveltekit-session";

export const handle: Handle = serverHook;
// src/routes/.../+page.server.ts
import type { PageServerLoad } from "./$types";
import { serverLoad } from "@macfja/sveltekit-session";

export const load: PageServerLoad = serverLoad;
// src/routes/.../+page.ts
import type { PageLoad } from "./$types";
import { error } from "@sveltejs/kit";

export const load: PageLoad = ({ data }) => {
  const session = data?.session;
  return {
    session,
  };
};

Features

  • Multiple session storages (Server memory, server file system, cookies, Redis)
  • Multiple session identifier exchanger (cookie, header)
  • Automatically save the session upon changes

Limitations

Changes on the session can only be done at server side

If you want changes made in +page.svelte to be saved, you need to send the data to the server (+page.server.js/+page.server.ts)

Documentation

Documentations and examples can be found in the docs directory.

Contributing

Contributions are welcome. Please open up an issue or create PR if you would like to help out.

Read more in the Contributing file

License

The MIT License (MIT). Please see License File for more information.

Keywords

FAQs

Package last updated on 23 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc