Phoenix session storage without DB


Hi all

I want to use phoenix with no ecto but concerning about session storage. Would it works without ecto? Do phoenix store session in ETS?



I don’t think Phoenix comes with a session store built in. Anyways, you could resort to JWT (JSON Web Tokens), they work without sessions :wink:


When you create a new project, there is a session middleware I guess.


Phoenix uses Plug’s cookie session storage by default so you do not need a database.


Well, this is the session plug that phoenix use:

As it is part of the plug application, and it does not have any kind of dependency to ecto's application, I think it’s safe to say that the session storage in phoenix does not need ecto at all.

PS.: the Plug.Session documentation says it supports cookie and ETS session storage already.


The plug session store has the following comment.

We don’t recommend using this store in production as every
session will be stored in ETS and never cleaned until you
create a task responsible for cleaning up old entries.

What options are there for session stores that do not store all session data in the browser?

I have found one based on redis, however I am ideally looking for one that does not add extra dependencies so works on something like dets or even :global?


Nowadays it would make sense to transfer this to a Register based solution (which is GC-ed)