facebook

How it'll appear as a card

How it'll appear as a web page at github.com/customer-stories/facebook

facebook
facebook logo
Customer story

Facebook & GitHub

With a mission to bring the world closer together, global-scale thinking is a necessity for Facebook. Supported by over 50,000 employees in 70 cities, Facebook powers a community of three billion-plus users built on shared connections—starting with the platform’s code. “Facebook was founded on open source,” said Michael Cheng, Associate General Counsel. The company’s infrastructure was built on the “LAMP” stack, which includes Linux, Apache, MySQL, and PHP. “Facebook knew from the beginning that there was no way it could scale to billions of users without using open source to collaboratively innovate in the open,” continued Cheng. “We’re not just consuming, but also actively contributing back to the open source communities that we come from.”

Facebook’s open source roots made going from open source consumption to contributions only a matter of time. “We knew that we were going to be really active in the open source space, because of both the community aspect and the technologies that we had to share,” said Cami Williams, Open Source Developer Advocate Technical Lead. Open source was an opportunity to give back, but also personified the company’s larger goals. “We’re getting developers from across the industry, different perspectives, diverse perspectives. We love to see the growth of developers. It’s social, and we’re a social company.”

And when it came time to contribute back to these communities, the team turned to code’s own social network: GitHub. “From the beginning, GitHub has been very prominent in the same way Facebook is as far as being very community-oriented,” explained Open Source Developer Advocate Joel Marcey. “It feels like it’s been a community from the start and that’s the way Facebook is as well.”

Facebook: Campus Aerial

Just like their users post family photos, news, and updates on walls and newsfeeds, Facebook’s developers share, host, and deploy code with GitHub pull requests and repositories. In 2013, the company launched React—an open source JavaScript library as disruptive as social media itself. Today, React is the de-facto standard framework for front-end development and remains one of the top five most-followed GitHub projects.

React’s grassroots success only proved what Facebook had already discovered: the power of community. “Open source advocates for collaboration, transparency, thought leadership, and community-first development,” Williams said. “Not only do we have the power of the engineers at Facebook and Facebook Research, but with GitHub, we also get that from various other communities in business, in academia, and generalists.”

PyTorch—Facebook’s second most popular open source project—followed a few years later. Like React, PyTorch has become a leading AI library, again hosted and available for anyone to use on GitHub. From Marcey’s perspective, GitHub’s community-centric approach and flexible tooling made the platform a given for both internal and open source projects. “GitHub was the place to go. To be blunt, where else would we go?”

Facebook: Facebook Academy

Then and now, community is crucial. Organizations from Tesla to BBC News rely on React and PyTorch, requiring almost full-time engagement from Facebook’s internal team. “We now have over 600 public code repositories which have been forked more than 200,000 times, have 540,000 commits to them, and over a million followers,” Facebook’s Head of Open Source Kathy Kam said. “We want to make sure that developers using the projects are getting the resources, documentation, and tutorials that they need to actually do the work successfully.”

Through GitHub issues, pull requests, and its reputation as home to the world’s open source community, Facebook developers ensure open source projects and their dependencies stay up to date and on track. “Making sure something works internally is important, but the people using our code externally are just as important,” explained Paul O’Shannessy, Engineering Manager. “We want to make sure that people at Facebook who are responsible for maintaining these projects can see the data and information they need to keep projects going.”

As a deep learning framework where the “source of truth” for the code is internal, teams also need to be able to update PyTorch and integrate tools—or build new ones—that fit seamlessly into the PyTorch workflow. “The API service area that GitHub provides to allow us to actually create tooling to make our engineers more efficient is a big deal for us,” Marcey confirmed. “We do a lot of custom tooling for the many engineers that do open source at Facebook, and GitHub having those APIs has made that easy for us to do.”

Facebook: Campus

These quick pivots are often made through “stacked diffs”—a mechanism for creating multiple commits and building continuously off those code changes at the same time. In practice, developers “stack” changes into several related changes and then keep them separate during code review, which can be easier said than done. “At first this was a little tricky and we had to do some reverse engineering, but then we used the GitHub API,” said Edward Yang, Research Engineer. “We were able to build a tool that integrates with the API, and it’s now used by a majority of developers in PyTorch when they’re developing these multi-step changes on the project.”

Developers are free to tackle their next task or even have a few extra minutes to contribute to open source, all while PyTorch’s build configurations run across multiple platforms. “You can probably still work on the next feature while you’re working all of these things out,” Yang explained. With the GitHub API and the team’s integrated internal tools, “Stacked diffs let people do that.”

From stacked diffs to security, APIs serve as a launchpad for innovation and productivity. Internal Facebook projects have their own dashboards, which utilize APIs to help engineers quickly add users, change descriptions, or add website URLs to repositories—all wrapped up in rigorous security protocols. “It’s kind of a two-way street there,” explained Marcey. “GitHub provides a great interface for our dashboards, but it also allows us to have the security around them to ensure people can’t just go rogue and do whatever they want in any of the repositories.”

Facebook: Server Stacks

Developers rely on GitHub Dependabot alerts to track vulnerable dependencies, while tapping into the API to pull down and analyze more detailed security data. “We use the API for more information when GitHub’s doing scans, then we actually file tasks internally when GitHub finds a vulnerability,” O’Shannessy said. “We’ll then assign that to the right set of people who should be notified.”

At Facebook, it’s about starting with what you have, then building your way forward. The PyTorch team’s CI/CD workflows run on GitHub Actions, with a twist. Facebook’s projects—both proprietary and open source—require a complexity that’s hard to match out of the box. But since Actions breaks down into individual actions or customizable pieces of code, teams “can take parts of other actions and do our own thing with those.” Developers can see whether pull requests pass or fail certain checks, then automatically report their status back through Phabricator, Facebook’s internal code review tool. According to O’Shannessy, “We can actually get that feedback before it even lands internally and make changes to ensure that we don’t break the public version by changes that we made internally.”

O’Shannessy has seen the impact of custom tooling extend beyond Facebook’s own projects. “A lot of it is just the scale of Facebook, but really the open source community that we’re building.” he said. “What we think about is, how can we do these things at scale to save people time, and get the right people involved at the right time?”

Facebook: Speaker

That might mean inviting in other open source maintainers, some who even become an official part of the team. “Developers apply to Facebook after engaging on our open source projects, but we’ve already been seeing the great contributions that they’ve made,” said Marcey. “So we’re very happy to bring those candidates in for interviews and actually hire them because we’ve actually seen their work firsthand. Open source allows that two-way interaction to find the right candidates for specific projects.”

Facebook’s user base may rival the size of large countries, but online communities are borderless—making innovation just a few clicks away for anyone. “Companies are set up, or structured in a way to contain people and ideas,” said Marcey. “And much of that talent and many of those innovations die at the border, when the company’s borders end. A lot of that is lost time, money, and efficiency, and so open source creates bridges between companies.”

With GitHub, Kam sees projects like React, PyTorch, and API-extended tooling as just the start. “Our mission is to empower the community and bring the world closer together, and we believe open source directly contributes to that,” Kam explained. “To enable the open source community and actually interact, you need to go to GitHub and do it there.”

  • product

    GitHub Enterprise

  • industry

    Social Media

  • number of seats

    7,000+

  • customer since

    2009

Bring GitHub to work

From flexible hosting to data‐powered security, get everything your team needs to build at their best.

Contact sales