Code Monkey home page Code Monkey logo

docs's Introduction

Introduction

Marble.js is a functional reactive Node.js framework for building server-side applications, based on TypeScript and RxJS.

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.

The purely functional languages like Haskell express side effects such as IO and other stateful computations using monadic actions. With the big popularity of RxJS Observable monad, 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. Marble.js is a functional reactive framework, that's why _RxJS is a first class citizen here. It’s a much more powerful and feature-rich monad than IO that implements the basic abstract interface as well as a ton of additional functionalities for manipulating sequences of events over time.

When looking at Marble.js you can ask: "Why do we need RxJS for HTTP?". Despite the single event nature of basic HTTP, there are no contradictions against using it for single events. In Marble, RxJS is used as a hammer for expressing asynchronous flow with monadic manner, even if you have to deal with only one event passing over time. Marble.js doesn't operate only over basic HTTP protocol but can be used also for both WebSocket and event sourcing purposes, where the multi-event nature fits best. Don't be scared of the complexity and abstractions presented in RxJS API β€” the 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, @ngrx/effects or other libraries that leverage functional reactive paradigm, you will feel like in 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 or with The introduction to Reactive Programming you've been missing written by @andrestaltz. {% endhint %}

Installation

Marble.js requires node v8.0 or higher:

$ npm i @marblejs/core rxjs

or if you are a hipster:

$ yarn add @marblejs/core rxjs

Examples

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

{% page-ref page="overview/how-does-it-fit-together.md" %}

To view the example project, visit the example repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.