Skip to content

Instantly share code, notes, and snippets.

View biomousavi's full-sized avatar
🏠
Working from home

Nick Mousavi biomousavi

🏠
Working from home
View GitHub Profile
@biomousavi
biomousavi / ddd-concepts-for-begginers.md
Last active January 29, 2025 08:55
DDD Concepts for begginers

DDD Domain Driven Design

  • The primary goal of DDD is to map real-world systems or processes into software artifacts

Domain:

domain typically refers to the business logic and rules.

  • problem that the project is being developed for, in a e-commerce domains are sales, customer management.
@biomousavi
biomousavi / retryDynamicImport.ts
Last active October 13, 2024 14:57 — forked from mberneti/retryDynamicImport.ts
This utility function retryDynamicImport enhances React’s lazy loading mechanism by adding retry logic with a versioned query parameter. It retries importing a component multiple times in case of failure, which can be useful for bypassing browser cache or dealing with intermittent network issues. It can be used as a drop-in replacement for React…
// Usage:
// Replace React.lazy(() => import('x'));
// with retryDynamicImport(() => import('x'));
import { ComponentType, lazy } from 'react';
const MAX_RETRY_COUNT = 15;
const RETRY_DELAY_MS = 500;
// Regex to extract the module URL from the import statement
@biomousavi
biomousavi / event-driven-architecture.md
Last active October 5, 2024 06:44
What is Event-Driven Architecture (EDA) ?

What is Event-Driven Architecture (EDA) ?

Event-Driven Architecture (EDA) is a design approach where systems react to events or changes in state.

Why EDA ?

  • Enables systems to process events asynchronously.
  • Allows systems to share information without being aware of each other.
  • Makes it easier to increase number of services to handle increased workloads.
  • Improves decoupling and independence between services.