<Mehraj Hosen/>

Passionate Fullstack Developer with expertise in MERN and PERN stack. I enjoy System Design, High-Level Design (HLD), and building scalable, distributed systems — turning complex problems into clean, maintainable, and production-ready solutions using the modern JavaScript ecosystem and strong architectural practices.

Dhaka, Bangladesh

bannerImage

AboutMe;

bannerImage

Hi, I'm Mehraj — a passionate full-stack developer specializing in MERN (MongoDB, Express, React, Node.js) and PERN (PostgreSQL, Express, React, Node.js) stacks. I build scalable, high-performance web applications with clean code, responsive UIs, and robust backends. I've successfully delivered multiple freelance projects — from startups to mid-sized businesses — including e-commerce platforms, SaaS dashboards, admin panels, and real-time features. I also enjoy system design, performance optimization, API architecture, and turning client visions into production-ready products quickly and reliably. Love solving challenging problems and delivering value. Let's collaborate and build something impactful!

Education & Trainings;

MERN Stack Development

Creative IT Institute

2025-2026

MERN Stack Development

Interactive Cares

2025-2025

System Design: Theory to Implementation

Interactive Cares

2026-2026

[My Projects]

Multipurpose Inventory & Business Management System

A full-stack, all-in-one platform built to solve one core problem: how do you fit retail, restaurant, and service-based businesses into a single inventory system without breaking the data model?The ProblemMost inventory software is built around one assumption — that a "product" is a fixed, sellable unit sitting on a shelf. That works fine for a retail shop, but it completely breaks down the moment you try to apply it to other business types:A retail business sells finished products directly from stock.A restaurant doesn't sell "products" in that sense — it buys raw ingredients, combines them into prepared items through a recipe-like process, and only then sells the final dish. Stock here isn't static, it's transformed.A service business doesn't have physical stock at all. It sells time, skill, or a service package — yet it still needs to be tracked, invoiced, and reported on alongside everything else.These three models have fundamentally different data structures, different stock behavior, and different sales logic. Most existing tools force you to pick one model and hack around the rest. I wanted to build a system where all three could coexist in the same database, the same dashboard, and the same reporting layer — without one business type's logic corrupting another's.The Core Design ChallengeThe real engineering problem wasn't building CRUD screens. It was designing a schema and workflow that could answer questions like:How do you track "stock" for something that doesn't physically exist (a service)?How do you connect a sale to inventory when the sold item (a prepared dish) is made from other inventory items (raw ingredients) that need to be deducted automatically?How do you keep one unified dashboard, one wastage report, and one sales report that make sense regardless of which business type generated the data?The SolutionI split the domain into distinct but connected modules instead of forcing everything into one generic "product" table:Product — for standard retail items sold as-is.Raw Product — for restaurant-style ingredients purchased in bulk.Prepared Product — items built from raw products through a defined composition, so selling one automatically deducts the correct quantity from the linked raw materials.Service — a separate sellable entity with no physical stock, but still fully integrated into invoicing, sales, and reporting.All four flow into the same purchase, sale, invoice, and dashboard layer, so a business owner running a hybrid operation — say, a restaurant that also sells packaged retail goods and offers catering as a service — can manage everything from one place instead of three disconnected tools.Core FeaturesInventory and StockSeparate tracking for products, raw materials, and prepared itemsAutomatic raw material deduction when a prepared product is soldWastage reporting and manual stock adjustmentsSales and PurchasesPurchase management with supplier recordsSales processing with customer due trackingInvoice generation covering products, prepared items, and services in one billReturn and refund handlingDashboard and ReportingUnified business overview regardless of business typeKPI cards and sales/purchase trend chartsActivity log for accountability across all modulesAccess ControlRole-aware modules with a foundation for staff permissions, still is&nbsp;not included yet.Tech StackLayerTechnologyFrontendNext.js, React, Tailwind CSS, TanStack QueryForms/ValidationReact Hook Form + ZodUIShadcn UI pattern componentsBackendNode.js, Express.js, Prisma ORMDatabasePostgreSQLAuthJWT-based patternsToolingTypeScript, pnpm workspaces, Docker, VitestArchitectureBuilt as a modular monorepo:inventory/├── multipurpose-inventory-backend/ &nbsp; -&gt; Express + Prisma API└── multipurpose-inventory-management/ -&gt; Next.js dashboard appThe backend models each business type as its own domain (product, raw product, prepared product, service) but joins them at the transaction level — purchase, sale, and invoice — so the frontend dashboard never has to know or care which business type generated a given record.Core Modulesaccount, activity log, auth, category, customer, dashboard, invoice, prepared product, product, purchase, raw product, return, sale, service, staff, supplier, trash, unit, wastageCurrent StatusThe core workflows for all three business models — dashboard, product management, purchases, sales, and supplier/customer tracking — are functional and live in production. The staff role and permission system is&nbsp;not included yet.This project came from a genuine gap I noticed: most inventory tools assume one business type. Building a schema that could honestly represent retail stock, restaurant transformation, and service-based sales in one coherent system was the hardest and most rewarding part of this build.

