Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
view-source:https://twitter.com
Search
Giuseppe Gurgone
January 25, 2017
Technology
510
0
Share
view-source:https://twitter.com
A very brief overview of twitter.com's frontend architecture
Giuseppe Gurgone
January 25, 2017
More Decks by Giuseppe Gurgone
See All by Giuseppe Gurgone
Babel Plugins 101
giuseppe
0
150
CSS in JS | Tech Movie Night vol.4
giuseppe
0
36
styled-jsx
giuseppe
5
3k
CSS convo over lunch
giuseppe
1
150
Other Decks in Technology
See All in Technology
Claude Code で使える DuckDB Skills を試してみた / DuckDB Skills and Claude Code
masahirokawahara
1
1.2k
コーディングエージェントはTypeScriptの 型エラーをどう自己修正しているのか
melonps
2
190
AWS運用におけるAI Agent活用術 / JAWS-UG 神戸 #11 LT大会
genda
1
310
LookerとADKで作る社内AIエージェント
chanyou0311
0
280
論文紹介:Pixal3D (SIGGRAPH 2026)
tenten0727
0
590
[4] Power BI Deep Dive [2026-05]
ohata_bi
0
100
JaSSTに関わることで変わった人生観 #jasstnano
makky_tyuyan
0
150
React Compiler導入の効果と運用の工夫
kakehashi
PRO
3
290
R&D 祭 2024 アニメエフェクト作成の効率化
olmdrd
PRO
0
100
freeeで運用しているAIQAについて
qatonchan
1
650
TypeScript の型で副作用の実行順序を制御する
yanaemon
0
110
20260516_SecJAWS_Days
takuyay0ne
2
520
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.2k
Marketing to machines
jonoalderson
1
5.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Building the Perfect Custom Keyboard
takai
2
770
Google's AI Overviews - The New Search
badams
0
1k
ラッコキーワード サービス紹介資料
rakko
1
3.3M
Practical Orchestrator
shlominoach
191
11k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
110
The untapped power of vector embeddings
frankvandijk
2
1.7k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
810
Transcript
view-source:https://twitter.com A very brief overview of twitter.com’s frontend architecture
None
@giuseppegurgone 2009
2010 @giuseppegurgone
2010 @giuseppegurgone
@giuseppegurgone 2010 #!NewTwitter Fully Client Side Application jQuery, Mustache, LABjs,
Modernizr Home grown MVC “Necessary complexity” – Dan Webb
2012 @giuseppegurgone
@giuseppegurgone 2012 Expandable tweets
@giuseppegurgone 2012 Inline Previews – Previeweet
Journey into twitter.com’s source code @giuseppegurgone Previeweet https://github.com/giuseppeg/Previeweet Reverse engineering
Minified code Learnt a ton !0 ~ ,
@giuseppegurgone Previeweet last iteration pre–cards
@giuseppegurgone @danwrong yey! The future is coming and it looks
just like the past, but more good underneath. — Tom Lea (@cwninja) May 23, 2012 Server side rendering – 4x faster Progressive Enhancement Flight.js – Component based UI framework CommonJS + AMD via Loadrunner hashbang #! Hello PushState
@giuseppegurgone Architecture Flight.js – Twitter’s JS Framework Code splitting (bundles)
App initialization (bootstrapping) Routing
function inbox() { this.attributes({ myProp: 'hi' }) this.doSomething = function
() { this.trigger(document, 'uiDoingSomething') /* ... */ } // after initializing the component this.after('initialize', function () { this.on('click', this.doSomething) }) } var Inbox = flight.component(inbox) /* Attach the component to a DOM node */ Inbox.attachTo('#inbox', { myProp: 'hello' }) Flight.js A component-based, event-driven JavaScript framework @giuseppegurgone
Flight.js Components @giuseppegurgone Get a reference to a node this.$node
Organised in UI and Data components Decoupled – trigger and subscribe to DOM events Isolated and easy to test and reason about
@giuseppegurgone Flight.js Components
Code Splitting Bundles @giuseppegurgone
var UiTimeline = require('components/ui/Timeline') var DataTimeline = require('components/data/Timeline') /* ...
*/ function init(initData) { /* Attach components to DOM nodes */ UiTimeline.attachTo('#timeline', initData.timeline) DataTimeline.attachTo('#timeline', initData.timeline) /* ... */ } module.exports = init Code Splitting Bundles @giuseppegurgone
<input type="hidden" id="init-data" class="json-data" value="{ App data in JSON }">
<input type="hidden" class="swift-boot-module" value="app/pages/permalink"> <input type="hidden" id="swift-module-path" value="https://abs.twimg.com/c/swift/en"> <script src="https://abs.twimg.com/k/en/init.en.38255812c7627517cc63.js" async> </script> App Initialization Bootstrapping @giuseppegurgone
/* Grab initial data */ var initData = {} try
{ initData = $.parseJSON( $('#init-data').val() ) } catch (e) {} /* Grab modules base path */ var basePath = using.path = $('#swift-module-path').val() /* Grab modules names */ var modules = $('.swift-boot-module').map(function (_, module) { return module.val() }).toArray() /* require modules and call their exported function (init) with initData */ using(modules, function () { [].slice.call(arguments).forEach(function (init) { init(initData) }) }) App Initialization Bootstrapping @giuseppegurgone
App Initialization until a few days ago... @giuseppegurgone
PushState via HTML5 History API Progressive Enhacement UI component to
catch clicks on .js-nav links Data component to fetch data and update the URL / History UI component to update the UI Routing @giuseppegurgone
Routing @giuseppegurgone Todd Kloots https://youtu.be/hrZl_EQUbRQ
@giuseppegurgone #ThankYou