Download - Node @ flipkart
Node @ Flipkart
Abhinav Rastogi@_abhinavrastogi
!jQueryIf you think jQuery is the answer,
you lose a cookie and get an F grade!
Picking one is difficult!Plus its never exactly what you need
How we built a web stack in Node...
It’s really not that difficult
Node in ProductionNow this is a different story altogether
PhilosophyA web stack to build rich UIs for the next generation,
embracing progressive enhancement.
Request
Session API
JSON
Rendering
Templates
Response
Product API
Search API
Cart APIPromises
HTML
Why Node?And that too in production? :O
Parallel, AsyncHuge benefit right there over conventional stacks
Light weightBest available JS execution env
Good communityBuzzing like a beehive
“There’s a module for that”No, there really is.
Challenges we faced(So many of them!)
Code MaintainabilityWhat does it really mean?
Klass, LodashFor classy code B-)
High AvailabilityAs they say, 99.99% uptime guaranteed!
But is it really?
Keep that process runningForever
PM2
Shell Script!
TestabilityUgh… test cases :(
Test it!Mocha, Chai, Istanbul
PerformanceSo much to do… so little time
Profile it. Look, DTrace, Event Loop
Code ReusabilityNot just modules, but so much more now
ComponentsCommonJS
TemplatingJade, Handlebars, Underscore
ReactJSDoes all that, and more
Write once, run anywhere!Sh*t... that sounds like Java
Rendering on Server
Cacheable
Reliable
SEO friendly
Optimised First Paint
Rendering on Client
Less load on server
Perceived Performance
Rich UIs
Whoa.. easy thereLogging
Env specific code
External HTTP requests
ResponsivenessUseful? Needed? Required?
Or just a fancy fad?
Cross-device/browserIE? Android 2.3? Cloud browsers?
K.I.S.S!
Fanboyism?Close, but no :P
Why not Node?The other side of the story
Relatively newMany unsolved problems
“There’s a module for that”
Its an Android Play Store…Not an Apple App Store
</3Not for the weak-hearted
Productionizing NodeScrew best practices. Whatever works is best.
Monitor and Alert!Nagios, Monit
Log it.Bunyan, Winston
Server Health and Rotation Status
Keep the difference in mind!
QPS vs ConcurrencyWait, aren’t they the same?
Recap
Node in Production
Isomorphism
Useful tools and modules
Thank you@_abhinavrastogi