SlideShare a Scribd company logo
@ryan_roemer | surge2015.formidablelabs.com
WRANGLING
LARGE SCALE
FRONTEND WEB APPLICATIONS
The web is
massively moving
to the frontend
Users want rich
and seamless
experiences
Product owners
want fast and
nimble apps
Browser apps are
now business
critical
And, yes, even for
the enterprise
... which means
LOTS OF JAVASCRIPT
IN THE BROWSER
WRITTEN BY LARGE TEAMS
Let’s dig into some large
frontends at a high-traffic,
top-five e-commerce site
Wrangling Large Scale Frontend Web Applications
The Numbers
$10 billion FY 2014, $13 billion FY 2015 (est)
1.5 billion page views for Thanksgiving -
Cyber Monday 2014
The Code
50+ JS applications
650K lines, 2500 files of JavaScript source
More JavaScript lines & files than Java
The Technologies
The Dev Team
A 2+ year website rewrite
50+ core frontend engineers
14 vertical teams / "tracks"
... and many external teams / partners
A TOUR THROUGH
THE TRENCHES
Wrangling Large Scale Frontend Web Applications
My wrangling adventures
as the JavaScript lead for
the website & dev teams
A few battle-tested
tips from the field...
... with a focus on
four personas
ARCHITECTS

GUIDES

GATEKEEPERS

LIFEGUARDS


ARCHITECTS
Plan & build a strong
foundation
Architects
A real build
Code organization
THE FUNDAMENTAL CHALLENGE:
JAVASCRIPT IS THE
WILD, WILD WEST
Architecture Challenges
Browser is a single execution environment
Code size / duplication is critical
Hard to manage, easy to do wrong
"Cowboy" legacy vs. large scale organization
Let's look at the
architectural complexities
of just one page...

THE HOMEPAGE
Wrangling Large Scale Frontend Web Applications
The Homepage
Multiple, independent JS apps
Code from 8 different teams
Exemplary "in transition" page, somewhere
between raw JavaScript & a SPA
 JavaScript
ON PAGE
Direct page scripts
10 remote scripts
18 inline scripts
LAZY LOADED
Injected script tags
6 app entry points
 On Page
2 application code
2 CDN infrastructure
2 internal ads
2 Google ads
1 fonts
1 IE-conditional polyfill
18 inline scripts
 Lazy (Code)
window._entry(function() {
require(["header/header"], function () {
require(["header/header-deferred"]);
});
// ...
require(["homepage/homepage"]);
// ...
});
 Lazy (App)
Asynchronously loaded
1 shared library
4 primary entry points
2 deferred entry points
THE TAKEAWAY?
IT'S COMPLICATED.
A "REAL" BUILD
Build Challenges
Modern JS apps are complicated
(compression, polyfills, transpiling, etc.)
Multiple JS apps on the same page is even
more complex
Supporting development & production / CDN
Use a Build Tool
Choose an paradigm: AMD, CommonJS
Choose a build tool / loader: RequireJS,
Browserify, Webpack
Take time to learn & evaluate the tradeoffs
Our Build Tools
Legacy: AMD + RequireJS
Modern: CommonJS + Webpack
Transition: AMD & CommonJS + Webpack
Keep prod & dev builds
blazingly fast
Make development
identical to production
Build Complexities
Sharing / caching common code (lib.js)
Varying repository structures
Sharing frontend & backend code
Combining application, OSS, & 3rd party code
CODE ORGANIZATION
Plan your repository
structure
1 → 14 → many repos
Have a bias for small &
flexible

GUIDES
Coordinate the chaos,
level up the development
teams
Guides & Guidance
The Meta team
Educate
Review everything
Guidance Challenges
Thinking of the project as a whole
Onboarding unfamiliar / junior developers
Helping teams be consistent /
complementary
THE META TEAM
Code from multiple teams
all combined on one page
These folks represent the
whole page
The Meta Team
Set conventions & best practices
Lead code reviews for consistency / DRY
Develop common utilities & the deployment
infrastructure
YOUR META TEAM TASK:
HAVE ONE.
Our Meta JS Team
1.5 dedicated developers
6 "loaned" track developers
Our Meta JS Duties
~1 day of code review / week
Chat channel participation
Cross-track JS initiatives (i18n, multi-tenancy,
PCI, etc.)
Meta JS Benefits
Project-wide consistency & support
Help tracks consider other teams
Represent track interests in the core
More engineers to support the whole project
EDUCATION
Continually write living
documentation,
close to the code
Take a "hands on approach"
Invest in rising developers &
spread knowledge back to
teams
CODE REVIEW
All code gets substantive &
meta review
Including all third party &
internal to the org vendor
code