Next.jsTailwind CSSTanStack QueryReact Hook FormZodShadcnExpress.jsPrismaPostgreSQL
Single Vendor E-Commerce — Microservices Architecture

A scalable, niche-agnostic e-commerce engine built on a microservices backend.&nbsp;&nbsp;This project is a single-vendor e-commerce platform designed not for one specific niche, but as a reusable commerce engine — flexible enough to power a fashion store, an electronics shop, a beauty brand, or a grocery business, all with the same underlying architecture.The core focus wasn't just "build an online store" — it was build a scalable, service-oriented system that could grow without collapsing under its own complexity.Why Microservices?A typical monolithic e-commerce app works fine at small scale, but breaks down when:Product catalog logic starts mixing with cart/session logicInventory updates need to stay consistent under order loadDifferent teams need to work on different domains independentlySo instead, I split the backend into independent, purpose-built services, connected through an API Gateway.Backend ServicesServiceResponsibilityapi-gatewayCentral routing, public API accessuser-serviceAuthentication, users, account logicproduct-serviceProduct catalog managementcart-serviceShopping cart behavior via Redisinventory-serviceStock and inventory validationorder-serviceOrder creation, processing, paymentsCore FeaturesCustomer ExperienceProduct browsing, search, and detail pagesRedis-powered cart for fast, session-based shoppingFull checkout and order flowAuthenticated customer accountsStore ManagementProduct creation and inventory trackingOrder management and sales monitoringAdmin-friendly dashboardsBrand/storefront customization supportTech StackLayerTechnologyBackendNode.js, NestJS, TypeScriptDatabasePostgreSQL, MongoDB (per-service)Cache/CartRedisFrontendNext.js, React, TypeScript, TailwindInfraDocker, Docker ComposeArchitectureMicroservices + API Gateway🧩 Key Engineering DecisionsService isolation: Each domain (users, products, cart, orders, inventory) is independently deployable and scalableRedis for cart: Chosen for speed and to avoid unnecessary database writes during active shopping sessionsShared protocol definitions: Used for consistent internal service-to-service communicationDocker Compose orchestration: For reproducible local development matching production topologyThis project was built to sharpen my understanding of distributed system design — service boundaries, inter-service communication, and building a backend that can genuinely scale, not just run.

Node.jsNestJSTypeScriptPostgreSQLMongoDBRedisNextJSRedisDockerSocket.io
About Dhaka — Digital City Discovery Platform

