Skip to content

Latest commit

 

History

History
72 lines (57 loc) · 1.48 KB

README.md

File metadata and controls

72 lines (57 loc) · 1.48 KB

rzr

(razor) is a razor-thin functional application framework

Core Components

rzr consists of 3 core components: Services, Models and Agents

Services are the verbs in your stories- the actions that happen.

login = Service ->
  @in 
    user: X @User
  @out
    user: @find @user
    token: generateToken()

**Models** are the _nouns_ in your stories- the _things_ that are important
User = Model
  name: @string.length.min.3
  password: @password.min.12

**Agents** expose Models and Services, and communicate with other Agents
UserAgent = Agent ->
  @collab SomeOtherAgent
  @expose login, User

Modules

a Module is a collection of related Models and Services (and their specs), with one Agent governing the Module.
Modules can be nested within other Modules with arbitrary depth, with a folder within your /projectRoot/domain/ directory representing a module

Specs

Specs are executable specifications that specify some behavior that needs to be fulfilled and every service has at least one Spec. Spec support is provided by the Spex framework

Control Structures

series

run Services in series

series
  delay
    timeout: 5
    cb: -> console.log "5"
  delay
    timeout: 2
    cb: -> console.log "2"

# 5
# 2

chain

run Services in series, passing output of one to the next

chain
  login
    user: user  
  handleLogin