Middleware Stream Architecture – with Asyncrush

Hello everyone!

Async data is everywhere these days—chat apps, IoT, real-time dashboards—and I’ve been thinking there’s got to be a better way to handle it.
So, I came up with something I’m calling the Middleware Stream Architecture, and I’ve built …


This content originally appeared on DEV Community and was authored by miinhho

Hello everyone!

Async data is everywhere these days—chat apps, IoT, real-time dashboards—and I’ve been thinking there’s got to be a better way to handle it.
So, I came up with something I’m calling the Middleware Stream Architecture, and I’ve built it into a little project called Asyncrush.

It’s my first stab at rethinking async streaming to be faster, more flexible, and honestly, just more fun to work with. If this is your first time hearing about it, stick with me—I’ll walk you through what it’s all about and why I think it’s pretty cool.

Streams + Middleware = Magic

The big idea here is dead simple: take a data stream and plug middleware into it to shape it however you want. You know those moments when messages are flying in or sensor data won’t stop coming? Imagine having a tool that lets you tweak that flow on the fly. That’s where middleware comes in.

If you’ve used Express.js, you’re probably familiar with middleware—those handy little functions that tweak requests as they pass through.
I thought, “Why not bring that vibe to async streaming?” With Asyncrush, you can drop middleware into the stream to transform data, pause it, or even split it off to multiple places. It’s like giving your data stream superpowers.

What Makes It Different?

I’ve played with tools like RxJS (and don’t get me wrong, they’re so awesome), but sometimes they feel like overkill—too complex, too heavy. I wanted to fix that. Here’s how I designed this architecture

  • Speedy and Light:
    I cut out the extra fluff to keep things lean. The more data you throw at it, the more you’ll notice how zippy it is compared to the usual suspects.

  • Bend It Your Way:
    Pause it, slow it down, tweak the data—whatever you need, you’re in control. It’s like a stream you can tune like a guitar.

  • Real-World Ready:
    From handling errors to sending data to multiple spots, it’s built for the messy stuff we actually deal with in real apps.

How fast is it?

performance-benchmark

(Tested for 1,000,000,000 events)

Transforms Library CPU Time ops/sec
100 Asyncrush 164.34 24,303,961
100 RxJS 1382.41 2,888,290
50 Asyncrush 95.83 41,697,872
50 RxJS 570.45 6,994,585
30 Asyncrush 62.23 64,330,462
30 RxJS 323.44 12,326,413
20 Asyncrush 48.53 82,466,609
20 RxJS 209.23 19,084,753
10 Asyncrush 34.88 114,760,479
10 RxJS 108.23 36,885,747
6 Asyncrush 29.36 135,840,204
6 RxJS 66.03 60,424,832
2 Asyncrush 24.36 164,219,864
2 RxJS 27.05 147,904,265

GitHub logo miinhho / Asyncrush

library for streaming and processing asynchronous events with ease

Asyncrush

High Performance Middleware Streams 🏎️

Asyncrush is a high-performance stream processing library that leverages the middleware pattern inspired by RxJS. Unlike traditional stream libraries, Asyncrush connects middleware using pure functions instead of operators, offering a flexible, efficient, and scalable approach to stream processing. It dramatically improves performance while minimizing memory usage, making it the ideal choice for high-throughput applications.


⚡ Key Features

  • Blazing Fast Performance: Achieves up to 2x faster performance compared to traditional stream libraries.
  • Middleware-based Stream Control: Process streams with middleware instead of operators, allowing for dynamic error handling, custom retry policies, and advanced state management.
  • Memory Efficiency: Minimized object creation and small code size lead to significant reductions in memory consumption.
  • Developer-Friendly API: The pure function-based API ensures that the library is easy to understand, use, and maintain.
  • Built-in Error Handling & Backoff: Automatic error handling and backoff strategies allow for…

How Does It Roll?

Picture a river flowing with data—that’s your stream. Now imagine adding some gear to it:

  1. Middleware: Slap a filter on that river to clean up the water or dye it blue—aka process your data.
  2. Flow Control: Build a dam to hold it back or let it trickle out, keeping things from flooding your app.
  3. Splitting It Up: Divvy the river into streams for different towns—one stream feeding multiple endpoints, no sweat.

The best part? It all works together seamlessly. No crazy setup—just plug in and go.

Where It Shines

Here’s where I see it making a difference:

  1. Chat Apps: Messages streaming in fast? Filter out the trolls with middleware and blast it to every user at once.
  2. Big Data Crunching: Need speed without losing control? Asyncrush handles it like a champ.

Why I’m Hyped About It

Building this, I kept thinking, “I don’t want devs to dread async streams.” Some tools make you jump through hoops or study a novel’s worth of docs. Not this. Asyncrush feels like grabbing a handful of Lego blocks—you snap together what you need, and it just works. Fast. Flexible. Ready for real projects.

What’s Next?

This is my first go at it, so it’s still fresh out of the oven. I’d love for you to kick the tires—tell me what you think, where it could level up. Real-time apps are taking over, and I believe this architecture could be a game-changer for async data. Want to build it with me? Let’s chat in the comments!


This content originally appeared on DEV Community and was authored by miinhho


Print Share Comment Cite Upload Translate Updates
APA

miinhho | Sciencx (2025-02-28T09:14:13+00:00) Middleware Stream Architecture – with Asyncrush. Retrieved from https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/

MLA
" » Middleware Stream Architecture – with Asyncrush." miinhho | Sciencx - Friday February 28, 2025, https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/
HARVARD
miinhho | Sciencx Friday February 28, 2025 » Middleware Stream Architecture – with Asyncrush., viewed ,<https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/>
VANCOUVER
miinhho | Sciencx - » Middleware Stream Architecture – with Asyncrush. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/
CHICAGO
" » Middleware Stream Architecture – with Asyncrush." miinhho | Sciencx - Accessed . https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/
IEEE
" » Middleware Stream Architecture – with Asyncrush." miinhho | Sciencx [Online]. Available: https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/. [Accessed: ]
rf:citation
» Middleware Stream Architecture – with Asyncrush | miinhho | Sciencx | https://www.scien.cx/2025/02/28/middleware-stream-architecture-with-asyncrush/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.