npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@boostkit/session

v0.0.5

Published

HTTP session support for BoostKit — signed cookie sessions (default) and Redis-backed sessions.

Readme

@boostkit/session

HTTP session support for BoostKit — signed cookie sessions (default) and Redis-backed sessions.

pnpm add @boostkit/session

For Redis sessions, also install ioredis:

pnpm add ioredis

Setup

1. Config

// config/session.ts
import { Env } from '@boostkit/support'
import type { SessionConfig } from '@boostkit/session'

export default {
  driver:   Env.get('SESSION_DRIVER', 'cookie') as 'cookie' | 'redis',
  lifetime: 120,  // minutes
  secret:   Env.get('SESSION_SECRET', 'change-me-in-production'),
  cookie: {
    name:     'boostkit_session',
    secure:   Env.getBool('SESSION_SECURE', false),
    httpOnly: true,
    sameSite: 'lax',
    path:     '/',
  },
} satisfies SessionConfig

2. Register the provider

// bootstrap/providers.ts
import { session } from '@boostkit/session'
import configs from '../config/index.js'

export default [
  session(configs.session),
]

3. Add middleware to routes

// routes/web.ts
import { Route } from '@boostkit/router'
import { SessionMiddleware } from '@boostkit/session'

const webMw = [SessionMiddleware()]

Route.get('/dashboard', handler, webMw)
Route.post('/contact',  handler, webMw)

Usage

req.session

Route.get('/profile', (req, res) => {
  const visits = (req.session.get<number>('visits') ?? 0) + 1
  req.session.put('visits', visits)
  res.json({ visits })
}, webMw)

Session facade

import { Session } from '@boostkit/session'

Session.put('theme', 'dark')
const theme = Session.get<string>('theme')
Session.forget('theme')

Flash data

// Set on this request — available on the next request only
Session.flash('success', 'Post created!')
req.session.flash('error', 'Something went wrong.')

// Read on the next request
const msg = Session.getFlash<string>('success')

Session ID

const id = req.session.id()       // current session ID
await req.session.regenerate()    // new ID, same data (use after login)

API

SessionInstance

| Method | Description | |---|---| | get<T>(key, fallback?) | Read a value. Returns fallback if missing. | | put(key, value) | Write a value. | | forget(key) | Delete a value. | | flush() | Clear all session data. | | flash(key, value) | Store a value readable on the next request via getFlash(). | | getFlash<T>(key, fallback?) | Read a flash value set by the previous request. | | has(key) | Check whether a key exists. | | all() | Return a shallow copy of all session data. | | id() | Return the current session ID. | | regenerate() | Assign a new session ID (destroys old in Redis, keeps data). |

Session facade

Mirrors SessionInstance as static methods, backed by AsyncLocalStorage. Throws if called outside a request wrapped by SessionMiddleware().

get · put · forget · flash · getFlash · has · all · regenerate


Drivers

cookie (default)

Session data is JSON-serialised, base64url-encoded, and signed with HMAC-SHA256. No external dependencies. The entire payload is stored in the cookie (~4 KB limit).

redis

Session ID is stored in the cookie; data lives in Redis under {prefix}{id}. Requires ioredis.

{
  driver: 'redis',
  redis: {
    url:    'redis://localhost:6379',
    prefix: 'session:',
  },
}

Notes

  • Apply SessionMiddleware() to web routes only — API routes should use stateless auth.
  • Session is saved automatically after the route handler returns; no manual save() needed.
  • The cookie driver stores all data client-side — keep values small. Use Redis for larger payloads.
  • SessionMiddleware() reads config from the DI container. Use sessionMiddleware(config) for manual wiring without a provider.