No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit a4b8e44 Mar 9, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Add integration test with abstract-cache-mongo Mar 9, 2018
.editorconfig 🤘 Nov 13, 2017
.gitignore 🤘 Nov 13, 2017
.travis.yml Fix travis config Mar 9, 2018 Fix #1 Nov 22, 2017
docker-compose.yml Add integration test with abstract-cache-mongo Mar 9, 2018
package.json Add integration test with abstract-cache-mongo Mar 9, 2018
plugin.js Update Fastify and dependencies Mar 7, 2018


This is a plugin for Fastify that facilitates keep state for clients between requests via server-side storage.



const fastify = require('fastify')()
  .register(require('fastify-server-session'), {
    secretKey: 'some-secret-password-at-least-32-characters-long',
    sessionMaxAge: 900000, // 15 minutes in milliseconds
    cookie: {
      domain: '',
      path: '/'

fastify.get('/one', (req, reply) => { = 'foo'

fastify.get('/two', (req, reply) => {


The plugin accepts an options object with the following properties:

  • secretKey (Default: undefined): this is a required property that must be a string with a minimum of 32 characters.
  • sessionCookieName (Default: sessionid): a string to name the cookie sent to the client to track the session.
  • sessionMaxAge (Default: 1800000): a duration in milliseconds for which the sessions will be valid.
  • cookie: an options as described in the cookie module's documentation. The default value is:
    • domain: undefined
    • expires: same as sessionMaxAge
    • httpOnly: true
    • path: undefined
    • sameSite: true


MIT License