Back to the list
Amjad Masad
Episode 50 · Dec 7, 2021

Under the Hood of Replit with Amjad Masad

Featuring Amjad Masad, co-founder and CEO of Replit
Apple Podcasts Google Podcasts Spotify Youtube

In this podcast episode, I welcome Amjad Masad, co-founder and CEO of Replit, the collaborative browser-based IDE. We talk about how Replit started, the technologies behind the product, but also how accessible tools change lives and help to make programming a passion.

Key highlights:

Listen to our insightful conversation or read the edited transcript.

You can also get Semaphore Uncut on Apple PodcastsSpotifyGoogle PodcastsStitcher, and more.

Like this episode? Be sure to leave a ⭐️⭐️⭐️⭐️⭐️ review on the podcast player of your choice and share it with your friends.

Edited Transcript

Darko Fabijan (00:02):

Hello and welcome to Semaphore Uncut, a podcast for developers about building great products. Today, I’m excited to welcome Amjad Masad. Amjad, thank you so much for joining us. Please go ahead and introduce yourself.

Amjad Masad (00:15):

My name is Amjad, I am the co-founder and CEO of Replit. Replit is a collaborative end browser IDE. It’s also a community of developers, a social platform where you can publish your software and collaborate with other people and it’s a great place to get introduced to programming. 

Before that, I worked at Facebook. I built developer tools at Facebook. I worked on Babel JS, React Native and the React Native packager, which became an open source project called Metro. I started that. At Facebook, I started a team called JavaScript Infrastructure Team, and we built a lot of the tools that people use today. Babel Adjust, a lot of the JavaScript tools. 

And before that, I was at Codecademy. At Codecademy, I did a similar thing to Replit, with a lot more focus on guided education. But the idea is that you should be able to get a REPL in the browser and learn how to code, just remove all the barriers to entry and let people experience the joy of programming as early as possible.

But the idea is that you should be able to get a REPL in the browser and learn how to code, just remove all the barriers to entry and let people experience the joy of programming as early as possible.

-Amjad Masad, CEO of Replit

Making accessible tools as a life goal

Amjad Masad (01:38):

I guess my life’s goal ended up being making accessible tools that are enjoyable for people to use. Even with my work at Facebook, I focused on really making software development fun, easy, accessible. 

The vision I had is that the Internet is this great equalizer, it’s the place where, for the first time in the history of humanity, we have something that allows everyone anywhere to be able to contribute to something larger than yourself.

-Amjad Masad, CEO of Replit

I come from Jordan and the vision I had back then is that the Internet is this great equalizer, it’s the place where, for the first time in the history of humanity, we have something that allows everyone anywhere, regardless of who you are, your socioeconomic status, your gender, your color, to be able to contribute to something larger than yourself and to be able to reap the benefits of this new digital economy. 

The vision I had is that for us to create a level playing field to allow everyone in the world to participate, the tools need to be easier and more accessible, so I dedicated my career to building these tools.

Darko Fabijan (02:42):

Great and very inspiring. Yeah, I can relate to this. Many times whenever I would switch techs and try to get into something new, that barrier of entry of setting up things was actually pretty high. 

For instance, I started in early nineties with Visual Basic 4, and then later, I wanted to get into Delphi, didn’t and then C++, and then, over to college and career. I mean, in hindsight, it’s simple and you should solve it, you should get over it, but in reality, in those starting phases, that can really slow you down or discourage you from moving forward at all.

Replit doing magic 

Amjad Masad (03:25):

Yeah. It doesn’t make sense to acquire that type of investment. Let’s say you’re learning how to drive a car, we don’t ask you to build the car or assemble it, right? But in programming, we do ask you to assemble the tools before you start. One of the critiques that Replit gets is that okay, we’re doing magic, we’re hiding complexity, we’re discouraging our users from discovering things, but that’s not true at all.

Let’s say you’re learning how to drive a car, we don’t ask you to build the car or assemble it, right? But in programming, we do ask you to assemble the tools before you start.

-Amjad Masad, CEO of Replit

Amjad Masad (03:50):

What we see is that our users, maybe at the first steps, they kind of don’t do that, but once they’re proficient in programming, they general really want to go understand how package managers work, how IDEs work, how interpreters work, they even write interpreters, they even write databases. 

Back to the car analogy, I’m really into cars and when I first started driving cars, I did not know anything about engines or anything like that. And then, when I started getting into cars and I started tuning the car and buying parts and really figuring out how engines work and how gears work and all of that, really, it’s about progression. It’s about getting people in the door, seeing the value proposition, seeing the fun of it and then you reveal more of the complexity as they go on.

