-
Caching: Stale while Revalidate
Caching strategy, I tried to understand Situation/context: I got to know about a situation called cache stampede. In this scenario, a lot of requests when misses the cache and all of them hits the DB to get the data. I got to know about polling locks and stale while revalidate to mitigate this issue. How…
-
FastAPI Backend: Part 4 (Authentication)
Logs for implementing authentication what I want: Login: So for login, we need to make: Auth Route: Description: Auth Service: Description: Security Utils: Description: Auth DB Handler: Description: Auth Guard: Description: Refresh Token Guard: Description: This finishes our authentication. I will be implementing RBAC after this in the next article.
-
Fastapi Backend: Part 3 (Service Layer)
This is the logs for building service layer Agenda: Common standard response schema Description: Schemas specific to books module Description: Books Service: Description: Books routes Description: Data validation using DTO Description: Logging configuration for the app: I wanted to configure logging throughout the app such that I can log my data anywhere in the app…
-
Fastapi Backend: Part 2 (DB layer)
Database Layer In this post, we will be building the database layer, which can be used to connect the database for querying. Requirements: environment Variable Need to add the DB url in .env file so that I can access the url and provide to SQLAlchemy to connect the app to DB. I am using asyncpg…
-
Fastapi Backend: Part 1 (Routing Layer)
This is a log of my fastapi backend development. Requirements: basics: route/controller layer: I wanted to make versioning of routes like api/v1/books and extend to as many version I want so that my results can change as per the version if I want to upgrade or my data/requirements hets changed in future. I might use…