What is the difference between a session store and database What is the difference between a session store and database express express

What is the difference between a session store and database


Session store is a place where session data is being stored on server.On web its usually being identified by a cookie stored in clients browser.So it allows your app to identify user and keep him logged in for example.

Session can either be memory, some database, simple files, or any other place you can come up with to store session data.

If you project uses some database, you can configure your session store to use the same database, to avoid having another database on server just for the purpose of session store.

Differences between different session stores:

  • Memory session store is going to be reset on every app re-lauch. Also its fastest.
  • Database session store, is going to be safe with appre-lauch. And at some point you will have alot of session objectswhich you might want to clean up. And same session stored in database can be even accessed from different apps.


Session store is a method of storing information about user as a session with unique identifier. It could be stored in memory or in database. Socket.io can utilize the same session (id) being used in express app by socket-express-session package, if I am not mistaken.

You can then use session information to grant/restrict access, for example.