All Projects → thoughtbot → superglue

thoughtbot / superglue

Licence: MIT license
A productive library for Classic Rails, React and Redux

Programming Languages

javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to superglue

React on rails
Integration of React + Webpack + Rails + rails/webpacker including server-side rendering of React, enabling a better developer experience and faster client performance.
Stars: ✭ 4,815 (+4442.45%)
Mutual labels:  ruby-gem, redux-store, react-components, npm-module, react-rails, ruby-on-rails
Matestack Ui Core
Matestack enables you to create sophisticated, reactive UIs in pure Ruby, without touching JavaScript and HTML. You end up writing 50% less code while increasing productivity, maintainability and developer happiness.
Stars: ✭ 469 (+342.45%)
Mutual labels:  ruby-gem, ruby-on-rails
Cloudinary gem
Cloudinary GEM for Ruby on Rails integration
Stars: ✭ 394 (+271.7%)
Mutual labels:  ruby-gem, ruby-on-rails
Ransack
Object-based searching.
Stars: ✭ 5,020 (+4635.85%)
Mutual labels:  ruby-gem, ruby-on-rails
Loaf
Manages and displays breadcrumb trails in Rails app - lean & mean.
Stars: ✭ 360 (+239.62%)
Mutual labels:  ruby-gem, ruby-on-rails
Pattern
A collection of lightweight, standardized, rails-oriented patterns.
Stars: ✭ 377 (+255.66%)
Mutual labels:  ruby-gem, ruby-on-rails
Motion
Reactive frontend UI components for Rails in pure Ruby
Stars: ✭ 498 (+369.81%)
Mutual labels:  ruby-gem, ruby-on-rails
slack widgets
An abstraction of the JSON structure needed to create widgets in Slack message attachments
Stars: ✭ 14 (-86.79%)
Mutual labels:  ruby-gem, ruby-on-rails
Mailjet Gem
[API v3] Mailjet official Ruby GEM
Stars: ✭ 119 (+12.26%)
Mutual labels:  ruby-gem, ruby-on-rails
Rorvswild
Ruby on Rails app monitoring: performances & exceptions insights for rails developers.
Stars: ✭ 159 (+50%)
Mutual labels:  ruby-gem, ruby-on-rails
Filestack Rails
Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
Stars: ✭ 220 (+107.55%)
Mutual labels:  ruby-gem, ruby-on-rails
delayed-web
A rails engine that provides a simple web interface for exposing the Delayed::Job queue.
Stars: ✭ 71 (-33.02%)
Mutual labels:  ruby-gem, ruby-on-rails
katapult
Kickstart Rails development!
Stars: ✭ 21 (-80.19%)
Mutual labels:  ruby-gem, ruby-on-rails
Devise masquerade
Extension for devise, enable login as functionality. Add link to the masquerade_path(resource) and use it.
Stars: ✭ 380 (+258.49%)
Mutual labels:  ruby-gem, ruby-on-rails
arask
Automatic RAils taSKs.
Stars: ✭ 31 (-70.75%)
Mutual labels:  ruby-gem, ruby-on-rails
fetch-action-creator
Fetches using standardized, four-part asynchronous actions for redux-thunk.
Stars: ✭ 28 (-73.58%)
Mutual labels:  react-redux, npm-module
rails cursor pagination
Add cursor pagination to your ActiveRecord backed application
Stars: ✭ 21 (-80.19%)
Mutual labels:  ruby-gem, ruby-on-rails
filtered
Filters ActiveRecord queries in a nice way
Stars: ✭ 28 (-73.58%)
Mutual labels:  ruby-gem, ruby-on-rails
Sidekiq Cron
Scheduler / Cron for Sidekiq jobs
Stars: ✭ 1,383 (+1204.72%)
Mutual labels:  ruby-gem, ruby-on-rails
react-native-boilerplate
A collection of curated and well maintained React Native boilerplates with various possibilities and combinations.
Stars: ✭ 24 (-77.36%)
Mutual labels:  react-components, react-redux

Superglue

Use classic Rails to build rich React Redux applications with NO APIs and NO client-side routing.

Build Status

Superglue is a React Redux starter and library inspired by Turbolinks and designed to complement classic Rails. You can enjoy the benefits of Redux state management and React components without giving up the productivity of Rails form helpers, UJS, tag helpers, the flash, cookie auth, and more.

Caution

This project is in its early phases of development. Its interface, behavior, and name are likely to change drastically before a major version release.

No APIs

Instead of APIs, Superglue leans on Rail's ability to respond to different mime types on the same route. In a Superglue application, if you direct your browser to /dashboard.html, you would see the HTML version of the content, and if you went to /dashboard.json you would see the JSON version of the exact same content down to the footer.

The end result would be something like this:

No Apis

Powered by Classic Rails

Superglue is mostly classic Rails. Features like the flash, cookie auth, and URL helpers continue to be useful. Here's a look at the directory structure of a typical Rails application with Superglue.

MyRailsApp/
  app/
  views/
  dashboard/
    index.html.erb <- Mostly empty. Where `index.json.props` gets rendered as initial state
    index.js <- Your page component, will receive `index.json.props`. Gets packaged with application.js
    index.json.props <- will also respond to `.json` requests

PropsTemplate

Powering these JSON responses is PropsTemplate, a traversable JSON templating DSL inspired by JBuilder. With PropsTemplate you can specify a path of the node you want, and PropsTemplate will walk the tree to it, skipping the execution of nodes that don't match the keypath.

No Apis

All together now!

Superglue comes with batteries that bring all the above concepts together to make building popular SPA features easy, painless, and productive.

SPA Navigation

A popular ask of SPAs is page-to-page navigation without reloading. This is easily done with Superglue's own UJS attributes inspired by Turbolinks:

  <a href='/posts' data-sg-visit={true} />

The above will request for /posts with an accept of application/json, and when the client receives the response, swap out the current component for the component the response asks for, and pushState on history.

Partial updates

Some features rely on updating some parts of the existing page. In addition to data-sg-visit and it's equivalent this.props.visit, Superglue also provides data-sg-remote or this.props.remote, which you can use to update parts of your page in async fashion without changing window.history.

Imagine having to implement search, where you enter some text, hit enter, and results would show without reloading the screen. In traditional applications, you may need a new controller, routes, a discussion over versioning, JSON serializer, plenty of new JS code, etc.

haircuts

With Superglue, this can be done in one line:

  this.props.remote('/dashboard?qry=haircut&props_at=data.header.search')

The above will make a request to /dashboard?qry=haircut, walk your props to the data.header.search node, return it in the response, and immutably graft it in the exact same path on the redux store before finally letting React re-render.

For more on what you can do, check out our documentation.

Server-Side Rendering

Server-Side Rendering is supported via Humid. See the documentation for server-side rendering.

Documentation

Documentation is hosted on Github pages.

Contributing

See the CONTRIBUTING document. Thank you, contributors!

Special Thanks

Thanks to jbuilder, scour, turbolinks3, turbograft, turbostreamer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].