# modrain

> A WFM module providing client and backend for file support

Latest version **0.0.2** (published 2017-04-09) · Apache2.0 license · 0 weekly downloads

## Install

```sh
npm install modrain
pnpm add modrain
yarn add modrain
bun add modrain
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-04-09 |
| First published | 2017-04-09 |
| Weekly downloads | 0 |
| License | Apache2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | wtr@redhat.com |
| Maintainers | wtrocki |

## Links

- npm: https://www.npmjs.com/package/modrain
- npm.io page: https://npm.io/package/modrain

## Recent versions

- 0.0.2 (latest) — 2017-04-09
- 0.0.1 — 2017-04-09

## README

# ModRain [![Build Status](https://travis-ci.org/feedhenry-raincatcher/modrain.png)](https://travis-ci.org/feedhenry-raincatcher/modrain)

![img](http://emojipedia-us.s3.amazonaws.com/cache/5a/43/5a43da5a9f565929f17ea5eec6669acd.png) 


ModRain (Module Rain) modular architecture framework for modular client and server applications written in javascript/typescript.
Use microservices architecture for client and server side javascript apps.

## Idea

ModRain allows to write fully modularized javascript applications.
ModRain can be used for large scale frontend and node.js backend applications were reusability is expected.

## Quick start

Create new module (node.js app)

```
mkdir mymodule
cd mymodule
npm init
npm install modrain --save
touch index.js
```

#### Register module and create module interface.

```javascript
var modrain = require("modrain");

var MODULE_NAME = "user";
var ACTION = "create";
// Register new module in namespace
var userModule = modrain.registerModule(MODULE_NAME);
// We can unregister module as well
//var userModule = modrain.unregisterModule(MODULE_NAME);
// Using method interface
userModule.registerHandler(ACTION, function(userObject, callback){
  // Implementation to save userObject
  // ...
  callback(null, "success");
  // In case of error
  callback("error");
});
```
TODO Change API to register module with entire module interface passed as second parameter.

#### Consuming module

```javascript
var modrain = require("modrain");
modrain.getModule(user).call("create", userObject, function(err, result){
    // impl
});

// if global mount option is enabled
modrain.user.create(userObject, function(err, result){
     // impl
});
```

#### Consuming module - promises interface

```javascript
var modrain = require("modrain");
modrain.getModule(user).call("create",userObject).then(function(err, result){
    // impl
});
```

## Architecture

ModRain allows us to register modules into module registry and then define complete set of the actions on each module.

### Interfaces

- Callbacks
- Promises

Classical callback interface is supported by default
To enable promises use:

```
  npm install --save bluebird
  modrain.usePromises(true);
```

### Modules

Modules can expose functionality to our application.

### Transports

ModRain defines abstraction layer for module communications.
Modules can interact with each other using transport in the background.
Currently library supports following transports:

- Direct method calls (globals)
- Observer (ReactiveComponents)
- Publish/Subscribe (using mediator)
- HTTP (TODO)

### Promises

Using promise library

### Publish/Subscribe

Using mediator pattern and topics to register for some actions

## API

ModRain is under active development. API may change.

TODO

---
_Source: https://npm.io/package/modrain · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
