-
Protective measures for recent shai hulud attacks
As the recent attacks are getting common, I did some changes and tried to prevent my ongoing apps that I am working on, as much as I can using some steps. Before, we move forward, just to give context, I left using “npm” for my new projects some years back. I use “pnpm” mostly for…
-
PostgreSQL deep dive: Syncing Cart items
context: I was working on persisting cart items in database. The tech stack is React, Nest, Drizzle and Postgres. approach: I thought it would be simple as its just POST and GET requests for syncing, but I went deep diving postgres DB. the saving: Cart Item Table: Approach 1: I can add a product to…
-
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…
-
Flexible Products List and Quick View Modal Components Group
context: I was making an ecommerce app in React. I should have made in Next or similar tech, as it would be easier for SEO and other things, but I have chosen React as of now. So, it has a search page, where all the products would be listed, along with it is filters and…
-
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…
-
Flexible Storage Providers in Nest.js
Implementing file upload service Requirement: I needed a generic file uploader service which have the following functionalities: Also, I might change the service provider later. Currently, I wanted to use ImageKit but later I might change to dropbox or aws s3 or onedrive, etc. But, I want minimal changes in my code with a single…