Top Banner
The Grail: React based Isomorph apps framework Eldar Djafarov [email protected] @edjafarov github.com/edjafarov
24

"The Grail: React based Isomorph apps framework" Эльдар Джафаров

Jul 18, 2015

Download

Technology

fwdays
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

The Grail: React based Isomorph apps framework

Eldar Djafarov

[email protected] @edjafarov github.com/edjafarov

Page 2: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

isomorphic webapps vs SPA?

• Performance

• Maintainability

• Testability

• SEO

Page 3: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

existing isomorphic solutions

• Meteor.js

• Rendr

• Derby

Page 4: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

• rendering

• routing

• business logic

• resources

router business logic stores

view

resourceRESTAPI

How the isomorphic app should look like?

Page 5: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic rendering

Page 6: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic renderingReact

converts the state into DOM

state virtualdom DOM

describe how your state is rendered declaratively and make your business logic manipulate state

instead of view

Page 7: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic rendering

Page 8: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

How the isomorphic app should look like?

• rendering

• routing

• business logic

• resources

router business logic stores

view

resource

router business logic stores

view

resource

Page 9: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic routing

Page 10: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic routing

Page 11: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

How the isomorphic app should look like?

• rendering

• routing

• business logic

• resources

router business logic stores

view

resource

router business logic stores

view

resource

Page 12: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic business logic

• get Items

• render Screen

• validate incoming Item

• save Item

• get updated Items

• handle Error is save failed

• render Screen

Fetch data Save data

Page 13: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic business logic

• getItems

• renderScreen

• validateItem

• saveItem

• getItems

• handleError

• renderScreen

Fetch data Save data

Page 14: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic business logicThe PromisePipes

Page 15: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic business logicThe PromisePipes

Page 16: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

How the isomorphic app should look like?

• rendering

• routing

• business logic

• resources

router business logic stores

view

resource

router business logic stores

view

resourceRESTAPI

Page 17: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic resources

Page 18: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

client vs serverthe difference

• context

• resource caching

• for server, get is enough

Page 19: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

what about modules?

• npm

• node require

• npm

• browserify/webpack

Server Client

Page 20: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

The Grail app DEMO

https://grail-todomvc.herokuapp.com/

src: https://github.com/edjafarov/grailjs

Page 21: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

there is no server

- Do not try and code the isomorphic backend. That's impossible. Instead... only try to realize the truth. - What truth? - There is no server.

Page 22: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

• rendering

• routing

• business logic

• resources

router business logic stores

view

How the isomorphic app should look like?

Page 23: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

Isomorphic business logic

validate

validate allowIf(‘canSave’) db.saveTo(‘Item’)

db.get(‘Item’,{})emit(‘items’)catch(‘items:fail’)

client server

Page 24: "The Grail: React based Isomorph apps framework" Эльдар Джафаров

QA

[email protected] @edjafarovgithub.com/edjafarov

https://github.com/edjafarov/grailjs