Skip to content
~/mahadi hassan

Blog

Writing

Notes on building software — architecture, tooling, and lessons learned.

Why var Prints 4 4 4 but let Prints 1 2 3 in JavaScript
Javascript

Why var Prints 4 4 4 but let Prints 1 2 3 in JavaScript

Ever wondered why replacing `var` with `let` changes the output of a simple loop? Learn how JavaScript scope, closures, and the event loop work together, with real-world examples and interview insights.

4 min read
Type-Safe From Database to UI: Zod Contracts in a Turborepo — cover
TypeScriptNestJSNext.js

Type-Safe From Database to UI: Zod Contracts in a Turborepo

The bug that wastes the most time is the silent one where the API returns a slightly different shape than the frontend expects. Here is how a single Zod contracts package in a Turborepo kills that class of bug entirely.

2 min read1 comment★ 2
Designing a 14-Service NestJS Microservices Platform — cover
NestJSMicroservicesTypeScript

Designing a 14-Service NestJS Microservices Platform

What I learned decomposing a field-service product into 14 NestJS services — service boundaries, a shared Zod contract layer, an auth gateway, and async messaging — without drowning in distributed-systems complexity.

3 min read
Multi-Level RBAC Done Right: Module → Feature → Resource — cover
NestJSTypeScriptPostgreSQL

Multi-Level RBAC Done Right: Module → Feature → Resource

Role flags do not survive contact with a real enterprise app. Here is the three-tier access model — module, feature, resource — I built for a large manufacturing dashboard, and why each tier earns its place.

2 min read