Darko Fabijan (04:48):

Yeah. And some people will decide to go super deep, but for some people, that will not be of interest, they might be more interested in building something else and that’s fine.

Amjad Masad (04:59):

That’s true. I mean, it should be optional. Yeah.

Darko Fabijan (05:43):

I have a six year old daughter and this part about education reminded me of that, of how I introduce new people to things and it has to be interesting. And on the surface, everything is just fine. Let me decide whether I am going to dive super deep and don’t store me in the beginning with, “Okay, you need electricity. Let me tell you how electricity is made. And then, next time, I’m going to show you how we built the program.”

Amjad Masad (06:16):

Exactly. Yeah.

The technical side of Replit

Darko Fabijan (06:18):

Great. And you mentioned that you are also super interested in all the technology which is behind this, networks of things and people. Can you talk more about the technical side of Replit?

Amjad Masad (06:40):

Replit is at the intersection of everything I am interested in and it’s a fascinating set of problems. At the intersection of compilers and developer tools and systems programming and interface design and UI and people, networks, social networking. Everything I was interested in, this became a center of it all and it’s been super fun to work on all these ideas and the breadth that we cover is absolutely fantastic, but that’s what I was excited about from the start.

What happens when you start a REPL?

Amjad Masad (07:13):

I guess, to talk about the technical stuff first, the one thing to start with is what happens when you go to Replit and you start a REPL. A REPL is what we call the environment. The name, obviously, comes from read-eval-print loop. 

It’s a concept from the fifties that was started with LISP. LISP was the first dynamic programming language invented and one of the really interesting things about it is that the code is data and you can evaluate the code in the running program, right? So like eval() in JavaScript or Ruby or something like that.

Amjad Masad (07:52):

That was the first instance of that and they had these primitives like reading something from the terminal, printing something out and evaluating it, so you put them together and you have a one liner that’s really super powerful, which is read-eval-print loop. You read something in the terminal, you evaluate it, you print it and you repeat. And you can bootstrap, essentially, an interactive programming environment using one line of coded LISP, which is just a fascinating concept in itself.

Amjad Masad (08:20):

I was really fascinated by it and I was really interested in how we can apply that concept to daily programming and I was really frustrated by how a lot of programming is about sitting down, thinking out a lot of ideas and plans for how to do something, designing an algorithm, and then going in and writing hundreds, maybe thousands of lines of code, and then running the program and then figuring out that one of your assumptions is wrong and then you have to repeat the entire process.

Interactive programming as a way to converse with a computer

Amjad Masad (08:56):

So interactive programming, for me, was about revealing the program as you go, it’s almost like a conversation with the computer. That was the idea I was starting with, so with Replit, the idea was, let’s do it for all programming languages and let’s make that the base of how you start coding. 

Interactive programming to me was about revealing the program as you go, it’s almost like a conversation with the computer.

-Amjad Masad, CEO of Replit

When you start a REPL, what happens is, we connect to a backend service, this backend service grabs a container, typically from a running container pool because we want to keep them hot and ready. If it’s a new project, it’ll start a new file system for you and we’ll start storing that on GCS, which is S3 on GCPU, and it will drop in a program that we call pid1. 

So pid1 is, as it’s called, the first process in the container. That process is responsible for communicating all the way from the container to the IDE to the REPL and it’s responsible for all the operations that you might want to do as you’re coding.

Amjad Masad (10:09):

We use a protocol that’s very similar in its nature to SSH, meaning there’s a control channel where it allows you to open other channels. Everything we do in the programming environment is based on a channel. Say, you want to write a file, you open a file writer channel and as you start coding, that’s sending messages across. When we’re dealing with text, we’re typically dealing with operational transform messages. Operational transform is the gold standard for collaborating on text. There are CRDTs, which I think are more popular now, but those are more generic, more complex, and in some ways, a lot more powerful as well, but OT is kind of simple for textual based collaboration.

Amjad Masad (10:56):

So you open that channel. Those channels also have a built-in mechanism for collaboration, because Replit is a collaborative editor at heart, so you can broadcast these messages to other people on the system, they’re all connected to the same container. 

And then, the container starts, pid1 starts and you open a file, you open a channel, you start coding, other people might see it if they’re on the same session. And then, we built a lot of layers on top of different languages to make them behave the same. Again, we wanted to create this REPL experience, this interactive experience.

