Introduction to RethinkDB and Horizon.js

Preview:

Citation preview

RethinkDB, horizon

RethinkDB, horizon

Introduction to create the real time web application.

RethinkDB, horizon

About me

@chuck0523

25yo like JavaScript

Junior Front-End developer

0

25

50

75

100

HTML CSS JavaSript Ruby PHP

RethinkDB, horizon

My skills

RethinkDB, horizon

My recent job

‣ Create SPA by React, Redux, CSS Modules, PostCSS with Webpack, on Rails as API server.

RethinkDB, horizon

It’s on Medium

RethinkDB, horizon

That’s it about me

RethinkDB, horizon

Let’s dive into RethinkDB & horizon!!

The open-source database

for the realtime web

RethinkDB, horizon

RethinkDB

RethinkDB, horizon

RethinkDB

‣ OpenSource NoSQL DB

‣ Since July 2009

‣ For realtime web app

‣ Written in C++

‣ Stores JSON

‣ 15000 stars on Github

RethinkDB, horizon

ReQL

RethinkDB is using ReQL (DSL)

Available in Java, Ruby, Python, JavaScript

RethinkDB, horizon

SQL to ReQL

Insert in SQL

RethinkDB, horizon

SQL to ReQL

Insert in ReQL

RethinkDB, horizon

Select statement

SQL ReQL

RethinkDB, horizon

Update statement

SQL ReQL

RethinkDB, horizon

Delete statement

SQL ReQL

RethinkDB, horizon

Joins in ReQL

RethinkDB, horizon

Aggregation in ReQL

“Group by” in SQL

RethinkDB, horizon

Totally NoSQL.

Seems to be super easy and fun!

RethinkDB, horizon

That’s all about ReQL

RethinkDB, horizon

How can we start ?

RethinkDB, horizon

$ brew install rethinkdb

RethinkDB, horizon

RethinkDB in Rails

https://www.rethinkdb.com/docs/rails/

RethinkDB, horizon

RethinkDB in Others

https://github.com/rethinkdb/?utf8=%E2%9C

You can also use Angular, Express, Node…

The realtime JavaScript backend

RethinkDB, horizon

Horizon.js

RethinkDB, horizon

Horizon.js

‣ OSS JavaScript Framework

‣ Created by RethinkDB ppl

‣ On RethinkDB and Node.js

‣ Subscribes App state

‣ Using RxJS Internally

‣ Auth and Permission

RethinkDB, horizon

Let’s take a look at sample code

RethinkDB, horizon

Two core classes in Horizon.js

RethinkDB, horizon

1. Horizon class

‣ Horizon class takes care of instantiation and management connection

‣ Pass a string to object of Horizon class, then collection is returned

RethinkDB, horizon

1. Horizon class

RethinkDB, horizon

2. Collection class

‣ Collection class deals with create, read, update and delete data

‣ Some methods return RxObservable, which enables us to use RxObservable’s methods

RethinkDB, horizon

Collection.store

RethinkDB, horizon

Collection.watch

RethinkDB, horizon

Rx returnable methods

‣ Collection.watch returns RxObservable

‣ We can use RxObservable’s method

‣ map, filter, mergeMap, toArray…

RethinkDB, horizon

Collection.methods are for Back-end (RethinkDB).

RxObservable.methods are for Front-end (React or something).

RethinkDB, horizon

https://www.rethinkdb.com/docs/sharding-and-replication/

We got basic of RethinkDB & Horizon.js now

http://horizon.io/docs/getting-started/

RethinkDB, horizon

It’s time to DEMO

RethinkDB, horizon

Thanks for listening

Codes of DEMO are on Github repo. You can pull and try it.

https://github.com/chuck0523/learning-langs/tree/gh-pages/js/reChat

Recommended