A modern city discovery and digital directory platform for Dhaka, powered by AI.&nbsp;Dhaka is one of the busiest megacities in the world, yet finding reliable information about hospitals, restaurants, transport, and local services remains surprisingly difficult. About Dhaka was built to solve this — a single digital ecosystem that brings scattered city information into one searchable, AI-powered platform.This isn't just a directory. It's a step toward making Dhaka smarter, more connected, and more digital.The ProblemResidents and visitors of Dhaka often struggle with:Finding trustworthy medical care and specialists nearbyNavigating bus routes without centralized transit infoDiscovering local restaurants, places, and servicesGetting quick answers without digging through scattered sourcesThe SolutionI built a Next.js-based city platform that centralizes local information and layers an AI assistant on top for natural language search — so instead of browsing five different pages, a user can simply ask:"Which cardiologist is near Dhanmondi?"...and get a relevant, contextual answer instantly.Key FeaturesCity Discovery &amp; DirectoryBrowse hospitals, doctors, restaurants, places, and vet clinicsCategory and area-based filteringLocal blog and city storiesSmart Transit SupportBus route and nearest stop lookupRoute-aware navigation assistance for commutersAI City AssistantNatural language queries for hospitals, restaurants, places &amp; transportSmart intent detection built with Groq/OpenAI integrationContext-aware, fast local recommendationsPC Builder ToolPersonalized component suggestions based on user needs and budgetAdmin DashboardFull CRUD management for hospitals, doctors, restaurants, shops, blogs, and bus dataSecure admin authentication flowTech StackLayerTechnologyFrontendNext.js 16, React 19, TypeScript, Tailwind CSSBackend/DBMongoDB + MongooseData FetchingTanStack QueryUIShadcn-style componentsAIGroq / OpenAI integrationMapsLeafletMediaCloudinaryArchitecture HighlightsThe platform combines four major layers into one cohesive system:Public-facing city portal — for general discovery and browsingData-heavy service directory — structured listings across multiple categoriesAI assistant layer — natural language interface over the same datasetAdmin dashboard — for publishing and managing all city dataRoadmapReal-time bus/transit data integrationUser-generated reviews and ratingsMap-based navigationDeeper personalization in AI recommendationAbout Dhaka reflects my interest in building practical, locally-relevant products — combining modern web architecture with AI to solve a real, everyday problem for an entire city.

Next.jsTypeScriptTailwind CSSMongoDBTanStack QueryShadcnAI integrationLeaflet

/System Design & Case Studies/

Design Online Shopping Platform (E-Commerce)

Overview–

Online shopping platform that allows users to purchase mobiles, laptops, cameras, and books. Watches, apparel, shoes, etc.


Functional Requirements–

  • User should be able to search and find products based on product titles or names.

  • User should be able to view the details of the product (Description, image, available quantity, review)

  • User should be able to select the quantity and move the item to cart.

  • User should be able to make the payment and do the checkout.

  • User should be able to check the status of the order

  • Manage purchase of items having limited stock.


Non-Functional Requirements—

  • Scale: 10M MAU and 10 orders/sec

  • CAP Theorem: Highly available with respect to searching and viewing the items, and highly consistent with respect to placing the order and payment.


Core Entities—

  • User

  • Product

  • Cart

  • Order

  • Checkout

API–

  1. // Search Product

  1. GET: /products/search?q={seachTerm} → List <ProductId> list : Pagination

  1. // Product Detail

    1. GET:  /products/{productId}→ return the product details (json)

  2. // Insert Data

    1. POST: /cart {body: all product Id} → return cartId

  3. // checkout and payment

    1. POST: /checkout {body: all product Id with wty and price} → orderId

    2. POST: /payment {body: orderId and payment details} → confirmation

  4. // order Status

    1. GET: /status/{orderId}


High-Level Design–


Read Case Study →

Design Web Crawler

Overview–

A web crawler is a program that automatically traverses the web by downloading web pages and following links from one page to another. It is used to index the web for search engines, collect data for research, or monitor websites for changes.


Problem Definition–

  • Design a web crawler to extract text data from the web and store it to train an LLM.

  • Your crawler can run for only 5 days.