Prybar by Replit

Amjad Masad (11:34):

For example, we built this layer called prybar. Prybar makes a lot of dynamic language top levels, the interactive REPL. So prybar has support for Node, Groovy, Python, Lua, a lot of interactive languages. That gets started on the console side as well and as you’re coding, you can run the code, you can see the code live and then you can interact with the code via the REPL. And then, again, on the abstractions, we try to abstract a lot of the layers that make up any kind of tooling you’d want in the workspace.

Amjad Masad (12:15):

For example, package management. We built this thing called universal package manager and this is a front end for all the different package managers and different languages. Again, a lot of what we do at Replit is taking best practices from the different languages and creating layers to make them behave the same or in a predictable way. 

So whether you’re in Python, Ruby, Node, Go, Rust, whatever. When you want to install a package, it all follows the same thing. UPM has really interesting things like it will detect that you require a package and it will install it for you, for example, which makes it really fun for beginners to not have to deal with package managers.

Amjad Masad (12:58):

The entire user journey begins with this, getting that container and then having all these tools ready for them and having a really simple interface that they can get started with. But it’s also powerful and it’s also progressively revealing its complexity if you need it. 

For example, when you’re coding and you open a server port, you start an SUP server on whatever port. We figured that out in the container and then I think we used to use the Linux audit log, but I think we moved to something else that I’m kind of blanking on. I think we trap the SYSQL somehow and figure out that you’re trying to do a server. 

And then, we open a web view for you and then the container gets started proxying requests into the container. So now, we’re building a web app, not only you’re building a web app, but also, this web app is hosted for you.

Amjad Masad (13:54):

We take this approach to every other thing that you might want to do, whether it’s graphics, programming or other things like that, so that’s the core piece of it. In terms of container management, a lot of people ask us like, “Do you use like Kubernetes or something like that?” 

And actually, when we started building this, Kubernetes was not the phenomenon that it is right now and actually, I don’t think it actually is very good for our use case. One, because of performance and one is because we need to be starting and taking down all these containers all the time. 

So we built our own container manager that functions like a distributed system. When you want to grab a container, you could get a container at a cluster that’s geolocated closely to you. When you invite someone to collaborate with you, they go to the cluster closest to them, the data center closest to them, and then, there’s peering inside the system that allows them to work with you.

Amjad Masad (14:54):

That aspect of it becomes really interesting in how we bring things up and bring them down, how we do locks so that you don’t have two containers running it at any time, which we had a big problem with at some point, so to distribute locking. And then, how we manage cost because we want to provide a free service, but we’re providing free computers on the internet. So you’re probably dealing with that, in Singapore, there’s a lot of crypto mining, there’s a lot of issues like that. Security’s a very deep topic for us, but we’ve done well on it. That’s another interest of mine starting out as fighting fraud and things like that. That’s the snapshot of the system.

What does a user journey with Replit look like

Darko Fabijan (16:11):

As you were talking about this, I was trying to imagine a journey of a user starting out, maybe learning things and then sticking with Replit and progressing through their maybe just education as a student or young professional and so on.

Amjad Masad (16:29):

I can tell you, I can paint a picture if you’d like. One of my favorite users started when they were nine years old on the platform when we started the company, so around 2016 and now, they are 14, 15, and they’re still coding in Replit and you can go to their profile and you can see their first line of code being, “Hello, world.” And then, you can see the latest application being a Django application and this is the first platform, I think, in the history of programming that shows you the progression of someone from their first line of code to their first application to potentially their first business.

Amjad Masad (17:10):

When they came, probably in 2016, Replit was a single file and a console. It was purely a REPL. In 2017, I think we added multiple files. In 2018, we added the packager. In 2019, we added web hosting and before that, maybe we added multiplayer. 

So year over year, the platform is getting more exciting, more interesting for them to explore and to hack. Also, there are more people that they could learn with, that they could interact with and they form friendships and I think one of the things that I did not anticipate is Replit being a place to form deep, meaningful connections with people. And we see folks, especially on the younger side saying, “This is my community. This is my friendships. This is what I do.” That’s been very satisfying.

Replit is a place where people form meaningful connections with other people.

-Amjad Masad, CEO of Replit

Darko Fabijan (18:18):

I could imagine someone in elementary school or high school, so I’m the only one in my class interested in programming. Where do I find another programmer of my age?

Amjad Masad (18:30):

Exactly, exactly. Yeah, it’s still the problem. It’s still the problem.

Darko Fabijan (18:34):

