Brandfolder - JSON + Postgres

371 views

Published on

A talk by the Brandfolder CTO, Ryan Urabe, about how Brandfolder uses JSON and Postgres to simplify it's back-end system.

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Wouldn't it be sick if this prezo updated with our new logo? #apiallofthethings
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

No Downloads
Views
Total views
371
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Brandfolder - JSON + Postgres

  1. 1. Ryan Urabe, CTO ryan@brandfolder.com @rurabe CSAwesomefest September 23, 2013
  2. 2. Tech Stack Client side Server side
  3. 3. Tech Stack JS Client side Server side
  4. 4. Tech Stack Client side Server side
  5. 5. Tech Stack Client side Server side
  6. 6. Tech Stack Client side Server side
  7. 7. Tech Stack Client side Server side
  8. 8. JSON Client side Server side
  9. 9. JSON JSON Client side Server side
  10. 10. JSON Client side Server side
  11. 11. JSON SQL+JSON Client side Server side
  12. 12. Schema Brandfolder Logos Images Documents People Fonts Colors Videos Press Texts • name • desc • name • desc • name • desc • name • bio • phone • email • twitter • linkedin • name • desc • googID • otherID • name • desc • cmyk • rgb • pnt • hex • name • desc • url • name • desc • url • title • body
  13. 13. SingleTable Inheritance Brandfolder Assets • type • name • desc
  14. 14. SingleTable Inheritance Brandfolder Assets • type • name • desc • phone • email • twitter • linkedin • cmyk • rgb • pnt • hex • url • googID • otherID
  15. 15. SingleTable Inheritance Brandfolder Assets • type • name • desc • phone • email • twitter • linkedin • facebook • aboutMe • cmyk • rgb • pnt • hex • hsla • url • source • googID • fontsID • adobeID • otherID • etc • etc
  16. 16. SingleTable Inheritance + JSON Brandfolder Assets • type • name • desc • data => JSON
  17. 17. Code class Asset < ActiveRecord::Base attr_accessible :name, :description include DataDelegator # the secret sauce!!! end class Video < Asset attr_accessible :url data_delegate :only=> [:url] # moar secrets!!! end
  18. 18. Alternatives • HSTORE – Supported by ActiveRecord > 4.0 – Can’t nest • BATF – Works with any data store – Need to serialize – Can’t manipulate or query in the DB
  19. 19. Extending Postgres JSON • Index the JSON • Query records by values stored in the JSON
  20. 20. More Postgres + JSON • Postgres can also serialize records natively, returning a string of valid JSON. – Does not require the instantiation of Ruby objects – FAST
  21. 21. Even more • You can installV8 in Postgres and write custom query functions in Javascript – Awesome – Web developers are already familiar with it
  22. 22. Ryan Urabe, CTO ryan@brandfolder.com @rurabe CSAwesomefest September 23, 2013

×