# Marble.js

![](https://2581877486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDJBj_wmPCqlDAVfkHc%2F-M-RhBvK9ukiMynMZP51%2F-M-RjDKDVCrV6h6A9YmT%2Fwallpaper.jpg?alt=media\&token=61fce03d-aa49-49c0-931b-33f706c09ea2)

## Philosophy

The core concept of **Marble.js** assumes that almost everything is a stream. The main building block of the whole framework is an Effect, which is just a function that returns a stream of events. With the big popularity of [RxJS](http://rxjs.dev) Observable, you can create a referential transparent program specification made up of functions that may produce side effects like network, logging, database access, etc. Using its monadic nature we can map I/O operations over effects and flat them to bring in other sequences of operations. RxJS is used as a hammer for expressing asynchronous flow with monadic manner.

![](https://2581877486-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDJBj_wmPCqlDAVfkHc%2F-M-aVp1qrLX_B1aCqOhr%2F-M-axbtvmhpoToC-gktV%2FEffect.jpg?alt=media\&token=be31fb45-9634-4331-b95b-e55083648318)

Marble.js doesn't operate only over basic [HTTP](https://marblejs.gitbook.io/docs/http/effects) protocol but can be used also for general MDA (Message-Driven Architecture) solutions, including [WebSocket](https://marblejs.gitbook.io/docs/messaging/websockets), [microservices](https://marblejs.gitbook.io/docs/messaging/microservices) or [CQRS](https://marblejs.gitbook.io/docs/messaging/cqrs), where the multi-event nature fits best. Don't be scared of the complexity and abstractions — Marble.js framework, in general, is incredibly simple. For more details about its specifics, please visit the next chapters that will guide you through the framework environment and implementation details.

> *For those who are curious about the framework name - it comes from a popular way of visually expressing the time-based behavior of event streams, aka marble diagrams. This kind of domain-specific language is a popular way of testing asynchronous streams, especially in RxJS environments.*

{% hint style="success" %}
👉 If you have ever worked with libraries like [Redux Observable](https://redux-observable.js.org), [@ngrx/effects](https://github.com/ngrx/platform/blob/master/docs/effects/README.md) or other libraries that leverage functional reactive paradigm, you will feel at home.
{% endhint %}

{% hint style="info" %}
👉 If you don't have any experience with functional reactive programming, we strongly recommend to gain some basic overview first with [ReactiveX intro](http://reactivex.io/intro.html) or with [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754) written by [@andrestaltz](https://twitter.com/andrestaltz).
{% endhint %}

## Previous articles

{% embed url="<https://medium.com/@jflakus/announcing-marble-js-3-0-a-marbellous-evolution-ba9cdc91d591>" %}

{% embed url="<https://medium.com/@jflakus/marble-2-reactive-better-functional-stronger-5924119d3098>" %}

{% embed url="<https://medium.com/@jflakus/marble-js-when-node-js-meets-rxjs-da2764b7ca9b>" %}

## Examples

If you would like to get a quick glimpse of a simple RESTful API built with Marble.js, visit the following link:

{% content-ref url="other/how-does-it-glue-together" %}
[how-does-it-glue-together](https://marblejs.gitbook.io/docs/other/how-does-it-glue-together)
{% endcontent-ref %}
