10 - API (feat): Use Litestar Stores for Sessions#236
Draft
RobertRosca wants to merge 5 commits into
Draft
Conversation
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 06:20
3c2d88f to
a858eeb
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 17, 2026 06:20
563d503 to
16ef9c9
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 06:21
a858eeb to
e499c8b
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
2 times, most recently
from
July 17, 2026 08:40
39e5fbd to
a70b372
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 08:40
e499c8b to
5504c95
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 17, 2026 09:09
a70b372 to
d1904ce
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 09:11
5502ad2 to
537791a
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 17, 2026 09:11
d1904ce to
5c42f18
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 09:12
537791a to
76ad1cb
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
2 times, most recently
from
July 17, 2026 09:12
12578d0 to
3678512
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
2 times, most recently
from
July 17, 2026 10:46
0ba7886 to
e7d0d0d
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 17, 2026 10:46
3678512 to
0bf01a3
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 17, 2026 11:01
e7d0d0d to
c2015a9
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
2 times, most recently
from
July 20, 2026 09:25
7bc3aa1 to
b86ffe0
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
2 times, most recently
from
July 20, 2026 09:28
50094a0 to
a6cd987
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 20, 2026 09:28
b86ffe0 to
e9be966
Compare
RobertRosca
force-pushed
the
feat/migrate-litestar
branch
from
July 20, 2026 09:30
a6cd987 to
500321d
Compare
RobertRosca
force-pushed
the
feat/litestar-stores-sessions
branch
from
July 20, 2026 09:30
e9be966 to
107a031
Compare
CammilleCC
reviewed
Jul 20, 2026
CammilleCC
left a comment
Member
There was a problem hiding this comment.
Thanks for adding this, looks good on first impression. Excited on we can utilize the stores in the future 😊
| return f"{request.url.path}:{proposal_number}" | ||
|
|
||
|
|
||
| @get("/content", cache=5, cache_key_builder=_proposal_cache_key) |
Member
There was a problem hiding this comment.
Just to confirm: is this behind auth? I just wonder on the case when the cache is already built by an authorized user who just accessed it, and then subsequenltly accessed by unauthorized user. From reading the code, the endpoint will return the content regardless.
| # id, with no parallel store to keep consistent. | ||
| request.session["user"] = user | ||
| token_store.store(str(user["sub"]), token) | ||
| request.session["tokens"] = token |
Member
There was a problem hiding this comment.
Ooooh this is a bit scary. Do we have encryption on the file store or something similar?
| # session data lives in a Litestar store. The same registry backs every | ||
| # named store (sessions, response cache); the backend is mode-dependent | ||
| # (in-memory locally, file-backed otherwise) and selected below. | ||
| session_config = ServerSideSessionConfig(key=SESSION_COOKIE_KEY) |
Member
There was a problem hiding this comment.
Maybe we can add secure=... here? We can use/introduce an env var to denote if we're prod or dev (or local with is_local).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