GATEKEEPERS
Protect the frontend through
process & architecture
Gates & Gatekeepers
Automate quality
Minimize risks / exposure
Require performance
Gatekeeping
Challenges
Feature pressure
Poor quality code
Unknown included code
AUTOMATE QUALITY
Static checking
(eslint, jshint, jscs, etc.)
Clientside unit tests
Integration / E2E tests
Code coverage
Continuous integration (CI)
MINIMIZE RISK
Learn / identify your biggest
risk areas
Protect yourself wherever
possible
Architecture risks:
Injected HTML/CSS/JS
Code pattern risks:
Defer & pray
// I'm guessing...
var HOPEFULLY_ENOUGH_TIME = 2000;
// Wait until ready for next step.
setTimeout(function () {
theNextStep();
}, HOPEFULLY_ENOUGH_TIME);
Deployment / process risks:
"Hotfeatures"
REQUIRE PERFORMANCE
Frontend code must be small
& fast
Teams are "feature-driven"
unless performance is
enforced & required
Enforce with audits
"Web App Performance
Measurement, Monitoring and
Resiliency"
www.webpagetest.org
Enforce with process
Enforce with automation
"Automating Web
Performance Measurement"
Build your own tools where
necessary

LIFEGUARDS
Create escape hatches &
lifelines in production
Lifeguards & Life
Savers
Logging, Monitoring
Debugging helpers
Lifeguarding
Challenges
Code executes remotely on different
browsers
Frontend errors are costly & often invisible
LOGGING & MONITORING
Your code runs & fails
on a variety of browsers
out in the wild
Log & capture everything
Get errors & messages
to a remote store
And then aggregate,
report, & alert
Providers
Rollbar Loggly
Sentry Airbrake
DEBUGGING SUPPORT
Give developers life lines
when things go wrong
You ship this:
!function(){var e="Hello Surge!",a=$("<h1 />");
a.text(e),$("body").append(a)}();
Your devs want this:
(function () {
var message = "Hello Surge!";
var $heading = $("<h1 />");
$heading.text(message);
$("body").append($heading);
}());
Source Maps
/* ... LOTS MORE CODE ... */
[],window._entry=c}();
//# sourceMappingURL=http://dev.walmart.com:9873/js-dist-frontend
Publish in VPN on
deployment
Hidden from end users
Available to developers
All Together Now
A "real" build
Organized code
The Meta team
Education
Code Review
Automate quality
Minimize risks
Require performance
Logging, Monitoring
Debugging helpers
Some parting
thoughts on the
future
Embrace change
Reevaluate & refactor your
infrastructure & organization
Have a transition strategy
HAPPY
WRANGLING
surge2015.formidablelabs.com
THANKS!

More Related Content

PDF
The Future Of Web Frameworks
PDF
EuroPython 2011 - How to build complex web applications having fun?
PDF
Dreamweaver CS6, jQuery, PhoneGap, mobile design
PDF
Progressive Enhancement
PDF
What Web Framework To Use?
PDF
Javascript State of the Union 2015 - English
PPTX
High Performance JavaScript (CapitolJS 2011)
PPT
Augmented Reality (AR) - The Future of Mobile Applications?
The Future Of Web Frameworks
EuroPython 2011 - How to build complex web applications having fun?
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Progressive Enhancement
What Web Framework To Use?
Javascript State of the Union 2015 - English
High Performance JavaScript (CapitolJS 2011)
Augmented Reality (AR) - The Future of Mobile Applications?

What's hot (20)

KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PDF
Front End Development for Back End Java Developers - NYJavaSIG 2019
PDF
HTML5 or Android for Mobile Development?
PPTX
Edge of the Web
KEY
jQuery Conference Boston 2011 CouchApps
PPT
Developing Java Web Applications
PDF
Web Frameworks of the Future: Flex, GWT, Grails and Rails
PPTX
do u webview?
PDF
HTML5: The Parts You Care About - 4/Nov/13 - PrDC Saskatoon, SK
PDF
Everyones invited! Meet accesibility requirements with ColdFusion
PPTX
Blazor Full-Stack
PDF
Learning from the Best jQuery Plugins
PDF
Usability in the GeoWeb
PDF
Real World Web Standards
PDF
jQuery Chicago 2014 - Next-generation JavaScript Testing
PDF
Intro Open Social and Dashboards
PDF
Technical SEO for WordPress - 2019 edition
PDF
HTML5@电子商务.com
PDF
Front End Development for Back End Developers - vJUG24 2017
PPTX
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
Front End Development for Back End Java Developers - NYJavaSIG 2019
HTML5 or Android for Mobile Development?
Edge of the Web
jQuery Conference Boston 2011 CouchApps
Developing Java Web Applications
Web Frameworks of the Future: Flex, GWT, Grails and Rails
do u webview?
HTML5: The Parts You Care About - 4/Nov/13 - PrDC Saskatoon, SK
Everyones invited! Meet accesibility requirements with ColdFusion
Blazor Full-Stack
Learning from the Best jQuery Plugins
Usability in the GeoWeb
Real World Web Standards
jQuery Chicago 2014 - Next-generation JavaScript Testing
Intro Open Social and Dashboards
Technical SEO for WordPress - 2019 edition
HTML5@电子商务.com
Front End Development for Back End Developers - vJUG24 2017
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
Ad

Viewers also liked (20)

