[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"header-categories":3,"post-designing-resilient-systems-circuit-breakers":73,"parsed-post-cfddcd22-4a14-451b-af8a-c95840f36c63":147},{"success":4,"data":5},true,{"items":6,"pagination":70},[7,16,24,32,40,48,56,63],{"id":8,"name":9,"description":10,"parentId":11,"createdAt":12,"updatedAt":12,"parent":11,"children":13,"_count":14},"ai-future","AI & The Future","Artificial intelligence and emerging technology",null,"2026-07-24T06:02:45.990Z",[],{"posts":15},1,{"id":17,"name":18,"description":19,"parentId":11,"createdAt":20,"updatedAt":20,"parent":11,"children":21,"_count":22},"tools-productivity","Tools & Productivity","Developer tools and workflow optimization","2026-07-24T06:02:45.712Z",[],{"posts":23},7,{"id":25,"name":26,"description":27,"parentId":11,"createdAt":28,"updatedAt":28,"parent":11,"children":29,"_count":30},"career","Career & Growth","Professional development for developers","2026-07-24T06:02:45.486Z",[],{"posts":31},3,{"id":33,"name":34,"description":35,"parentId":11,"createdAt":36,"updatedAt":36,"parent":11,"children":37,"_count":38},"opinion","Opinion & Analysis","Industry analysis and technical opinions","2026-07-24T06:02:45.272Z",[],{"posts":39},6,{"id":41,"name":42,"description":43,"parentId":11,"createdAt":44,"updatedAt":44,"parent":11,"children":45,"_count":46},"tutorials","Tutorials","Step-by-step learning guides","2026-07-24T06:02:44.965Z",[],{"posts":47},21,{"id":49,"name":50,"description":51,"parentId":11,"createdAt":52,"updatedAt":52,"parent":11,"children":53,"_count":54},"software-engineering","Software Engineering","Best practices, patterns, and principles","2026-07-24T06:02:44.689Z",[],{"posts":55},24,{"id":57,"name":58,"description":59,"parentId":11,"createdAt":60,"updatedAt":60,"parent":11,"children":61,"_count":62},"devops-cloud","DevOps & Cloud","Infrastructure, deployment, and cloud computing","2026-07-24T06:02:44.453Z",[],{"posts":39},{"id":64,"name":65,"description":66,"parentId":11,"createdAt":67,"updatedAt":67,"parent":11,"children":68,"_count":69},"web-development","Web Development","Frontend and backend web development tutorials and guides","2026-07-24T06:02:44.169Z",[],{"posts":55},{"page":15,"limit":71,"total":71,"totalPages":15,"hasNext":72,"hasPrev":72},8,false,{"success":4,"data":74},{"id":75,"slug":76,"title":77,"excerpt":78,"content":79,"status":80,"visibility":81,"featuredImage":82,"canonicalUrl":11,"readingTime":83,"viewCount":84,"commentEnabled":4,"publishedAt":85,"scheduledAt":11,"createdAt":86,"updatedAt":87,"seoTitle":88,"seoDescription":78,"seoKeywords":11,"authorId":89,"author":90,"coAuthors":95,"tags":96,"categories":112,"comments":114,"_count":115,"relatedPosts":117},"cfddcd22-4a14-451b-af8a-c95840f36c63","designing-resilient-systems-circuit-breakers","Designing Resilient Systems: Circuit Breakers and Retry Patterns","Build systems that gracefully handle failure with circuit breakers, exponential backoff, bulkheads, and timeout patterns.","## Everything Fails\n\nNetworks are unreliable. Services go down. Databases hit connection limits. Resilient systems accept this and handle failure gracefully instead of cascading.\n\n## Retry with Exponential Backoff\n\n```typescript\nasync function retry\u003CT>(\n  fn: () => Promise\u003CT>,\n  options: { maxAttempts?: number; baseDelay?: number; maxDelay?: number } = {}\n): Promise\u003CT> {\n  const { maxAttempts = 3, baseDelay = 1000, maxDelay = 30000 } = options\n\n  for (let attempt = 1; attempt \u003C= maxAttempts; attempt++) {\n    try {\n      return await fn()\n    } catch (error) {\n      if (attempt === maxAttempts) throw error\n\n      const delay = Math.min(\n        baseDelay * Math.pow(2, attempt - 1) + Math.random() * 1000,\n        maxDelay,\n      )\n      console.warn(`Attempt ${attempt} failed, retrying in ${delay}ms...`)\n      await new Promise(resolve => setTimeout(resolve, delay))\n    }\n  }\n  throw new Error('Unreachable')\n}\n\n\u002F\u002F Usage\nconst data = await retry(() => fetch('https:\u002F\u002Fapi.example.com\u002Fdata'), {\n  maxAttempts: 3,\n  baseDelay: 500,\n})\n```\n\n::callout{icon=\"i-lucide-alert-triangle\" color=\"warning\"}\nAlways add jitter (randomness) to backoff delays. Without it, all failed clients retry at exactly the same time, causing a \"thundering herd\" that overwhelms the recovering service.\n::\n\n## Circuit Breaker\n\nStop calling a failing service — give it time to recover:\n\n```typescript\nclass CircuitBreaker {\n  private failures = 0\n  private lastFailure = 0\n  private state: 'closed' | 'open' | 'half-open' = 'closed'\n\n  constructor(\n    private threshold: number = 5,\n    private resetTimeout: number = 30000,\n  ) {}\n\n  async execute\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.state === 'open') {\n      if (Date.now() - this.lastFailure > this.resetTimeout) {\n        this.state = 'half-open'\n      } else {\n        throw new Error('Circuit is OPEN — service unavailable')\n      }\n    }\n\n    try {\n      const result = await fn()\n      this.onSuccess()\n      return result\n    } catch (error) {\n      this.onFailure()\n      throw error\n    }\n  }\n\n  private onSuccess() {\n    this.failures = 0\n    this.state = 'closed'\n  }\n\n  private onFailure() {\n    this.failures++\n    this.lastFailure = Date.now()\n    if (this.failures >= this.threshold) {\n      this.state = 'open'\n    }\n  }\n}\n\n\u002F\u002F Usage\nconst paymentBreaker = new CircuitBreaker(3, 60000)\n\nasync function processPayment(amount: number) {\n  return paymentBreaker.execute(() =>\n    fetch('https:\u002F\u002Fpayments.api\u002Fcharge', {\n      method: 'POST',\n      body: JSON.stringify({ amount }),\n    })\n  )\n}\n```\n\n## Timeout Pattern\n\nNever wait forever:\n\n```typescript\nfunction withTimeout\u003CT>(promise: Promise\u003CT>, ms: number): Promise\u003CT> {\n  const timeout = new Promise\u003Cnever>((_, reject) =>\n    setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms)\n  )\n  return Promise.race([promise, timeout])\n}\n\n\u002F\u002F Usage\nconst data = await withTimeout(fetchUserProfile(id), 5000)\n```\n\n## Bulkhead Pattern\n\nIsolate failures to prevent cascading:\n\n```typescript\nclass Bulkhead {\n  private active = 0\n\n  constructor(private maxConcurrent: number) {}\n\n  async execute\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.active >= this.maxConcurrent) {\n      throw new Error('Bulkhead capacity reached')\n    }\n    this.active++\n    try {\n      return await fn()\n    } finally {\n      this.active--\n    }\n  }\n}\n\n\u002F\u002F Limit database calls to 10 concurrent\nconst dbBulkhead = new Bulkhead(10)\n```\n\n## Combining Patterns\n\n```typescript\nasync function resilientCall\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n  return retry(\n    () => circuitBreaker.execute(\n      () => withTimeout(fn(), 5000)\n    ),\n    { maxAttempts: 3 }\n  )\n}\n```\n\nBuild for failure from day one. It's cheaper than fixing outages at 3am.\n","published","public","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1461749280684-dccba630e2f6?w=1200&q=80",9,1331,"2026-05-14T06:04:09.859Z","2026-07-24T06:04:09.861Z","2026-07-28T17:13:38.826Z","Designing Resilient Systems: Circuit Breakers and Retry Patterns | BitBlog","fddb5d93-7a2c-4d86-a06a-fa32e73a01c6",{"email":91,"bio":92,"id":89,"name":93,"avatarUrl":94},"mbeahessilfieprince@gmail.com","Fullstack Software Developer ","Mbeah Essilfie","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93322394?v=4",[],[97,102,107],{"id":98,"name":99,"color":100,"description":101},"typescript","TypeScript","#3178c6","Typed superset of JavaScript",{"id":103,"name":104,"color":105,"description":106},"nodejs","Node.js","#339933","JavaScript runtime built on V8",{"id":108,"name":109,"color":110,"description":111},"architecture","Architecture","#795548","Software architecture patterns",[113],{"id":49,"name":50,"description":51},[],{"comments":116},0,[118,127,137],{"id":119,"slug":120,"title":121,"excerpt":122,"featuredImage":123,"viewCount":124,"readingTime":71,"publishedAt":125,"author":126},"2997028f-4d22-4eb7-9d86-894a54cb559a","building-type-safe-apis-nuxt3-prisma","Building Type-Safe APIs with Nuxt 3 and Prisma","Learn how to build end-to-end type-safe APIs using Nuxt 3 server routes and Prisma ORM for a seamless developer experience.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1498050108023-c5249f4df085?w=1200&q=80",1922,"2026-07-23T06:02:46.910Z",{"id":89,"name":93,"avatarUrl":94},{"id":128,"slug":129,"title":130,"excerpt":131,"featuredImage":132,"viewCount":133,"readingTime":134,"publishedAt":135,"author":136},"da9e4553-8b0d-411e-b4ec-f9684017e163","mastering-tailwind-css-design-systems","Mastering Tailwind CSS: From Utility Classes to Design Systems","Go beyond basic utility classes and learn how to build cohesive, maintainable design systems with Tailwind CSS.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1555066931-4365d14bab8c?w=1200&q=80",257,10,"2026-07-21T06:02:49.268Z",{"id":89,"name":93,"avatarUrl":94},{"id":138,"slug":139,"title":140,"excerpt":141,"featuredImage":142,"viewCount":143,"readingTime":144,"publishedAt":145,"author":146},"50add5fc-4026-4267-b917-7f71ea9e35b0","complete-guide-vue3-composables","The Complete Guide to Vue 3 Composables","Understand the power of Vue 3's Composition API through practical, real-world composable patterns that you can use today.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1517694712202-14dd9538aa97?w=1200&q=80",990,12,"2026-07-19T06:02:51.753Z",{"id":89,"name":93,"avatarUrl":94},{"data":148,"body":150,"toc":278},{"title":149,"description":149},"",{"type":151,"children":152},"root",[153,162,168,174,186,197,203,208,216,222,227,235,241,246,254,260,268,273],{"type":154,"tag":155,"props":156,"children":158},"element","h2",{"id":157},"everything-fails",[159],{"type":160,"value":161},"text","Everything Fails",{"type":154,"tag":163,"props":164,"children":165},"p",{},[166],{"type":160,"value":167},"Networks are unreliable. Services go down. Databases hit connection limits. Resilient systems accept this and handle failure gracefully instead of cascading.",{"type":154,"tag":155,"props":169,"children":171},{"id":170},"retry-with-exponential-backoff",[172],{"type":160,"value":173},"Retry with Exponential Backoff",{"type":154,"tag":175,"props":176,"children":180},"pre",{"className":177,"code":178,"language":98,"meta":149,"style":179},"language-typescript","async function retry\u003CT>(\n  fn: () => Promise\u003CT>,\n  options: { maxAttempts?: number; baseDelay?: number; maxDelay?: number } = {}\n): Promise\u003CT> {\n  const { maxAttempts = 3, baseDelay = 1000, maxDelay = 30000 } = options\n\n  for (let attempt = 1; attempt \u003C= maxAttempts; attempt++) {\n    try {\n      return await fn()\n    } catch (error) {\n      if (attempt === maxAttempts) throw error\n\n      const delay = Math.min(\n        baseDelay * Math.pow(2, attempt - 1) + Math.random() * 1000,\n        maxDelay,\n      )\n      console.warn(`Attempt ${attempt} failed, retrying in ${delay}ms...`)\n      await new Promise(resolve => setTimeout(resolve, delay))\n    }\n  }\n  throw new Error('Unreachable')\n}\n\n\u002F\u002F Usage\nconst data = await retry(() => fetch('https:\u002F\u002Fapi.example.com\u002Fdata'), {\n  maxAttempts: 3,\n  baseDelay: 500,\n})\n","undefined",[181],{"type":154,"tag":182,"props":183,"children":184},"code",{"__ignoreMap":149},[185],{"type":160,"value":178},{"type":154,"tag":187,"props":188,"children":191},"callout",{"color":189,"icon":190},"warning","i-lucide-alert-triangle",[192],{"type":154,"tag":163,"props":193,"children":194},{},[195],{"type":160,"value":196},"Always add jitter (randomness) to backoff delays. Without it, all failed clients retry at exactly the same time, causing a \"thundering herd\" that overwhelms the recovering service.",{"type":154,"tag":155,"props":198,"children":200},{"id":199},"circuit-breaker",[201],{"type":160,"value":202},"Circuit Breaker",{"type":154,"tag":163,"props":204,"children":205},{},[206],{"type":160,"value":207},"Stop calling a failing service — give it time to recover:",{"type":154,"tag":175,"props":209,"children":211},{"className":177,"code":210,"language":98,"meta":149,"style":179},"class CircuitBreaker {\n  private failures = 0\n  private lastFailure = 0\n  private state: 'closed' | 'open' | 'half-open' = 'closed'\n\n  constructor(\n    private threshold: number = 5,\n    private resetTimeout: number = 30000,\n  ) {}\n\n  async execute\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.state === 'open') {\n      if (Date.now() - this.lastFailure > this.resetTimeout) {\n        this.state = 'half-open'\n      } else {\n        throw new Error('Circuit is OPEN — service unavailable')\n      }\n    }\n\n    try {\n      const result = await fn()\n      this.onSuccess()\n      return result\n    } catch (error) {\n      this.onFailure()\n      throw error\n    }\n  }\n\n  private onSuccess() {\n    this.failures = 0\n    this.state = 'closed'\n  }\n\n  private onFailure() {\n    this.failures++\n    this.lastFailure = Date.now()\n    if (this.failures >= this.threshold) {\n      this.state = 'open'\n    }\n  }\n}\n\n\u002F\u002F Usage\nconst paymentBreaker = new CircuitBreaker(3, 60000)\n\nasync function processPayment(amount: number) {\n  return paymentBreaker.execute(() =>\n    fetch('https:\u002F\u002Fpayments.api\u002Fcharge', {\n      method: 'POST',\n      body: JSON.stringify({ amount }),\n    })\n  )\n}\n",[212],{"type":154,"tag":182,"props":213,"children":214},{"__ignoreMap":149},[215],{"type":160,"value":210},{"type":154,"tag":155,"props":217,"children":219},{"id":218},"timeout-pattern",[220],{"type":160,"value":221},"Timeout Pattern",{"type":154,"tag":163,"props":223,"children":224},{},[225],{"type":160,"value":226},"Never wait forever:",{"type":154,"tag":175,"props":228,"children":230},{"className":177,"code":229,"language":98,"meta":149,"style":179},"function withTimeout\u003CT>(promise: Promise\u003CT>, ms: number): Promise\u003CT> {\n  const timeout = new Promise\u003Cnever>((_, reject) =>\n    setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms)\n  )\n  return Promise.race([promise, timeout])\n}\n\n\u002F\u002F Usage\nconst data = await withTimeout(fetchUserProfile(id), 5000)\n",[231],{"type":154,"tag":182,"props":232,"children":233},{"__ignoreMap":149},[234],{"type":160,"value":229},{"type":154,"tag":155,"props":236,"children":238},{"id":237},"bulkhead-pattern",[239],{"type":160,"value":240},"Bulkhead Pattern",{"type":154,"tag":163,"props":242,"children":243},{},[244],{"type":160,"value":245},"Isolate failures to prevent cascading:",{"type":154,"tag":175,"props":247,"children":249},{"className":177,"code":248,"language":98,"meta":149,"style":179},"class Bulkhead {\n  private active = 0\n\n  constructor(private maxConcurrent: number) {}\n\n  async execute\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n    if (this.active >= this.maxConcurrent) {\n      throw new Error('Bulkhead capacity reached')\n    }\n    this.active++\n    try {\n      return await fn()\n    } finally {\n      this.active--\n    }\n  }\n}\n\n\u002F\u002F Limit database calls to 10 concurrent\nconst dbBulkhead = new Bulkhead(10)\n",[250],{"type":154,"tag":182,"props":251,"children":252},{"__ignoreMap":149},[253],{"type":160,"value":248},{"type":154,"tag":155,"props":255,"children":257},{"id":256},"combining-patterns",[258],{"type":160,"value":259},"Combining Patterns",{"type":154,"tag":175,"props":261,"children":263},{"className":177,"code":262,"language":98,"meta":149,"style":179},"async function resilientCall\u003CT>(fn: () => Promise\u003CT>): Promise\u003CT> {\n  return retry(\n    () => circuitBreaker.execute(\n      () => withTimeout(fn(), 5000)\n    ),\n    { maxAttempts: 3 }\n  )\n}\n",[264],{"type":154,"tag":182,"props":265,"children":266},{"__ignoreMap":149},[267],{"type":160,"value":262},{"type":154,"tag":163,"props":269,"children":270},{},[271],{"type":160,"value":272},"Build for failure from day one. It's cheaper than fixing outages at 3am.",{"type":154,"tag":274,"props":275,"children":276},"style",{},[277],{"type":160,"value":149},{"title":149,"searchDepth":279,"depth":279,"links":280},2,[281,282,283,284,285,286],{"id":157,"depth":279,"text":161},{"id":170,"depth":279,"text":173},{"id":199,"depth":279,"text":202},{"id":218,"depth":279,"text":221},{"id":237,"depth":279,"text":240},{"id":256,"depth":279,"text":259}]