From the side of starting with technology, it’s super interesting what you said. I don’t know if I would really enjoy seeing it, but I would maybe want to see what my progression was and what was those lines over almost two decades, that I wrote, but in terms of technology changes and switches and going in loops, did you guys maybe did some analysis, observe something interesting that first line with JavaScript and they ended up in making games in C++ or, I don’t know.

Amjad Masad (19:08):

Yeah, no, we should. We haven’t done that and we haven’t really invested too much in data analysis or just giving people insights on their own behavior and their own profiles, but we have all that data and I think we should be able to do it, but just anecdotally, I see a lot of that zigzagging happening. 

I mean, you look at the industry in general and you see that zigzagging happening. When I started professionally coding, everyone was interested in doing type languages and compiled languages were table stakes. This is what you had to learn, this is what you had to do. You had to write safe programs. And then there was this rebellion led by PHP and then later on Python and Ruby and then JavaScript where no dynamic, everything, developer productivity is more important than bugs.

Amjad Masad (20:01):

And then, now, it’s not exactly a zigzag, but it is a synthesis of these two ideas where now, we have things like optional typing, like TypeScript, Dart, Flow. Python has one, Stripe did one for Ruby. 

We’re like, “Oh, actually dynamic programs are very, very useful early on as a startup or writing a project, but once you hit scale, it starts really holding you back.” Now, typed languages are all the rage again, so you see that in the larger ecosystem and you definitely see a microchasm of it at Replit where what people are interested in and it changes all the time.

What is Nix?

Amjad Masad (20:49):

And maybe we can get to it as you please, but this is why we’re investing in Nix. Nix is a purely functional package manager and it’s solving this problem where creating an operating system instance is this very tricky, unsecure, rolling the dice type thing and their idea is that, no, actually, when you’re creating your computer, essentially, everything should be reproducible and reproducibility is great.

Amjad Masad (21:23):

It’s also, everything should be pure so you know exactly what happened, right? So that you don’t get man in the middle or you don’t get a random package as we’ve seen with some of the stuff that happened in NPM around packages getting taken over by malicious actors. 

Nix’s kind of solved this problem and when we looked at Nix, what we really saw was a solution to one of our deepest pains, one of our pains and by the way, this is a pain for all paths like platforms, which is you want to create this one time for your users that has all the tools that they might need.

Amjad Masad (22:03):

The way Heroku works around that is that, oh, we’re going to create these stacks, they call them these interesting names, Cedar or whatever. They make you upgrade every once in a while. I need Node 16, Python 36, whatever. They can’t really give you that, they have these run times that you have to upgrade to a lockstep and they make the decision of what versions of things, you can’t do things à la carte. 

And we went down that path so we built this thing called Polygott. It’s a play on polyglot. And we were like, “We’re going to install everything under the sun that you might need.

Amjad Masad (22:45):

And turns out it’s a really bad idea because one, it’s impossible to upgrade. When you want to upgrade a package, there’s a 60%, 70% likelihood that you’re going to break something else. And it’s not reproducible. If you break something, it’s really hard to roll back and that’s obviously something that Nix could solve. Also, the images that we were deploying were 10 gigabyte images because it had all these random tools, right?

Amjad Masad (23:17):

So we’re like, “What we really want, we want a description of the set of tools that you want and we want the output to be reproducible, cashable, something you can really trust over time.” So now, when we want to support a language, we simply write the Nix expression, “I want Node 16 with Gits, with all these other tools,” and it generates this image that’s cashable for us. 

We actually cashed all the Nix packages. We have the shared drive that we mount on every container. And then, when the Nix expression runs, we cash that as well. So we’re creating these templates now that allow us to support all these variations of run times. It’s the first Pez-like platform to give you complete control over your run time, but also is instant. You don’t have to go prepare a VM image and snapshot that. No, you instantly can create these things.

Amjad Masad (24:22):

I’ll give you an example of how this really benefited us. Right now, Web3 is a trend that’s really big, right? So developing smart contracts on Ethereum and some people at the company are really passionate about Ethereum solidity and things like that and there’s a lot of demand, we want to be able to support that and we were able to get something working in 10 minutes because we were describing the package we already cashed, we were describing that and it generated a solidity the environment in 10 minutes.

Amjad Masad (24:57):

It took us a little bit longer to add syntax highlighting, to make the developer experience really, really cool, but in a matter of two, three weeks, we were able to release this new product, essentially, to the market and the reception was absolutely crazy. Our tweets got something like 2,000 likes, it was featured on every newsletter for crypto and it’s been used thousands of times. It’s getting us a lot of new users that we wouldn’t have had exposure to. 