PDF
The Evolution of Airbnb's Frontend
PPTX
Front end Tips Tricks & Tools
PDF
Front End Tooling and Performance - Codeaholics HK 2015
PDF
Sinau Bareng Frontend Web Development @ DiLo Malang
PDF
User eXperience & Front End Development
PDF
Frontend automation and stability
PDF
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
PDF
Frontend SPOF
PDF
Architecting your Frontend
PDF
建立前端开发团队 (Front-end Development Environment)
PDF
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
PDF
A modern front end development workflow for Magnolia at Atlassian
PPTX
Frontend technologies
PDF
How to Build Front-End Web Apps that Scale - FutureJS
PPTX
W3 conf hill-html5-security-realities
PPTX
Modern Frontend Technology
PDF
Frontend at Scale - The Tumblr Story
PDF
TechTalk #85 : Latest Frontend Technologies
PDF
Front End Development Workflow Tools
PDF
The Frontend Developer Landscape Explained and the Rise of Advanced Frontend ...
The Evolution of Airbnb's Frontend
Front end Tips Tricks & Tools
Front End Tooling and Performance - Codeaholics HK 2015
Sinau Bareng Frontend Web Development @ DiLo Malang
User eXperience & Front End Development
Frontend automation and stability
Webinar: Front End Web Development - Trendy Web Designs Using HTML5
Frontend SPOF
Architecting your Frontend
建立前端开发团队 (Front-end Development Environment)
Grunt js for the Enterprise Vol.1: Frontend Performance with Phantomas
A modern front end development workflow for Magnolia at Atlassian
Frontend technologies
How to Build Front-End Web Apps that Scale - FutureJS
W3 conf hill-html5-security-realities
Modern Frontend Technology
Frontend at Scale - The Tumblr Story
TechTalk #85 : Latest Frontend Technologies
Front End Development Workflow Tools
The Frontend Developer Landscape Explained and the Rise of Advanced Frontend ...
Ad

Similar to Wrangling Large Scale Frontend Web Applications (20)

ODP
Netbeans65 Osum Slides
DOCX
Rajeev Ranjan_CV (Java Fullstack)
PPTX
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
PDF
JavaScript & Enterprise BED-Con 2014 Berlin German
PDF
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
PPTX
Front End Development | Introduction
DOC
Sundeep 2 years
PPTX
Building Modern Web Apps with MEAN Stack
PDF
Isset Presentation @ EECI2009
PDF
Class 6: Introduction to web technology entrepreneurship
PDF
Haufe Onboarding - Fast Iterating With the MERN Stack - TEC Day 2019
DOCX
Chandra Sekhar Cheekuru NET UI
PPTX
Synchronized Development for Distributed Teams
PPT
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
PDF
TRWResume-10-2016
PPTX
Front-End Web Development
DOC
Sanjay_Resume_exp_AEM
DOCX
Java, BA,UI resumes
PPTX
Latest trends in information technology
PDF
Seminar: Become a Reliable Web Programmer
Netbeans65 Osum Slides
Rajeev Ranjan_CV (Java Fullstack)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx) in 1 hour
JavaScript & Enterprise BED-Con 2014 Berlin German
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Front End Development | Introduction
Sundeep 2 years
Building Modern Web Apps with MEAN Stack
Isset Presentation @ EECI2009
Class 6: Introduction to web technology entrepreneurship
Haufe Onboarding - Fast Iterating With the MERN Stack - TEC Day 2019
Chandra Sekhar Cheekuru NET UI
Synchronized Development for Distributed Teams
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
TRWResume-10-2016
Front-End Web Development
Sanjay_Resume_exp_AEM
Java, BA,UI resumes
Latest trends in information technology
Seminar: Become a Reliable Web Programmer

Recently uploaded (20)

DOCX
The Five Best AI Cover Tools in 2025.docx
PPTX
Benefits of DCCM for Genesys Contact Center
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PDF
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
PDF
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
PPTX
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
PDF
Jenkins: An open-source automation server powering CI/CD Automation
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PDF
System and Network Administraation Chapter 3
PPT
JAVA ppt tutorial basics to learn java programming
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
AIRLINE PRICE API | FLIGHT API COST |
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
Become an Agentblazer Champion Challenge
PPTX
Save Business Costs with CRM Software for Insurance Agents
The Five Best AI Cover Tools in 2025.docx
Benefits of DCCM for Genesys Contact Center
Upgrade and Innovation Strategies for SAP ERP Customers
A REACT POMODORO TIMER WEB APPLICATION.pdf
Teaching Reproducibility and Embracing Variability: From Floating-Point Exper...
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
CRUISE TICKETING SYSTEM | CRUISE RESERVATION SOFTWARE
Jenkins: An open-source automation server powering CI/CD Automation
Online Work Permit System for Fast Permit Processing
Materi_Pemrograman_Komputer-Looping.pptx
System and Network Administraation Chapter 3
JAVA ppt tutorial basics to learn java programming
2025 Textile ERP Trends: SAP, Odoo & Oracle
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
AIRLINE PRICE API | FLIGHT API COST |
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Become an Agentblazer Champion Challenge
Save Business Costs with CRM Software for Insurance Agents

Wrangling Large Scale Frontend Web Applications