Functional Requirements–

  • Crawl the full web starting from seed urls

  • Extract text data and store


Scale–

  • 10B web pages

  • 2MB per page avg.

  • 5 days to scrape

  • Unlimited resources (withing reason)


Non-Functional Requirements–

  • Fault tolerant

  • Politeness

  • Scale to 10B pages

  • Efficiently crawl in under 5 days


Core Entities—

  • Text Data

  • URL metadata

  • Domain metadata


Interface–

input – set of seed urls

Output – text data


Data Flow–

  1. Take seed urls from a frontier and the IP from DNS

  2. Fetch HTML

  3. Extract text from HTML

  4. Store that text in database

  5. Extract the urls in the text and add to our frontier

  6. Repeat steps 1-5 until all urls have been crawled


High-Level Design–


Efficiency–

  1. Don’t crawl a URL that has already been added.

  2. Don’t parse a webpage with duplicate content that has already been parsed.

Read Case Study →

Design Youtube

Overview–

YouTube is a video-sharing platform that allows users to upload, view, and interact with video content. As of this video, it is the second most visited website in the world.


Functional Requirements–

  1. Users should be able to upload videos.

  2. Users should be able to watch/stream videos.


Scale 

~1M uploads/day

100M DAU

Max video size of 256GB


Non-Functional Requirements–

  • Availability >> Consistency for video uploads

  • Support uploading/streaming for large videos (256GB)

  • Low latency streaming (<500 ms) is true in low bandwidth

  • Scalability to scale to 1M uploads per day and 100M views


Core Entities—

  • User

  • Video

  • Video Metadata


API

//upload a video

POST /videos

{

videoMetadata

}

//watch a video

GET /videos/:videoId → video & videoMetadata


High-Level Design–



Read Case Study →

[My Articles]

The 1% Mindset: The Real Secret to Success

The 1% Mindset: The Real Secret to Success

By Mehraj H.

July 2026

The gap between where you are right now and what you want to wear isn’t about money, relationships, or success. It’s all attitude—1% attitude.


The top 1% don’t have more hours in a day than you do. They just behave differently. They minimize distractions, concentrate on their desires, and show up every single day—even when they don’t feel irresistible.


Success is not about being the most talented or the smartest person in the room. It's almost community. No one is watching, no one is clapping, and the results are not coming fast enough to take pictures. The 1% embody conflict because they recognize growth as outside the most effective comfort zone.


Think of a bamboo tree. You water and feed it every day for years and don’t take advantage of any signs of growth you see. Then suddenly, it quickly explodes. All of that was building strong foundations. Your small daily efforts make paintings the same way—they combine to create explosives time and time again.


Key Truths About the 1% Mindset:

  • Failure is not always the end—notes and practice.

  • The model is second to none. The right time is now.

  • Take responsibility. No one is coming to save you.

  • Train yourself, work, and keep moving forward.


You have everything to create the lifestyle you need with the interior you want. Stop settling for “right enough." Choose to be a part of the 1%.

Let's start today. Build a taller shelter. Press it a little more. Never give up.


The journey will not be easy, but it will be worth it. You got this!


One percent Mindset



Bloom Filters

Bloom Filters

By Mehraj H.

May 2026

Every time you visit a webpage, Chrome quietly runs a check — is this URL malicious?
It doesn't call a server. It doesn't scan a massive database. It uses a Bloom filter. And it gets an answer in microseconds. That's the magic of this data structure. Small. Fast. Brilliant. So what exactly is a Bloom filter?

It's a probabilistic data structure — a fancy way of saying it trades a small chance of being wrong for massive gains in speed and memory. Here's how it works: you have a bit array (just a row of 0s and 1s) and a few hash functions. When you add an item, the hash functions each point to a position in the array and flip those bits to 1. When you query for an item, you check those same positions. All 1s? Probably in the set. Even one 0? Definitely not in the set.

