HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
fpereiro
backendlore
OPEN SOURCE2020–2023
fpereiro / backendlore

backendlore

How I write backends

8Distinct people
13Mentions
1Explicit recommenders
5.4KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

How I write backends

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

As a less experienced web developer, i found "How I write backends"[1] very enlightening and I recommend it to all my peers when we discuss useful resources. 1.…

codeDruid used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year13 dated mentions

Observed mentions: 2020-01-21 13:01:18 UTC to 2023-10-18 23:48:22 UTC.

02468102020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 9 mentions; 3 submissions, 6 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC936
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC202
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

What Hacker News says

13 sources
Sure it's not for everyone. I learnt a lot doing cash strapped startups where there wasn't a devops person. AWS can get expensive, especially when you start using more and more services (lambda,dynamodb,rds,elasticache etc) although it can be easily scaled. Note, you probably shouldn't do it by hand (setting up your own servers). You'd use Ansible/Terraform. For those that are interested but not quite ready, here's a great article [0]. [0] https://github.com/fpereiro/backendlore.
In Ask HN: Where to Host a FastAPI App
fpereiro·Feb 7, 2020Submission

Ask HN: Acceptable CSRF Token Lifecycle?

Hi HN! Question for those with experience writing and/or auditing the auth flows of a web application. I recently decided to move my session cookies to HttpOnly, to mitigate the damage of a XSS attack. To prevent CSRF, I was sending said session cookie as an extra field with every POST request (double submit cookie pattern: https://medium.com/cross-site-request-forgery-csrf/double-submit-cookie-pattern-65…). Now that the session is not readable from javascript, I need to create a separate CSRF token. Based on great feedback from the community (see https://news.ycombinator.com/item?id=22209588 and https://github.com/fpereiro/backendlore/issues/12), I'm considering the following approach: - On every successful login, create a new secret/token (using the same crypto mechanism I use to create the session secret, but a different secre
Read the rest
t altogether) and store it on the database, tied to the session itself. Set both the session and the CSRF token to expire at the same time. - Every time I get a request with a valid session, renew the life of both the session AND the associated CSRF token. - On every successful login, return the CSRF token in the body so that it can be read by client-side javascript. - Set up an endpoint to retrieve the associated CSRF token for its session. If no session is present (or the session has expired), return a 403 code. This also solves the problem of letting the client-side app know whether the user is logged in or not (I would hit this GET /csrf endpoint when the javascript loads to determine whether there's a valid session available). My understanding is that, as long as the browser supports Same-Origin Policy (https://en.wikipedia.org/wiki/Same-origin_policy), a CSRF attacker could not submit a GET request to my server and obtain the result. If you see any security issues in the above scheme - or if you use a similar scheme and know it to be secure - please let me know. Thank you very much for your feedback!
1 points · Open discussion
Thank you for your suggestion about using samesite=strict! I'll look into it a bit more - the only downside I see is support for older browsers, which is a personal vice I can't kick. If I see that there's no elegant CSRF solution, this will probably be my fire escape. Thank you for that! I added more info in the document regarding cookie/session management, particularly its expiry (https://github.com/fpereiro/backendlore#identity--security). The approach I take is to make cookies last until the server says so. I'm very curious as to how you use cookies with varying expiration times and would love to know more if you have the time.
In How I write back ends

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.