One, we believe that Nix is the future. It’s really obvious to us. We’re kind of surprised that it hasn’t really taken off in a major way just yet. We’re investing in it, we donated $25,000 to the foundation. We try to help in any way we can, help promote it and write about it, but it’s also just made our system a lot more hackable. If you don’t like something, you can change it. You can totally own your environment.

Darko Fabijan (25:52):

I can say that at this point in time, we are kind of opposition just because I would say that our current experience with Nix is that people are bothering us.

Amjad Masad (26:05):

For support?

Darko Fabijan (26:06):

Yeah, yeah. What more can we do to support them better. And I, in just maybe the last couple of weeks or a bit more, had some conversations around that with customers and they’re super happy and super enthusiastic and we are early adopters and we think it’s amazing and great and we didn’t have a chance to dive deeper into that. 

But a lot of what you are describing is also a pain point for our customers and then for us to support them because those applications are composed out of many different versions of languages, databases, some other dependencies that they want to have and they want to cash them, they want them fast, but it’s not like that. We can have hundreds of instances waiting just for them with their particular set of dependencies.

Amjad Masad (27:01):

Yeah. My prediction is, a year or two from now, you’re going to arrive at the same technical solution that we have, to have a large hard drive with casting all the Nix packages and a lot of your customers are going to be using Nix. That would be my prediction, but who knows? I think it’s just a matter of time when the world really wakes up to it. And I think a lot of misconceptions about, oh, Dockers are producible and cashable, but it’s really not the same thing.

Darko Fabijan (27:26):

Yeah, it’s not. In our industry, there was a period of time that some foreign competitors ditched VMs completely, everything had to be a Docker image, you cannot do anything outside of Docker image and all that. And a lot of people just want to get that instance that has that Ruby 2.6.what and that PostgreSQL 11 and they want those two things and they don’t want to bother with packaging, maintaining their images and upgrading them and all that. A lot of that in our industry ends up being such a huge hype as Docker is great. It’s great for many use cases, but it’s not that every single person wants to use that all the time. You know?

Amjad Masad (28:11):

It’s not a silver bullet and it’s also not improving at the rates that it used to be improving at, I think, because the company is struggling and things like that. There are alternatives now. There’s something called Pod and things like that, so there’s still some innovation there.

The future of Replit

Darko Fabijan (28:26):

Yeah, but I also hear a feeling that it hit a certain level and I don’t see what would be that that would involve someone investing so much more into that as to improve it to a significant new level at this point in time. Okay, great. This was a fantastic journey. Is there something that you’re particularly looking forward to when it comes to Replit?

Amjad Masad (28:49):

A lot of the things that I described are still in active development and I think once we really nail down the next experience, the way I’d like to describe Replit is that it’s going to be a bootstrapped environment. We’re going to build the environment in itself. 

Bootstrapping goes all the way back to Douglas Engelbart, known for the mother of all demos. Bootstrapping right now is really known about compilers, right? You write the compiler, the language starts working, you rewrite the compiler in the same language and then you throw away the old compiler and now you have a bootstrapped compiled, which is a fascinating idea. That it just works, it’s just an insane idea, right?

Amjad Masad (29:31):

Bootstrapping, actually, in the original sense of the term, is used a lot more broadly. The interesting thing about Replit right now as a bootstrapped environment is that we’re going to be able to build Replit in Replit and we’re going to be able to use it internally to build Replit in Replit, so it’s a bunch of recursive cycles and product is improving at a pace that wasn’t improving at before and I think we’re going to really accelerate development. We’re going to make it a lot more powerful. If you tried Replit before and it didn’t work for a use case, I would really try it now again or try in a few months because the rate of improvement is going to be astronomical.

Darko Fabijan (30:05):

Great. We’re excited to hear that. Amjad, thank you so much for joining us. Good luck with Replit and let’s talk again at some point.

Amjad Masad (30:13):

My pleasure and thank you for Semaphore for, we’re very, very happy customers.

Darko Fabijan (30:18):

Thank you. Bye bye.

Amjad Masad (30:20):


Meet the host

Darko Fabijan

Darko, co-founder of Semaphore, enjoys breaking new ground and exploring tools and ideas that improve developer lives. He enjoys finding the best technical solutions with his engineering team at Semaphore. In his spare time, you’ll find him cooking, hiking and gardening indoors.

twitter logolinkedin logo