That "definitely not" is the superpower. Why does that matter? Imagine you're Cassandra or HBase, and someone queries for a key that doesn't exist. Without a Bloom filter, you'd do a full disk read — expensive, slow. With one, you check in memory first. If it says "definitely not here," you skip the disk entirely. Gone. Saved.

Medium uses Bloom filters to avoid recommending articles you've already read. Akamai uses them to decide whether a URL is worth caching. Redis has them built in. One data structure, sitting quietly behind some of the biggest systems in the world.
The honest trade-off: Bloom filters can give false positives — they might say "probably yes" when the answer is actually no. But they never give false negatives. If it says no, trust it completely. And the memory savings? For 1 million items, a HashSet needs ~100MB. A Bloom filter? Around 1MB. Same job. 100x less memory. When should you actually use one?

When you need to check membership at scale, can tolerate rare false positives, and can't afford the cost of always hitting disk or a remote database. Spell checkers, fraud detection, network routers, CDN caches — the use cases are everywhere once you start looking.

It's not a replacement for a database. It's the bouncer at the door that turns away the obvious misses before they waste anyone's time. One bit array. A few hash functions. Millions of expensive lookups saved every second. Not bad for a 1970 invention.

#SystemDesign #BloomFilter #DataStructures #SoftwareEngineering #BackendDevelopment #DistributedSystems #DatabaseOptimization #WebPerformance #Programming #TechLeadership #ComputerScience #SoftwareArchitecture

Cache Invalidation

Cache Invalidation

By Mehraj H.

May 2026


"There are only two hard things in computer science: cache invalidation and naming things." — Phil Karlton


I used to laugh at this quote. Then I spent a week debugging why our users were seeing prices from 3 hours ago. I stopped laughing.

Here's what nobody tells you about caching: the moment you add one, you stop having one source of truth. You now have two—your database and your cache. And keeping them in sync? That's the real job.

Why is it so genuinely hard?

It's not a single problem. It's a cluster of problems wearing a trench coat.

Data changes in unpredictable ways. A user updates their profile. An inventory item sells out. A price gets revised. Your cache doesn't know any of this happened — it just happily keeps serving the old value, convinced it's being helpful.

Then there's timing. Even when you do invalidate the cache, there's a window — however small — where stale data leaks through. In distributed systems with dozens of nodes, that window multiplies.

And then the classic trap hits: you delete a cache entry right as another process is reading it, a third process is writing to the DB, and a fourth is about to repopulate the cache with the old value. Welcome to race conditions.

The strategies engineers actually use:

→ TTL (Time-to-Live): Set an expiry. Simple, predictable. But you're accepting "stale for up to X minutes" as a business decision, not just a tech one.

→ Write-through: Update cache and DB together on every write. Consistent, but adds latency to your writes.

→ Write-behind (write-back): Update cache first, sync to DB asynchronously. Fast writes are risky—if the cache dies before the sync, you lose data.

→ Event-driven invalidation: Publish a change event whenever data updates; subscribers invalidate the relevant cache keys. Elegant at scale, complex to implement correctly.

The lesson I keep coming back to:

Caching is never just a performance decision. It's a consistency decision. Every cache entry is a bet that the data won't change before the TTL expires — or that you'll catch it when it does.

The engineers who get burned by cache bugs aren't the ones who don't understand caching. They're the ones who underestimated how many moving parts stand between "data changed in the DB" and "cache reflects that change."

Phil Karlton said it in the 90s. Thirty years of distributed systems later, it's still true.

If you're building anything at scale, treat cache invalidation with the same seriousness you'd give schema migrations or API versioning. It deserves it.


My NPM Packages

Loading your NPM packages...

[Get In Touch]

Have a project in mind? Want to collaborate? Or just say hi? Feel free to reach out — I reply within 24 hours!

Location

Dhaka, Bangladesh

© 2026 Mehraj Hosen. All rights reserved.