Asynchronous
Built from the ground up for concurrency using Async, Fibers and an event loop. Your code still looks synchronous though.
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.
Built from the ground up for concurrency using Async, Fibers and an event loop. Your code still looks synchronous though.
Observe and respond to events
observe '/:id'
def render(event: RouteEvent)
event.params[:id] # => 123
end
Inline type checking and annotations
def method(var: String)
Embed HTML inside Ruby, embed nodes within nodes.
def render
<html><{ ChildNode }></html>
end
Immutable nodes designed for parallel execution
<{ parallelize: }>
<{ UserNode user=@user }>
<{ PostsNode posts=@posts }>
<{ :parallelize }>
Build SQL queries compositionally
Posts[:title, :body] + Users[:username]
Results in a list of posts with each post's user nested inside it.
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.