Raindeer logo, an illustrated deer with large antlers

Raindeer is an event-driven framework using the dynamic features and latest async improvements in Ruby + some weird ideas, to build a new breed of web application.

Deer to be different.

Getting Started

Asynchronous

Built from the ground up for concurrency using Async, Fibers and an event loop. Your code still looks synchronous though.

Event-driven

Observe and respond to events

observe '/:id'

def render(event: RouteEvent)
  event.params[:id] # => 123
end

Types

Inline type checking and annotations

def method(var: String)
  • Optional
  • Enable/disable per environment
  • Export to RBS

Composition

Embed HTML inside Ruby, embed nodes within nodes.

def render
  <html><{ ChildNode }></html>
end

Parallelism

Immutable nodes designed for parallel execution

<{ parallelize: }>
  <{ UserNode user=@user }>
  <{ PostsNode posts=@posts }>
<{ :parallelize }>

Data Expressions

Build SQL queries compositionally

Posts[:title, :body] + Users[:username]

Results in a list of posts with each post's user nested inside it.

A Sudoku grid with some squares filled in blue

Raindeer was born out of a Sudoku solver...

It wasn't extracted from a traditional web application, but created from first principles of what an easy to use yet performant framework would be.

See Architecture

Technical Case Study

Raindeer's architecture through the flow of a simple form:

<{ form: '/submit' }>
  <input type="submit" value="Submit">
<{ :form }>

When the browser sends this form it makes a request, which goes through each part of Raindeer in turn:

sequenceDiagram
  autonumber
  participant RequestEvent
  participant Protection as CrossOriginProtection
  participant Router
  participant Node
  participant ResponseEvent

  RequestEvent->>Protection: request(event:)
  alt Good Path
    Protection->>Router: RequestEvent
    Router->>Node: ReceiveEvent (form body)
    Node->>ResponseEvent: A redirect
  else Bad Path
    Protection->>ResponseEvent: 403
  end

Each part of the request-response lifecycle has a single responsibility:

In other frameworks something like CrossOriginProtection would be mixed in with the router. With Raindeer and observers it's just another observer on a RequestEvent.

See Middleware

Diff

Traditional−5
Raindeer+7
1−Rack
1+Event Loop
2−Model-View-Controller
2+Composition
3−Namespaces
4−Individual template files
5−Build steps
3+Inline types (optional)
5+Events
6+Pipelines
7+Repository pattern