chantastic.fm

117: Tom Preston-Werner on RedwoodJS

Episode 117 · November 5, 2020 · 01:19:54

Hosted by chantastic · With Tom Preston-Werner

Sponsored by AWS Amplify and Infinite Red

Download MP3 · Jump to transcript

Featuring

Discord

Join the discussion Discord 🎉🎊🥳

Listeners of React Podcast are chatting on Discord!
Join us Thursdays at 10am CT for a friendly chat thru the latest episode.
It's fun, interactive and all are welcome!
Discord invite

Links

Sponsors

AWS Amplify

AWS Amplify is the fastest, easiest way to build web and mobile apps that scale. aws.amazon.com/amplify

Infinite Red

In over your head with a React or React Native app? Infinite Red can help. They're React Native core contributors who've been designing, building and shipping apps for over 10 years. reactpodcast.infinite.red

Transcript

[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. Tom Preston-Werner is building a full-stack framework for React and GraphQL developers. In this episode, we talk about RedwoodJS, a framework that's bringing full-stack to Jamstack. Tom is a co-founder of GitHub, creator of Jekyll, the OG static site generator, TOML, and semantic versioning. If you've been on the hunt for a full-stack React and GraphQL solution and envy the integration of frameworks like Rails and Laravel, listen up, 'cause RedwoodJS might just be the framework for you. This episode is sponsored by AWS Amplify and Infinite Red. AWS Amplify is the fastest, easiest way to develop web and mobile apps that scale. I'd bet that you're already using at least one AWS service today to support customers. So you're already familiar with the limitless composability of AWS services. But sometimes all that capability can be overwhelming. You just want one thing that's intentionally designed to make modern full-stack development easy. Well, Amplify is for you. AWS Amplify takes the power and scale of AWS and tailors it to your needs as a cloud-based web and mobile app developer. Use it to spin up hosting, storage, authentication, manage GraphQL or REST APIs, serverless functions, and so much more. You can start using AWS Amplify for free with their generous free tier, and as your business scales, you only pay for additional services and resources that you use. It's pretty great. Visit awsamplify.info/react to find a quick tutorial for React developers like us. That's awsamplify.info/react. Infinite Red is your go-to resource as a React and React Native developer. They know these frameworks inside and out. Whether your company is as Fortune 500 or fighting fortune for an open coworking desk, Infinite Red can help you design, build, and ship quality apps. They've been doing so for over 10 years, and listeners of the show absolutely love having them as a friendly expert resource. Infinite Red will give you $750 when you start or refer a new project. So, get expert React and React Native help at reactpodcast.infinite.red. Tom Preston-Werner. Welcome to React Podcast.

[00:02:39] Tom Preston-Werner: Thank you. Thanks for having me. Excited to be here.

[00:02:41] Michael Chan: I am super excited to have you on the show. I guess just on a personal note, more than anything, I'm excited to have someone on the show who has like for the last 10 or so years really influenced the way that I work as a developer. So, I'm gonna gush for a second. You know, you're the the the founder of of GitHub. You created Jekyll, SemVer, Toml, Gravatar, like things that actually like impact my life like on a daily basis. So uh on the behalf of on behalf of anyone who's listening whose life you've also impacted, uh thank you so much for being here and talking with us today.

[00:03:17] Tom Preston-Werner: Well, thank you for saying so. It's it's absolutely my pleasure. I mean, I love creating things. I love bringing value to the world and making other people's lives easier. I'm a developer and and it's it brings me great joy to be able to help other developers have more enjoyable lives. And so, I'm absolutely pleased to have done those things for you to enjoy them and to be here to talk about stuff.

[00:03:42] Michael Chan: Yeah. So, this year has been kind of like a funny uh like a funny year. And I I feel like you're the person to talk to about this. It's an understatement. A funny year on site. I forgot about all the other things because I was just thinking about like React for right now. But yes, it's been a chaotic year. But I know at the beginning of the year, people really started to ask me a lot. You know, I went on a couple podcasts talking about, you know, if you were to build something today, what would you reach for? Like if you're gonna build a product, not just, you know, some type of front end for an existing product or, you know, an integration or a UI. Like if you're gonna build a product, what would you reach for? And I feel like in React, I've not had an answer for that. And so it's always been like, well, I'd probably reach for something, you know, that I know pretty well, like Rails or Laravel or whatever. And, you know, as I've had those conversations with people, like on this show or other shows, uh Redwood keeps coming up. And I it wasn't until recently that I I kind of like got a glimpse as to like what this is. But um you have built one of the flagship Rails apps in GitHub. And now you're building a framework to bring some of those like full-stack ergonomics to React. And I guess my big question that I want to start off- like kick this all off with is, you know, when you have so much muscle memory and power in the tool of Rails, what is it that inspires you when you're building your next product, your next service, your next startup, to kind of sit down and start thinking about a framework from the ground up?

[00:05:24] Tom Preston-Werner: The journey really for me from Rails to wanting to work on Redwood and build a new framework started kind of gradually. So Chatterbug is the current startup that I have for language learning. And we started it out with just plain vanilla Rails, like everything done the normal, simple, easy way, server-side rendered, like nothing fancy on the JavaScript side, just jQuery. This was like 5 years ago. And then we started building more and more front-end stuff. And we had a designer who was also a developer and he wanted to use React and I hadn't really used React much before, but he started building things with it and I was, I started to dabble with it and learning React and I was just blown away by how much better the paradigm of building front end with React is, right? So that, so it's like there's jQuery over here. That was what I was used to. And then there's React over here and I'm like, like just delete all of the jQuery stuff, like immediately, right? Like we have to do everything. Everything new has to be done with React, right? And I just started getting into it and really loving everything that everyone loves about React, right? Which is like, it it just simplifies the way that you build front ends. It compartmentalizes it. You get the one-way data reflowing when you change stuff. Like, it's the dream that I kind of always had, the thing that I always wanted when I was writing front ends, you know? Yeah. And in jQuery, you're like, let me let me fiddly find this thing by ID and then like change the text. And React is like, no, just change the var- like, just change this variable and just like boop. Right. And I was like, oh yes, I need that. So we started using more React. And then over time we started feeling like, okay, you know, we had Rails on the backend, just now it was just delivering like JSON to the frontend. And then the React component, sure, would, you know, we had a page and it would just suck in the JSON and and it would kind of do the whole thing. So it was still, you know, the server side basically doing all the work of data processing, giving that to the frontend and doing it. And then we're like, well, you know what would be really nice is if we could break up our data fetching and like get different things at different times. So you could have a page load incrementally. And so then we started pulling in GraphQL. And so now we ended up with a Rails app that was really just a GraphQL API, right? And so that's mostly what it looks like with with today for for most of the site, everything new that we're doing, it looks like that. So at the same time, another guy that was working with us at the time, Peter Pistorius, I started noodling with him on like What, you know, like why why do we have to still use Rails to do the backend? Like JavaScript has become an amazing language. It's really enjoyable. It's really great. The package management system is vibrant, to say the least.

[00:08:02] Michael Chan: Yeah.

[00:08:03] Tom Preston-Werner: And like, why am I having to context switch between Ruby and JavaScript? Like, we have Node, we have Apollo, like all of these, all of the things exist. Like we could implement the GraphQL side with Apollo, do it all in JavaScript. And then we need to figure out the database side. But like we started thinking about what that would look like.

[00:08:22] Michael Chan: Sure.

[00:08:23] Tom Preston-Werner: And combine that with some of the new stuff that Netlify had come out with. Well, not that new at the time, maybe a year before we started working on Redwood, which is already like a year and a half or almost 2 years ago, around functions. So in Netlify, they they launched the feature called they call functions, Netlify Functions, where you just have a file in your in your Git repository. That you want deployed to Lambda, right? And they will then do that for you, right? So you have just like a single code file, it represents your Lambda handler. You push it to GitHub, they suck it in, they deploy it, they deploy, you know, your static stuff to their CDN, and they deploy your Lambda, your your function, right, to Lambda for you. You don't even have to have an AWS account or anything. And now you can have dynamic code running and you can talk, you know, your front end via JavaScript, static JavaScript or static HTML with some JavaScript can talk to um the Lambda and and do dynamic stuff, right? And so I saw that and it just, I was like, this is, this is, these are now the building blocks that you could use to build a full stack application.

[00:09:29] Michael Chan: Yeah.

[00:09:30] Tom Preston-Werner: Right? If you're thinking in the React way, which is I have a a static React client that can be delivered via CDN. Okay. So it's it's available everywhere, super fast. And then that's gonna just talk to Lambdas, which theoretically you could have distributed everywhere.

[00:09:48] Michael Chan: Sure.

[00:09:49] Tom Preston-Werner: And that'll have and that could be the business logic. Um and in the case of Redwood, you you wrap up an entire GraphQL API into a Lambda and deploy it onto a Lambda. And then the the database is the kind of the hard part. And it's still the hard part because this is this is like this Jamstack mentality of how you how you architect this and deploy it was was created almost antithetically. And and you know, Jekyll was really in the early days of that, at the very beginning of of this sort of-

[00:10:17] Michael Chan: Yep. Yeah.

[00:10:18] Tom Preston-Werner: Like getting away from databases. So it's maybe maybe a little ironic that I'm now like, hey, databases again with the Jamstack. So maybe I'm a maybe I'm a hypocrite, but like sometimes you need a database, right? Like if I'm building a an application, a web app, I need a database, right? Like I can't do everything I want to do in in the content sort of, you know, I'm not gonna use Jekyll to build a web application, right? Like that's that's just not gonna work for me. It doesn't make sense.

[00:10:44] Michael Chan: Yeah. Well, it's it's truly fascinating to me because, you know, you've been on both sides of this. You have Jekyll that is, you know, as far as I I recall, it's like kind of the OG of static site generation. Um, but then you also have you know, these these super dynamic sites on Rails. Um, and it's it's it's really fascinating, this experience that you've had, because I have all- I've seen it repeatedly, right? Like at some point, you're doing so much on the frontend, so many like API calls, you're redesigning your your your, you know, RESTful endpoints for— um, specifically for your like new frontend code. And at what at some point, you're like, you know, what is Rails really getting me besides doing this stuff in Ruby, which is kind of a weird language anyway.

[00:11:29] Tom Preston-Werner: Ruby has its, uh, you know, its trade-offs. Ruby, Ruby is amazing. I still love Ruby.

[00:11:35] Michael Chan: Yeah.

[00:11:36] Tom Preston-Werner: Um, but it's, it's, uh, if I'm gonna write my front end in JavaScript, which I really want to, then I'd also like to write my backend in JavaScript.

[00:11:43] Michael Chan: Yeah. Yeah. So one thing I'm kind of curious about in in this phase is I feel like maybe 9 or 10 years ago, I'm probably getting my my my timeline off, but there was this huge move early on to with, let's see, like Meteor and Derby, I think, were really, really early on in this kind of like full-stack JavaScript type of movement. And it was all like, you know, NoSQL databases. Like it was just JavaScript all the way down. Um, and I I think, you know, as- I mean, I I don't want to condemn it. But it seems like most of those projects have kind of like fallen off and they've been replaced by other projects. And I'm curious, you know, from your perspective, what did we get wrong about, you know, full-stack JavaScript then that has become more realistic over over the time? Like why is now the right time to start doing that? What are the tools that make it possible?

[00:12:34] Tom Preston-Werner: I think Meteor was was too early. Like they they were they're maybe even the right solution, but just too early. And this this is this happens sometimes with technology.

[00:12:44] Michael Chan: Sure.

[00:12:45] Tom Preston-Werner: You can have like the right technology at the wrong time. And you have to remember also at the time that Meteor was around, there was no package management system. Like they had to build every, like literally everything themselves.

[00:12:56] Michael Chan: Yeah.

[00:12:57] Tom Preston-Werner: And they built like a hosting thing for it. So, I mean, just from my own personal experience, I remember reading about Meteor and being like, this seems really cool, but I feel like it's too locked in. And I and I think those impressions weren't even true. And maybe that was a a problem with the marketing, but like my perception of it was that Like if I built a thing with Meteor, then I had to pay for this other thing and I didn't really, like, it didn't feel as open source as I kind of wanted it to be.

[00:13:21] Michael Chan: Yeah.

[00:13:22] Tom Preston-Werner: So that's that's just for me why I never really ended up playing with Meteor. But the the lessons there I think are just, it's like it was too big of a leap, right? It was like asking people to abandon like everything that they knew, everything, right? It's like, oh, you do Rails, guess what? You don't do any, like you don't Literally nothing is the same, right? Everything changes. And so the so the the gamble with Redwood is that I think it's time now to start integrating in the JavaScript world. Like we have all of these amazing pieces. And so part of the nice thing about Redwood is that it's not everything is not new. It's saying Redwood is saying, you already use React. You've used it in projects before. You probably have used GraphQL if you're using React, at least in some capacity. And if those things are true, then let me help you use them more effectively. And if you want to build a full-stack web application, then guess what? I'm also gonna give you Prisma, and I'm gonna integrate that really well and give you scaffolding like, you know, Rails has for easily building out your sort of initial interfaces. And I'm gonna I'm gonna integrate all that together like beautifully and simply and give you generators and some of the really nice things that we expect now in a framework that Rails made us expect because Rails pioneered so many of these things. And but but they're just not present in the JavaScript world, right? It's like the state of the art is create-react-app and you're like, all right, hit create-react-app and like good luck. Um and-

[00:14:54] Michael Chan: See you on the other side.

[00:14:55] Tom Preston-Werner: Right, and you're on your own, right? So now you're like, oh man, like I gotta I gotta figure out how to do everything. You have to make a million choices and then everyone's-

[00:15:04] Michael Chan: yeah,

[00:15:04] Tom Preston-Werner: everyone's React-based application ends up being totally, completely different down to the file structure, right? You show up at a new company and you're like, all right, I'm ready to get started on your React, you know, web app. And then like you got to spend the first week just figuring out like where files go, right? Because everyone does it differently.

[00:15:22] Michael Chan: Oh yeah, and all the local conventions. Yeah, absolutely, absolutely.

[00:15:26] Tom Preston-Werner: So, so Redwood is is in a lot of ways just standardization. It's if if Redwood is anything, it's standardization and integration, right? And and what we say is we do all the hard work for you. We we configure webpack for you so that you don't have to, so that you can focus on your product, which is exactly the same thing that Rails did 20, 15 years ago, 20 years ago almost.

[00:15:53] Michael Chan: Now, One thing that is, I think, maybe a little bit different about about Rails is there's this huge kind of mindset of like configure or uh convention over configuration. Is that right? Mm-hmm. Yeah. Yeah. I got it right. Sometimes I flip those. Um there's this whole mindset, uh you know, that that's that's the big thing. And they leverage Ruby quite a bit to actually make that happen and to kind of infer a lot of details based on, you know, namings of things and the place that they live and whatnot. And I'm curious. I know that that can be a hindrance a lot of times in adopting a framework. And I'm curious, does Redwood kind of have those same types of, you know, convention over configuration and trying to do some of the same things in the same way? Or does it leverage more just the generators of putting things in a place that that that makes sense and then kind of letting you just use JavaScript and React, you know, as you normally would?

[00:16:48] Tom Preston-Werner: I think it's it's We don't really talk about it because I think that idea of convention over configuration has just permeated software development so much that it's like it would be weird if it wasn't that way for any project where you're like, like the first thing I have to do is write 100 lines of config. I mean, I guess Webpack is a little bit that way, but they but they've made that a lot better too, right? Like you can get started with Webpack really easily, but like once you get into Webpack, it's like, oh man, like you got to really understand what it's doing. Like you got to watch 10 hours of video on like the internals of Webpack to do certain things. But that's because it's such a powerful- like it's just like that's what Webpack is for. Webpack is so that you can like do anything in the build process.

[00:17:31] Michael Chan: Yeah.

[00:17:32] Tom Preston-Werner: And so, for Redwood, we don't really talk about it. Like it's just- that's just the way it is. It's kind of in the- it's just in the- it's just there. So, right. So, there is there is minimal configuration. There's configuration where you might want it, but like there's defaults. So I guess today it's we think of it more that we just have sane defaults. So I think the common, and that's like the common expression of convention over configuration, what it has become is just sane defaults and your project better have sane defaults or just nobody's gonna use it.

[00:17:59] Michael Chan: Yeah, yeah, yeah. Well, I I know and I listened to uh an episode um of uh Friend First uh where you talked with um Sam Selikoff and Ryan Toronto. And you were talking about how how it can be really difficult in a long-lived Rails app or like a Ruby app, you know, to be more honest, um where things kind of happen at levels that you don't really understand. And you can insert a, I guess, a a preference at a level that's really hard to find. And I'm kind of curious how JavaScript solves that. Like does JavaScript solve it by being like a a a a less um like metaprogrammable language? Um or is that something that you guard as kind of the designers of the framework?

[00:18:43] Tom Preston-Werner: I think JavaScript does solve it by being less metaprogrammy, which I really like. Like my my main problems with Rails are in in its sort of magical elements. Like it's it can be it can be too much magic. Like when I when we were building GitHub, honestly, I Going into it, I had done a lot of Rails. I was doing a lot of Rails, and honestly, I wanted to do less Rails. And so I wanted to write the backend stuff. I wanted to write, and so I wrote Grit, which is the- it was the Ruby to Git binding so that we could get, you know, read the Git repository from disk in Ruby, turn it into Ruby objects, and then be able to express those through the frontend through Rails. And I and I went out and I asked Chris Wanstrath, my co-founder, one of the co-founders at GitHub, if he wanted to join and help me build the Rails part of it. Because I honestly didn't want to build the Rails part of it. Because there's there's just like a lot of— there's like too much complexity and magic there for me, honestly. Like I wanted to write a pure Ruby library where I had complete control over everything and like no one was trying to do a bunch of fancy stuff for me. So- Yeah. I honestly don't love as much magic as there is in Rails. And I really, really dislike like metaprogramming functions, like cobbling functions together by iterating over strings and like defining the functions based on the string names. Like I just can't- I have a very low tolerance for that level because it makes it impossible to find anything. Like your search becomes useless. Um, and so I don't I don't love that. And and it makes it, to me, it makes it hard to maintain things and just the the the magic and the automatic like loading of things can get- I mean, well, that's that's probably a bad example. Because that's actually really nice. But like, there are, there's just, well, you know, Rails, right? Like there's a lot of hidden things. Yes. And the framework itself is like, how much code is in the framework of Rails? Like it's a, it's a large amount.

[00:20:33] Michael Chan: Yeah.

[00:20:33] Tom Preston-Werner: And so Redwood is, is actually pretty minimal. Like the weight of Redwood itself is really low. We do very few magical things for you. There's a few things that we do around Cells, which are the declarative sort of data fetching. We do a little bit of automatic loading in the routes file because otherwise if you had a- if you have 200 routes, you have 200 import statements for like every page component that you import, which I didn't like. So we just- but that's just like a little thing. It's like, oh, you don't have to manually import them. Like that's it. Like, yeah, it's magic, but it's like a 20-line code file that does that in Webpack or it's in Babel now. Everything's in Babel now. Everything has come out of Webpack as much as possible. It goes into Babel so we can support TypeScript properly. But that's- but I like having less magic. I like being able to statically analyze my code for the most part. Like that is a valuable thing. Ruby is inscrutable. Like to build tooling around Ruby is like almost impossible because of the metaprogramming.

[00:21:29] Michael Chan: Yeah, yeah. Well, this is something that has really struck me in my my my very limited exposure to um to Redwood, you know, through the tutorial, is that it has an explicitness that I really like. And and I almost want to say like tasteful magic. There's like tasteful little bits of magic that's like, you know what, I can see how that's valuable. Like I don't want to— um like I think the way that you're using, you know, workspaces um is is a really good example of that. You know, instead of having to, you know, kind of navigate down to that root directory and then back up to whatever you want to import, just you got a workspace for it, source, like you're good to go. And it does feel like there's a lot of things that kind of help with the the ergonomics, help it feel frameworky, but like don't feel like this big top-down, we know all the ways that you should be building a React app. It feels very much like a React app that I have full control over right out of the box.

[00:22:21] Tom Preston-Werner: Yeah, and you and you can. This is the thing. Redwood's not gonna really um prevent you from doing or using any normal library that you would want to use. It's like you want to use a state management library, Redux or Recoil, whatever, MobX, like, go for it. You know, we don't have an opinion on that currently. We might in the future, but we currently don't. Or CSS framework, like, we don't care. Like, there are some choices that we decided that we couldn't make because they would be too-

[00:22:46] Michael Chan: Sure.

[00:22:47] Tom Preston-Werner: —restrictive for people, right? If you say like, oh, in a Redwood app, you have to use Tailwind CSS, you know, and and anyone who didn't want to do that would be like, well, I guess this framework's not for me. So whenever those questions would come up, If there was an answer where someone would say, oh, well, I guess Redwood's not for me because of that choice. I mean, some of them are basic choices like, oh, you're gonna use React. And honestly, that's not even necessarily one. Like right now, we have chosen React as what we use for our web side. So in Redwood, there are sides. There's the web side, which is your front end. And then there's the API side, which is your backend. And for the website, we've chosen React, but there's no reason that we couldn't in the future create a a a different web side that used Vue. Like there's nothing fundamental about the framework that would prevent you from doing that. It's just a technology choice that we made because that's what we were working with and that's what we like best. But you could imagine doing that because because architecturally a Redwood application is a statically deliverable frontend that talks GraphQL to a GraphQL API. And it it doesn't even have to be Uh, like the sides don't even have to be the web, right? From the very beginning, and the reason that we use GraphQL and focus on making it really nice and easy to build a GraphQL API is because it it means that you can build a client in anything. And it means you only have to build your your API once, right? So the common pattern has been for for a long time, like if you started with a Rails app. So anyone who started with a Rails app is like, okay, Rails, boom, you got your Rails app. It's all server-side, delivers you know, your generated HTML to the browser, like you're done, right? And then that's how it works. There's little bits of JavaScript.

[00:24:26] Michael Chan: Yep.

[00:24:27] Tom Preston-Werner: And then you're like, hey, time to build a mobile application, right? And you're like, okay, sweet. We're gonna use, um, you're gonna, we're gonna build it with whatever, but like you're, you, you wanna start using GraphQL. Maybe you chose React Native. Yep. All right. So you can use GraphQL or you use anything and you wanna use GraphQL. GraphQL is amazing. And now you're like, okay, crap. Um, well, I guess we'll build out, you know, GraphQL API also in the Rails app. Or even if you're doing RESTful stuff, like you're still building out a whole separate like bunch of RESTful endpoints. Like the dream that Rails had where it's like, oh, your your your pages are also RESTful and like I've just I've never like I don't buy it.

[00:25:04] Michael Chan: Yeah, I've never seen anything that doesn't end up having like some amalgamation of you know amalgamation APIs that are like, you know, when you have to actually start serving customers like through an API.

[00:25:15] Tom Preston-Werner: Yeah, they're they're different. Like you have to you iterate on them differently. They get versioned separately. Like they're just different. They're a different thing. Like if you're gonna do it for real, like you're building a separate API. If you're doing it in REST, it's a separate thing. If you choose GraphQL, obviously that's a separate thing.

[00:25:28] Michael Chan: Sure.

[00:25:28] Tom Preston-Werner: And so now you're building out this separate, this totally separate API. Okay. So now you've got your main site in Rails that's spitting out web pages and you've got an API that like your clients are gonna use. Um and then you start and and now you're doing now everything that you build, you have to do twice. Everything you build, right?

[00:25:44] Michael Chan: Yeah.

[00:25:45] Tom Preston-Werner: If your mobile client is is doing like all of the things that your web client is doing, guess what? You're building it. You're essentially building it twice. Or you're you know you're building it one place, you have to hook it into two different places. Anyway, the complexity is is increasing. And so I don't like that because that's what our that's that's what we ended up doing at Chatterbug. Guess what? Rails site, normal stuff, also GraphQL API. Ugh, now you got to do things twice. So learning lessons from that in Redwood, We say, well, you know, we can build mobile clients all day long and it's great actually. They perform really well. They're resilient to to like data issues because they're cell phones. Like they they need to do the things that cell phones do. They're optimized for performance. And and so like if that's a totally normal thing to do, to build a mobile app that way, then why are we not building our web apps that way? Right? Like it's not really any different.

[00:26:36] Michael Chan: Sure, sure.

[00:26:37] Tom Preston-Werner: So then we can just have everything read from a GraphQL API. And then my backend is literally just a GraphQL API. And now I only have to build things once.

[00:26:47] Michael Chan: Yeah. Well, this is really interesting because there there is this notion of, hey, I want to I want to decouple my frontend and my backend. But unfortunately, what we've seen is is that that that makes a really kind of terrible developer experience a lot of times. You know, especially if you— you know, a lot of times we you know put stuff into like serverless, which is kind of historically- it's getting better, but been really difficult to develop against locally. Yeah. And so, you you build this frontend. And I feel like GraphQL kind of like came in and helps out a little bit. Um, but it's always felt super fractured. And I think the really interesting thing that you're doing about Redwood and kind of you you talked about Sides is is that you have, you know, the the website, you have the API side, but you're developing them together. And you've built a framework around building them together, but with extensible sides. So, it's not just these two sides forever. Like you're building them separate but together so that you can build as many of these sides as you need.

[00:27:43] Tom Preston-Werner: Yeah. And it's all in the same repository, right? So, a Redwood repository is a mono repo. It's actually two projects, right? We use Yarn. So, we have workspaces. The workspaces come from Yarn. And then you can operate on them independently. And when you build, you have different environments, right? Because the target for the website is a browser and the target for the API side is a Node runtime.

[00:28:06] Michael Chan: Sure.

[00:28:07] Tom Preston-Werner: And so if you- the the problem in like some people are trying to to do things where they erase this difference, where it's like you pretend like it's all one thing, but the reality is it's not all one thing. Like the code that runs in the browser and the code that runs in Node on some server somewhere Those have different restrictions. They have different performance characteristics. And you're mentally, you're just doing different things. And so I think you can get the illusion that that's gonna help you out, that it's like, oh, look how easy it is to to pretend that these two things are the same. Like Next, Next has this sort of philosophy where it's like, oh, look, they're the same. And it's like, they're not the same. Like I don't want you to tell me that they're the same when they're not the same. Like I'm a developer, I'm a responsible developer. And so I need to know what's going on. And like stop trying to confuse me about like what runs where, right? So, Redwood's like, you know what runs where.

[00:28:56] Michael Chan: Right. That is interesting. And I feel like Next, you know, over this past year has really kind of backed out of- you know, I feel like they used to be the same exact API calls. And now they're kind of like backing out of that a little bit. So, you have like certain calls that, you know, run on the server side, certain that run on the client side. And you can like attack them differently.

[00:29:14] Tom Preston-Werner: Right.

[00:29:14] Michael Chan: Which I feel is exactly to your point where as a developer, you know that they're different and you don't want to have to pretend that they're the same thing because they're not.

[00:29:24] Tom Preston-Werner: Yeah, I just don't want to be- I get confused enough as a programmer. Like I don't need additional layers of confusion.

[00:29:30] Michael Chan: Right. Now I want to back up a little bit and and and cover some of the the the parts of Redwood. So we talk about Redwood, but what are some of the technologies that it actually uses to accomplish the the goal of providing this full-stack, Jamstack type of development experience?

[00:29:49] Tom Preston-Werner: Like technology-wise? Or like Netlify stuff? Or what do you mean specifically?

[00:29:53] Michael Chan: Technology-wise. Um, in terms of- because uh you mentioned Prisma is one of the tools that you're using, GraphQL. Gotcha. I guess those types of things.

[00:30:01] Tom Preston-Werner: Yeah. So, as I said before, it's a React client on the frontend. So, React and and you would choose probably some way to do CSS. You might choose some way to do state management. But you know, people do that less now that with hooks, like things have become a lot simpler. And and that's kind of your React frontend.

[00:30:18] Michael Chan: Mm-hmm.

[00:30:19] Tom Preston-Werner: And then the API is built right now, we use Apollo. And and we like it for the most part. I think it's like it's it's pretty heavyweight on both the client and the server. I mean, it's more important on the client to be light. And and Apollo 3 actually reduced the bundle size nicely, which is which we love.

[00:30:38] Michael Chan: Great.

[00:30:38] Tom Preston-Werner: Right? Because bundle size is always, this is always a performance concern. This is a concern that we have, you know, like we we we we build new technology and we find out like this thing is amazing and now this thing is worse. Right? So with with this type of architecture, you're delivering like a bunch of JavaScript to the client that they have to parse and run. And in the olden days, in the Rails way, you're just like, here's like a tiny bit of HTML and CSS. Right? Like, and that's and that's nice, but um it's trade-offs, right? But yeah, with with the React frontend, I get these really nice things. Anyway, so on the backend we use Apollo. So well, we use Apollo Client on the frontend, Apollo Server on the backend, and then in your uh in your GraphQL API, so Apollo Server to to build the GraphQL API. And we have some really nice- there are some little bits of magic there that make building your GraphQL API like way easier than you thought it could ever be. Be. And so, and you should go do the tutorial. Like if you want to check out what I mean by that, go do the tutorial on Redwood. It's amazing. It's the best tutorial you'll have ever done.

[00:31:40] Michael Chan: It's very good. Absolutely.

[00:31:43] Tom Preston-Werner: And and so, you build your GraphQL API. But you don't even you don't even you're not even thinking about Apollo. Like there's nothing there that's Apollo-specific. Like we could swap that out with something else if we wanted. Because you're not you're not doing anything Apollo-specific in the backend. Um and so, In there, if you want to connect to a database, if you want a full-stack application, which is probably why you're using Redwood in the first place, you're gonna use a database. And so we use Prisma, which is a query builder, or it's like an ORM. They don't want to call it an ORM. It's kind of an ORM, but it's not, but really it's it's just delivering you back uh like a like a data structure. Like it doesn't, you know, in the ActiveRecord way, it's like, here's a a model and it's like everything and you call stuff on it. In Prisma, it's It's literally just like, here's some JSON, basically. That's the-

[00:32:26] Michael Chan: Sure.

[00:32:27] Tom Preston-Werner: It's just an object. It's just a plain JavaScript object with some data fields on it that represents what you got back from your data query. And then you have to modify it, right? Separately. And it's- you do it in a- in Redwood, you do it in a functional way. We're not big on classes. We're- we think more in, in packages and functions than we do in classes. It's not a very- we don't use a lot of the class-based. Stuff in JavaScript. So those are the fundamental pieces that are at runtime. So also at dev time, we've integrated testing with Jest and Storybook. With Storybook. So so those two things are integrated and part of the the dream of the development flow, which maybe initially you're not using Storybook as much and you know, none of us write as many tests as we should, as responsibly as we should, but You know, you always want to feel like, you know, you can. And so, um, but where these things really shine is when you start getting a little further. And a dream that I've always had for like 10 years since the GitHub days, like one big problem that we always had was you have a a some some piece of a page that's like deep inside your site that's behind auth. And it's it's only it's only comes up in certain circumstances and you're trying to work on it. And you're like, ah, like I gotta get my database into a state where it's gonna show this page. And then I got it logged in as this kind of user that has these characteristics. And you spend like a half an hour just like setting up the data to get you there. And then you're like, ah, finally, I can like see my code and like write it. And and my dream has always been to be able to write web frontend code without it being in my application. Right. And this is this is actually, if you are familiar with Mustache or Friends.

[00:34:11] Michael Chan: Yep.

[00:34:11] Tom Preston-Werner: That actually, that that was a concept that I stumbled, I didn't write Mustache, but Chris did. Chris Wanstrath, co-founder. And that came from a conversation that we had in a bar where I had come across this library that Google had called CTags, I think. And it was this logicless templating language.

[00:34:32] Michael Chan: Yeah.

[00:34:33] Tom Preston-Werner: Right? Yeah. And I saw it and and I I thought, What, like, this would be really cool because it would allow you to build all your HTML and stuff, and you'd have just your, your data bits that would be sort of templatized in there. A little bit of, you know, like, it's logicless, but you can do like if that, you know, Boolean stuff in there. And then you could develop it in isolation.

[00:34:53] Michael Chan: Yeah.

[00:34:54] Tom Preston-Werner: Right? So this was like 10 years ago that I was thinking about that and thinking about how cool that would be. And Chris took that and like ran and like created Mustache and that created this entire like universe of Of templating stuff. Like Twitter uses it now. Handlebars, right? Like it's those are the kind of the same um ilk of things. But I was always chasing this idea that like if you could develop your web chunks of your web application outside of your application, it would be so amazing. Because then the other thing you could do is like change the data and be like, all right, this you know this Boolean is true and this you know here's the name and here's the whatever. And just fill it out and it'd be like, all right, here's what your thing looks like. Right?

[00:35:32] Michael Chan: Yeah.

[00:35:32] Tom Preston-Werner: And guess what? Guess exactly what that is today. Storybook. Storybook is that. And React makes that possible. And Storybook makes that possible. And it's it's the most amazing it's the most amazing thing. Like once you've once you're into it and you're like, all right, I have to design a component that is a flag. So like on Chatterbug, we have language flags. And there's a bunch of them. And you're like, okay, I'm gonna develop this flag thing. I gotta make sure it works right. And it's gonna have these 7 flags and they gotta be able to be, you know, they can render in these 4 different sizes based on these parameters. And we use Storybook and it's just like iterate over these, you know, 3 sizes and these 7 flags and just show them all to me. And it's just like-

[00:36:11] Michael Chan: Yeah.

[00:36:12] Tom Preston-Werner: And I can go in there and I can change anything and it's just like- and like, it's, that's beautiful. Like I don't have to make my app show me a French flag in medium size and then be like, all right, let me fiddle with that. It's just, it's this, like, it's the culmination. These technologies now are the culmination of this, like, dream that I've had for, like, a decade about what developing a web application could be like. Like, all these different ideas that I've talked to so many people about over so many years are finally, like, coming together. And deployment. We haven't even talked about deployment yet.

[00:36:45] Michael Chan: Well, I want to, I want to gush on Storybook for a little bit longer. Because That was one of the things that I was super excited to see when I went through that that that tutorial, used the generator, and it was like boom. Like, you know, home.stories.js. I was like, holy cow, like this is exactly like what I want because of exactly everything that you described. You know, one of the things that I hate about working in full-stack apps is is that nobody ever thinks about how you go back and modify that thing. And so, you know, you have these situations where it's like now you got to- you know, every designer on your team has to be at least a little bit full stack in order to kind of munge the data in the database to get the flag to show up or the user type to show up and all of that. And it's like it's it's such a waste of expertise and energy to have to do that every time when you can just see like, hey, I have I have tests for all the states. If the data's there, it's gonna look like this. And you know, you shouldn't have to like go in and actually dive deep into a database to be able to just make a design change or like make sure that, you know, an authenticated user looks this way and an admin looks that way or whatever. It's just it's nonsensical that we've had to work this way for so long.

[00:37:58] Tom Preston-Werner: I know, I know. It's so beautiful, right? Like and that's what React really is to me. That that modularized, parameterized, like take this data in and show this thing, right? And you can just you can consider that thing totally isolated. I mean, in practice, it's often not. But like, you know, for the most part, it's this encapsulated thing. You know, you got to fiddle with stuff that comes in via context, which is kind of like the crappiest part. Sure. But but there's things in Storybook that were that we that help you deal with that. Or the part where it gets really hard is when you start doing data fetching in your components. Because you're like, I would like my my components themselves to do data fetching so that they can load, you know, asynchronously and separately. And now you're screwed in Storybook because now you're like, well, crap, my thing's gonna try to go talk to a GraphQL database or a GraphQL API somewhere. And like, now, now what am I gonna do? Now how do I- Right. Well, guess what? We solved that in Redwood with the mocking. We use mock service worker and it's, and it's beautiful. You just create a file called whatever.mock.js or .ts and it represents what data you would want returned in your Storybook and it'll just as long as you hook it up, right, and it's like super easy, then it'll just pull that data and it'll use that data to show you your your thing, right? So if you're using Sells, the data fetching stuff in Redwood, you can easily in Storybook work on your Sells by using the mocking.

[00:39:17] Michael Chan: Wild. I I love it. Like

[00:39:19] Tom Preston-Werner: that's that's what we mean when we talk about integration. It's like thinking about all of these things that would be amazing if only you spent the time to like really integrate them well, right? Like to to create this developer dream. And that's what we're trying to build.

[00:39:33] Michael Chan: And you see you see a lot of this trying to go into design tools, right? Like, you know, so you have, you know, Figma maybe has some integration where you can connect to your, you know, your GraphQL server and get data like that. But this is actually happening in the product. You know, it's not like some separate phase. It's like you can actually do that same thing utilizing Sells and uh and stories. That's amazing.

[00:39:53] Tom Preston-Werner: Yeah. And and testing. So you use those same mocks in testing. So you use the same mocks across your tests so that you can also test and get whatever mock data you want. And then you have multiple different mocks, but there's a default mock that Storybook will use because it's hard to tell, like it's annoying to tell Storybook all the time, like what you want. So if you just want one thing in in uh Storybook for it to do, to make sure it's gonna come back with the the right stuff, but you could have multiple and you can tell it which one to use. If it's a little, you have to add another line of code, but um but the same the same mocking behavior works across both testing and Storybook.

[00:40:23] Michael Chan: Nice, nice. Now I want to cover some of the language because we've we've And then I want to get to deployments for sure. But um I want to cover some of the language. Because we've talked about cells and sides. And I want to make sure that everyone kind of knows the the thinking behind those as we go into them. So um or as we continue to talk about them. So cells. Um tell me kind of precisely what those are with regard to a component and um data.

[00:40:48] Tom Preston-Werner: So a cell is our primary way of doing data fetching. So, the the normal way in React that you would do data fetching for GraphQL is you you do like you you you declare your sort of the query that you're gonna run. And then you you execute your your query. And then that's gonna have a loading state. And it's gonna have a success state. And it's gonna have a couple of different states that it goes through. And you're gonna have a big you know conditional statement in your component that's gonna be like when it's loading, you know, show this thing. And when it's it's successful, do this thing. But what we didn't like about that was how it just messes- like the code gets really messy. Like you're putting all those things kind of in the same- embedded in this big conditional statement inside your component.

[00:41:32] Michael Chan: Yep.

[00:41:32] Tom Preston-Werner: And it's not very pretty. It's not a very nice pattern. And so, we started thinking about it. And we were like, well, like all of these things really are just components. And so, what if you were to declaratively be able to just declare them so that you could say, okay, for this component, um, here's what the loading state looks like, right? And just and and have a file where you export that. You'd be like, okay, export the loader looks like is this component. And then export success is this component. And export a failure is this component, right? Takes in props and and spits out a component.

[00:42:05] Michael Chan: Sure.

[00:42:06] Tom Preston-Werner: And oh, and also, what if it's a list? What if you're doing a list query and the result is empty? Like that's kind of another state that you have to deal with. And it's like, oh, in that case, you know, it's this other component.

[00:42:15] Michael Chan: Yeah.

[00:42:15] Tom Preston-Werner: And so that's what Redwood cells are. It's a, it's kind of a veneer almost. It's a little bit of magic. But a cell is, it looks like a component the way that you name it. You just call it, it just ends with cell. So it's like, you know, list, my, you know, user list cell.js or .ts. And it just exports these different things. And oh, also you can, you know, you define the query and you export the queries. So you export query equals whatever your query is. You can also modify parameters that come into it with a before um a before query thing and modify the data that comes out of it that is then again gonna get passed to success. So so it's basically uh an orchestration layer that's declarative. So then we run the query for you, right? We're like, okay, you exported the query, so I so give me the query. I'm gonna run the query. And then during the different states, I'm gonna just grab the thing that it needs, right? So I'm gonna like, you exported a loading component, so you know like give me that. And I'll- and then you'll see that for a second. And then, oh, I got a success. I got some data back. So, give me the success component and I'm gonna give it the data that I got back. Right? But you might want to change in between the results of the query and giving it to the success component. You might want to change it. So, there's a little kind of callback in there that you can do. An after- what do we call it? After query, I think we call it. So, it's like before query and after query. Uh, maybe? I forget now. But you can change the data before it gets to the query and after it comes out of the query.

[00:43:38] Michael Chan: Oh, interesting. In case you need to munge it or change it a little bit for that specific component.

[00:43:43] Tom Preston-Werner: Yeah, you can just, you know, if you need to do a little bit of modifying of the structure to to reorganize it from what the GraphQL gave you to what you really want to take in from the success component, then you can do that. And that allows you to really think about what you care about. You're like, I'm working on the successful state of this component. Like boom, here you go. Like here it is. Nothing around it. It's just the success component. It takes in props and it outputs what it needs to. And you're not looking at all this other crap that's around it, this big conditional, and you don't have to worry and you just don't have to worry about it. And this also, like thinking long-term, this allows us to be in the GraphQL call so that we could do interesting optimizations in the future. Because you're instead of you running it, right, instead of you doing the actual query call to Apollo, to Apollo Client, Well, A, it abstracts Apollo out so that if we did want to change the the GraphQL client, we could without you having to change your code because you're not doing anything Apollo-specific in this case. Um, and it gives and it puts us in the in the middle. We're now the middleman for uh for the request-response, which means that as we start thinking about how to solve problems like the waterfall problem, where you have a component that fetches some data and it has sub-components, it's gonna want to fetch and complete that data, that that um request before it gives it to its children. But the children might not care about anything that that first, you know, that parent query is doing. It might only need the ID of a user or something, right?

[00:45:10] Michael Chan: Yeah.

[00:45:10] Tom Preston-Werner: And so you now you you have to wait, right? And then and then it finishes and then it passes down to the children because it's just the way that React renders. Um and so in the future, we might be able to optimize the way that GraphQL runs to parallelize things or wrap combine things up or do whatever we want to do because we're in there. We have control over that process. So that's what cells are.

[00:45:29] Michael Chan: It's one of those little tasteful bits of magic that I really like because, you know, as a designer, it's really nice to be able to just like pull off the one state that I need and like focus focus on that. Um and then also, like you said, to be able to opt into optimizations without having to concern myself with the changes to Apollo and whatnot. Like you've actually taken the work of having to know what those tools are that connect you to the database out of the way completely. And that's that's now a framework concern. And I'm sure that there's ways that you can dive into it. But like you said, you're gonna get optimizations by kind of not concerning yourself with that.

[00:46:07] Tom Preston-Werner: Yeah, because because it's and that's the beauty of something that's declarative is that you're just saying like what like what do things look like? What do you want it what do you want it to be instead of running it yourself, right? Instead of having all the imperative code around. You know, you know, do the actual query and here's the query and then deal with the different states. You're just saying what you want at the end of the day. And you let me, the framework, I'll I'll take care of it. You just tell me what you want. I'll take care of it.

[00:46:32] Michael Chan: I love that. Love that. So that's Cells. And I think that's a really great little abstraction around around those those concepts. Because I mean we've all seen components like this. They all look the same. They all look really gross. And um it's really nice the way that you've organized that so these components can be very clear and declarative. Um now, before we jump into services, let's talk about sides. This is a really interesting um construct that you have. Um and the two that Redwood ships with when you build a new Redwood app are gonna be web and API. Um but tell me, kind of what is the notion of a of a side? Kind of the abstract notion of a side?

[00:47:11] Tom Preston-Werner: So the so the sides really are just how we break the main pieces of the app up. And right now there's only the two, right? There's the website and the API side. But they're really conceptually- it's conceptually really it's the API side, which is really the the primary one. Like your application is a GraphQL API and it may be consumed by one or more frontend client- I call them client sides.

[00:47:37] Michael Chan: Sure.

[00:47:37] Tom Preston-Werner: And right now we deliver a React-based web side, but that's just because like we started with web apps. Like web apps are are the easiest thing to do. Sure. A lot easier than a mobile app, a lot more useful than a command line interface, for instance, or you know, a kiosk app or or a car, something that runs on the dashboard of a car, whatever you would consume something from, some IoT device, like. The web app is sort of the standard, like easiest place to start. And that's kind of what we were interested in. And so that's why that's why we call them sides. That's why they're distinct. And that's why we use GraphQL in order to communicate between them for that flexibility. And eventually we would love for Redwood to have a like a setup for, it's like, well, what do you want? Are you, what are you building? Are you building a website? Are you building a mobile application? Are you building a command line tool? Are you building something else? And have all the Redwood goodness for not just building a web client in React. Maybe we'll have the ability to write a web client in Vue, right? Or something else. Um, or you want to build a native client with React Native. Like we'll almost certainly offer that at some point down the road because that's such a natural fit. And you can reuse a lot of stuff between your web app.

[00:48:51] Michael Chan: Right.

[00:48:52] Tom Preston-Werner: And your your mobile your mobile application if you're using React, like if you write them in the right kind of way, like it's it's tricky, but like there is reusability that you can, even if you're just copy pasting and then modifying that, like whatever, it's still easier than like writing it from scratch from with Swift or something. Or maybe we even have a Swift-based frontend too. Why not? I don't know. It's just, you know, if it speaks GraphQL and we can help you do it, that's really what Redwood wants. Yeah. Just wants to give you the ability to focus on your product and not worry so much about your framework.

[00:49:23] Michael Chan: So I'm curious, you've mentioned having a, you know, possible Vue website. If someone, you know, really liked the notion that you're after with with Redwood but wanted to do it in, you know, like, you know, Preact or Vue or, you know, some other type of thing, are the pieces there right now that they'd be able to maybe plug into that and kind of like build their own side like pretty easily?

[00:49:46] Tom Preston-Werner: We haven't spent a lot of time abstracting out the notion of sides. I think we've done a little bit. Peter Peter has done, I think. Think a little bit about that, but we haven't spent a lot of time because it's not really our main concern right now. Our main concern right now is like get a 1.0 out. I'd love to do it before the end of the year.

[00:50:03] Michael Chan: Yeah.

[00:50:03] Tom Preston-Werner: And we got, we got a lot to do still. Like we haven't tackled SSR pre-render type stuff yet, which is what we're really focusing a lot on right now. So there's like, there's some big things that are really essential for 1.0. The concept of Sides and and like this sort of future of Redwood helping you do that is a little bit further off. So we don't make it easy, but it's not um it's not gonna be too difficult, I think. 'Cause like there

[00:50:28] Michael Chan: yeah

[00:50:29] Tom Preston-Werner: there are there are some assumptions that it's like, oh, you have a website and you have an API side. But right now you can actually not have um a website. Like you could just delete the web folder or delete the API folder and Red and Redwood's like, okay, I'm cool with that. Right?

[00:50:42] Michael Chan: I'm create React app now.

[00:50:43] Tom Preston-Werner: Yeah. Well, right.

[00:50:46] Michael Chan: With Storybook.

[00:50:46] Tom Preston-Werner: And you right, right. So you you still get like a lot of the benefits on the front end, You get Storybook and testing and and like all the things that we help you do there integrating just beautifully with with these different things. And if so, for instance, um we're working on this app called Repeater. That's at repeater.dev is the URL. And that's a a background job scheduler for the Jamstack. So one of the problems that happens when you start deploying to something like Netlify is guess what? Where do you run your, what do you run your like scheduled jobs, right? Well, there is nowhere to run them. Well, that's what Repeater is for. Repeater is a place where you can create one-time scheduled jobs that that will execute immediately or would execute at some arbitrary time in the future, or recurring jobs that would be more like a cron-

[00:51:33] Michael Chan: Nice.

[00:51:34] Tom Preston-Werner: —type of thing for doing data aggregation or whatever. Or if you're just sending an email, you do a one-time thing and you're like, I don't want to I don't want to wait for my email to send in band, so send, you know, tell Repeater to schedule that and it'll, it then, the job of Repeater is to make an HTTP call back to you. And you can create custom functions in Redwood very easily that will just be Lambda, just full Lambda functions. And so Repeater can just call back, give it, it gives you the payload, and then you, you use the rest of the framework in the normal way. You use the rest of the API in the normal way. Um, and you can do whatever you need to do. When it schedules uh to call to you, send emails or or make some change in the database or do whatever you want to do.

[00:52:17] Michael Chan: Yeah.

[00:52:18] Tom Preston-Werner: And so we, so my point was with that is Repeater actually has no backend itself. So it's a Redwood application with no API because we, and Rob Cameron, who's another core member of Redwood, built it as a Rails app Because he wanted to use Delayed::Job. So repeater-dev backend is a is is Rails that is using um Delayed::Job, because he knows that super well. And he's like, I could just spin this up and like we could make this thing work. So he's like, all right, go do that. And so the the Redwood frontend with no API talks- the frontend, instead of talking to the Redwood API, there is no Redwood API. It talks to the Rails app and and that is the authoritative like data store. So and that's and it works really nice. Because it's just GraphQL. It's all GraphQL, man.

[00:53:06] Michael Chan: Rob Cameron is in chat right now. He says, hey, that's me.

[00:53:10] Tom Preston-Werner: Oh, awesome. Hey, Rob. I don't have the chat up, so I can't see it.

[00:53:15] Michael Chan: No, no, no, it's great. Um, yeah, yeah, yeah. So that's one of the big questions I think, you know, with, you know, with frontend applications and Jamstack and and all that is, you know, you have these these things we didn't even talk about jobs. But, you know, Rails is really good at giving you services and, you know, wrappers around being able to delay jobs. And it's really cool to hear how you're you're kind of still using some of those services, but you're kind of hiding them behind obscuring them a little bit. You don't have to use like a full stack framework just to leverage those those pieces.

[00:53:45] Tom Preston-Werner: Yeah, well, that's the that's sort of the Jamstack serverless way. You have a variety of services that someone else is gonna manage for you because you don't want to manage them. So things like background jobs is one, uploading files, like there's a bunch of services where you could that you could use to upload files. Because it's like, I don't want to I don't want to manage that. Like honestly, like really, do I really want to manage like uploading your files to S3 and like dealing with that in my database? No, absolutely. Just give me an ID and go, you know, you store them wherever you want and I'll know how to pull them down and like you deal with it and I'll pay you to do that, right? Yeah. And so this is the this is the serverless architecture aspect that is that is the Jamstack. Like this is the normal Jamstack kind of way to do things. But you can use those third-party services and integrate them into your app. And now you don't have to deal with that. You don't have to build that, right? Yeah. So billing with Stripe, you want to do like store, you know, inventory and store stuff with Shopify, or uploading files with Filestack, or dealing with your background jobs uh with Repeater. And and so now you can collect these services, but as the core, you still with Redwood, you have a full-stack web application with a database and you're doing the things that you care about most, the things that are specific to you. Because guess what? Storing, like, handling uploads of files and storing files is never ever gonna be the thing that my business does or cares about, right? Like, that's always a thing that I have to do in order to make my product, but I don't want to build that. Like, that's not my core value, right? So how can we help you- Yeah. Focus very specifically on your core value and let other people handle the thing that is their core value. So they care about it more than you ever will, right? And you just pay them a little bit of money to do it for you. And in the end, like that ends up saving you money in the long term because you're hiring fewer developers. And what's the what's always the most expensive thing in building a company? It's always, always, always, always, always the people.

[00:55:39] Michael Chan: Yeah. Yeah. You know, I love I love this because there's this there's a huge amount of pragmatism built into kind of, you know, the documentation and the the notion of Redwood that I'm I'm very much attracted to. To. And it really is focused on building a product, getting a product to market, focusing on your core competencies. And like, you know, maybe at some point down the future, like, you know, in 10 years or whatever, you might want to like own, you know, image and file uploads again. Maybe. Probably not. But like you're not restricted from doing that. Yeah. But there's a very pragmatic way of like, just like, hey, what you need to do right now is build the application, you know, build the product, build the service so that people will like want to use your thing. And you should delegate as much of the other things as possible. And I really like that about the Jamstack philosophy is, you know, what- there's so many great services. What services can we use to get to market way faster?

[00:56:28] Tom Preston-Werner: Absolutely. And this, I think, segues nicely into deployment where like Redwood makes it super easy to deploy to Netlify. So like you can create a Redwood app. You still need to spin up a database somewhere. And we're working on ways to make that a lot easier. Netlify maybe will help you set up a database and get it running and then you just hook in directly to it, whatever, it's not a big deal. Right now you got to spin up a database somewhere on DigitalOcean or Heroku or AWS, wherever you're happiest with. And then you your Lambdas are gonna connect to that. And that's beautiful. It's really easy. Like single a single command, like the migration, Prisma will handle the migrations for you. Um if you're using MySQL, Postgres. And it's just beautiful, right? Because you get your client is on a CDN, the Netlify CDN. For instance, super fast, globally distributed. And then your business logic's gonna be deployed to Lambdas. Right now, this is a restriction with Netlify in that they deploy all Lambdas to us-east-1 in AWS, right? But like the the roadmap there is def is is like they're going the direction where it's gonna be like, okay, well, you know, eventually they'll let you choose where you want them or they'll auto-distribute them around the world or whatever. And now you could have your Lambdas around the world, right? And then the the last part is your database. And having distributed relational databases is still pretty challenging and expensive. But I'm really excited about things like Fauna. Um that it like Fauna FaunaDB is a NoSQL but serverless, like properly serverless and like globally distributed, right? So like yeah, it really fits the Redwood use case super well. Um only in that it's not Prisma doesn't— there's no Prisma adapter for it yet. Sure. I think they will. The plan is to do it eventually. Um, and it's FQL. Like, I want to use FQL, their query language, FQL, um, to to do it. And it's still not quite as easy as I would like it to be. But like, you can see in the future that eventually there will be choices for these globally distributed serverless relational things, I hope someday. But like, just uh relational databases were just never built with this in mind. They just do not, right? You never, you know, they've got a restricted number of connections that you can make to them, which is like totally not the serverless way, right? Fauna is like, talk to me via HTTP like all day long. Great. As many connections as you want, like we'll handle it. We'll queue 'em up. We got it.

[00:58:46] Michael Chan: We're good.

[00:58:46] Tom Preston-Werner: It's all good, right? And MySQL is like, I have 20 connections, so be careful, right? And you're like, no, what do you do?

[00:58:54] Michael Chan: Use them wisely.

[00:58:54] Tom Preston-Werner: Right? And so if you put your business logic on Lambdas, guess what? You could have an infinite number of Lambdas. So you could have an infinite number of connections. So now you have to add connection pooling. Like, so there's still some, there's still some things here that are, that are not fulfilling my, my long-term dreams of what Redwood can be. But that's why we're here to push vendors to make this stuff better. And part of the core thesis of Redwood really was, let's build this now before the, the infrastructure pieces are really perfect so that we Once people realize how amazing Redwood is, like, and we get users and they're like, hey vendors, we want to use Redwood, but your stuff sucks. And they'll be like, okay, I'm sorry, I'm gonna make my stuff better so that Redwood is better, right? Like, that was kind of our thesis. So I have no shame in saying like some of these things aren't optimal yet because like we're early. We're like, we're, you know, we're not, we're not Meteor early, but you know, we're early enough that we can help push the industry where we think it can go.

[00:59:51] Michael Chan: Interesting. Now, one of the things that you touched on is database. And you still have to kind of figure out the database piece of it. But it sounds to me like, you know, Prisma is is at least abstracting the direct calls to the database for you. So, you know, if you're using a Redwood app, you don't have to necessarily on the the web and API side of things concern yourself with, you know, SQL or MySQL or like Postgres or whatever. Like the the actual specifics of your database. That's all gonna be abstracted away by Prisma.

[01:00:22] Tom Preston-Werner: Yeah, so you're writing you're writing JavaScript, you're not writing SQL. It's basically, it's they call it a query builder. So it's building the query for you based on on the the code that you're writing. Um so it's like, you know, whatever dot, it's it's like db, whatever your db, the client, client.post.findOne, and then you give it some an an object with the ID in it or whatever, right? So it's it's Sure. It's a query builder.

[01:00:48] Michael Chan: Yeah.

[01:00:49] Tom Preston-Werner: And that's nice 'cause I don't wanna write SQL, honestly. I mean, SQL's great, don't get me wrong. Sure, sure.

[01:00:54] Michael Chan: I love SQL. But it's another one of those things that's below, way below product.

[01:00:57] Tom Preston-Werner: Yeah, I just don't-

[01:00:59] Michael Chan: You can work way higher now.

[01:01:00] Tom Preston-Werner: For those cases, like I don't wanna drop into SQL. Like I wanna be in JavaScript as much as possible. And that's that's a kind of like, I wanna I wanna I wanna think in JavaScript as much as possible, right? And Redwood lets me do that. And Prisma is just, it's nice, right? And it handles a lot of the details for me about how this is gonna be orchestrated and it has a migrations thing, right? So really it was, we wanted like for Redwood when we were building it and when we started building it like 2 years ago, we were like, okay, we want some kind of an ORM. You know, I like, I wanted like, what am I gonna use instead of ActiveRecord? Like what's the ActiveRecord of JavaScript? And we went and we looked at a bunch of the the ORMs that were available and there was a bunch. But none of them really held a candle to ActiveRecord. Like ActiveRecord is a masterpiece. Like it is a it is a uh one of the great human achievements. Like it's amazing, like the how powerful it is. And then you go over to JavaScript and you're like, what is what what what is this? Like this is no, like this is not this is not okay.

[01:02:01] Michael Chan: Yeah, they're all cheap knockoffs of of really, like you said, it's just a a really amazing achievement, ActiveRecord. I mean, it's a huge part of Rails. That I don't think people realize, like that that is really the masterwork of Rails is is is ActiveRecord.

[01:02:16] Tom Preston-Werner: Yeah. It's amazing, right? But it's it's it's become so amazing that it almost becomes unamazing in that in that you can do so many millions of things that it ends up with great amounts of complexity. Like in the scoping that you can do, like you can do really interesting things with it. So interesting that like people go into your codebase and they're like, I have no idea what the hell you're doing with ActiveRecord. You're like, this is ridiculous.

[01:02:39] Michael Chan: Yeah.

[01:02:40] Tom Preston-Werner: So, so it comes at a cost, perhaps. Uh, like, terse- you get what you get in terseness, you know, you lose in, in maybe figure-out-ability. And so Prisma- so when- so Prisma was very early, like they were like super early when we came across them, but like the fundamental architecture that they had and like how you would use it and how you define relationships and things, that was finally something that felt like, oh, this finally feels like something that could hold a candle eventually to ActiveRecord. It at least is not making choices that preclude it from getting there.

[01:03:09] Michael Chan: Sure. Yep. So, one thing that a lot of people ask us about on the show, and I want to I want to make sure we sneak in before we uh kind of close out this episode, is um is auth. And I know that there's a lot of concerns about auth. You know, React apps, there's like so many services. Um, it sounds like, you know, Redwood has a very kind of Jamstack-y way of handling auth. And I'm curious what um you know what providers you work with right now.

[01:03:34] Tom Preston-Werner: So out of the box with Redwood, you can install very easily a couple of different auth providers and then have them up and running like in in in a couple of minutes. I actually have a demo of getting auth running in in 3 minutes. I think it's 3.5 minutes. And it's like you go from no auth to installing auth and creating a— like it integrates with Netlify. Netlify Identity. And within a couple of minutes, it's like, boom, you're like, you're done. You've got auth, it's on Netlify Identity. You've got a login and signup box, and you've got stuff in your code to where you can test whether someone's authenticated. And and you can do it all in like 3 minutes, right? And that's true of all of the auth providers. So we've got Netlify Identity, Auth0, and um what else do we have in there? Magic Links. You can go to the documentation and see. What they all are these days.

[01:04:23] Michael Chan: Yeah, it's like uh Netlify, GoTrueJS, um Firebase, GoAuthProvider, or Google Auth Provider.

[01:04:30] Tom Preston-Werner: Yeah, they added that one recently.

[01:04:31] Michael Chan: Supabase. Um and then, you know, awesome options for uh custom ones as well.

[01:04:36] Tom Preston-Werner: Yeah. And so, nothing precludes you from kind of rolling your own. And and in fact, the the sort of the framework, we have like a mini framework for building an auth plugin essentially to where you could build your own. So, nothing says that you have to use some third third-party auth provider, and a lot of people don't. And so we want to make that really easy. But as long as you write it in a way that's gonna speak this interface, that's gonna talk in this interface, then it'll still integrate with Redwood in the same way that everything else does. And so you get the advantages of being able to use then the role-based authentication system if you want. Um, so so you can you can install one level, which is just tell me whether a person is- authenticated at all, right? And it's just like, okay, the person is who they say they are. And now you can kind of make assumptions about whether they can do things. So this would be useful if you're writing like a something that just has an admin section. Like let's say you wanted to write your own blog system and you want to be able to to log in and create posts, but just you and you don't care about anyone else. And then you might just install it that first level. But once you start wanting to have multiple different roles, so you want a person who can edit posts, posts and someone who can post them and maybe another person who can moderate comments or something, right? So now you've got 3 different roles. And so the role-based authentication that we also integrate, and you just you just uh import, um just install and import uh another Redwood library for doing role-based authentication. And now you get the role-based stuff where you can test based on what the roles are identified um associated with a specific-

[01:06:06] Michael Chan: Oh, neat.

[01:06:06] Tom Preston-Werner: User. And some of the providers have that integrated. So with Netlify Identity, it can actually store the roles for you. You could also do it where you store them locally. So if you didn't want to use their roles, which are very simple, it's just a list of roles, you could store your roles in the database locally if you wanted to do it differently for some reason. And we have cookbooks for how to do that.

[01:06:26] Michael Chan: Nice.

[01:06:27] Tom Preston-Werner: And so all of this to say, you can go from nothing to like a fully authenticated application in a couple of minutes. And we have and it's just like hooks. It's just like useAuth and you pull out you pull out like a you know a login uh function and a logout function and you can just call them um and they'll pop up like for Netlify Identity. You call login. Yeah. And it pops up the login dialog and you log in and boom it and then it gives you back your authenticated user. And we have the stuff in the site that will fetch that from the backend so you can fill out more about the user on the backend. So it's like, okay, when a person logs in, I need the frontend to know not only their sort of identifier in whatever provider you're using, but also I want to get their email that I store locally. And I want to get like some other data about them. Um, that's gonna be shown in a navbar or something. And and there's a way that you do that on the API side where you just fill out an authentication uh thing. And and the framework itself knows how to make that call over GraphQL to get the current user information and pull it back. And so that whole flow is handled for you. You don't have to worry about it, but it's still really customizable. Yeah. In what you want uh to be- what data you want to be present in that authenticated sort of user data packet.

[01:07:38] Michael Chan: Yeah. And I really I really like this model because it makes it easy, but then also you're not you're not tied to one vendor or like one style of auth. You you really have control over all of it. Um but then you can still use the conveniences that you provide through the library, through the framework, um just to get up and running, get started, and you know maybe take you take you all the way. Who knows? Yeah. But you don't have to think about it at that deep level, um unless you want to.

[01:08:02] Tom Preston-Werner: Right. Like, do do you want to build a 2FA system? Do you? Like, answer honestly. Right? No. Let someone else do your auth for you. Like, you're gonna spend way more money like dealing with broken 2FA stuff on your site than you are like paying Auth0 a couple of bucks every month.

[01:08:21] Michael Chan: Right? Yeah. Now back to deployment real quick. Um, what are some of the- what are the current deployment targets? You mentioned a lot about Netlify and the integrations there. Um, are there other places that can easily right now be deployed to?

[01:08:34] Tom Preston-Werner: Yes. So you can deploy to Netlify. That was the first one. That's kind of what started this whole journey is this idea that we could do full stack on the Jamstack with Netlify. And then we're like, well, Vercel's not much different. So we worked with them and now you can deploy directly to Vercel, like zero configuration, like super, super easy. So that's awesome. And then we were like, well, what if you want to like run it yourself on AWS or something. You want to handle your own Lambda layout or whatever, because Netlify has some restrictions, then you can do that, right? So we have the ability to deploy the the currently just the API side to AWS, and you could then hook that up with- so maybe you deploy your your frontend to Netlify still, but you want to deploy your backend to AWS directly so that you manage it. You can do that. And and we're working on other types of things like um like a full deploy on AWS, front side and so website and API side. Like how do we make that possible? Um what about Fargate being able to run it in a container so that you have no limitations? Like right now, Lambda, you have certain limitations around code size, you've got cold starts, you've got um a couple of different uh restrictions. Um, runtime. So let's say you want to- let's say you have a background job that you want to trigger with repeater.dev. Like, where are you going to run that? Well, if we make it easy for you to deploy your Redwood app to a containerized thing, then that could be where your jobs run, and you could let it run for as long as you want. Or maybe you want to run all your backend on Fargate so that you have no, no cold starts. You just run it all the time, or you run 10 of them all the time.

[01:10:12] Michael Chan: Yeah,

[01:10:12] Tom Preston-Werner: you can do that, right? Because it's just- there's nothing about Redwood that is Jamstack specific. It's sort of like Jamstack optimized. But you can run it old school if you want. You could run it bare metal. Like it's just it's just Node, right? It's just Apollo server at the end of the day. So anywhere you can run Apollo server and a Node process, you can run the API side of Redwood.

[01:10:31] Michael Chan: Nice. Love that. Love hearing that. Um so we have just like kind of blown through our time today. And so I want to start uh wrapping up. But one of the things that I like to ask last is just kind of your vision for the near-term future. So, you know, what are you excited about, what you're bullish on, you know, for the next, you know, you know, maybe 3 to 5 years? And it sounds like, you know, Redwood is really kind of the answer to that. So I'm curious from you, what are you most excited about putting into Redwood or building into Redwood over the next, you know, 3 to 5 years?

[01:11:07] Tom Preston-Werner: I think, I mean, it's a little hard to answer. I think it's really gonna be what the user, what the community needs. And I don't know that I can predict all of that. I think it's gonna be a lot of documentation. Like I want to have, well, there's two things that I really want. I want Redwood, well, three things. I want Redwood to really capture the potential in the Jamstack uh universe and this new development and deployment methodology. So that's one thing. And that I think we're executing well on. Number 2, I want documentation that is like world-class. And I think we've got a really good start with the tutorial. Rob Cameron, David Price, uh another core member, have put huge amounts of work in that. Peter, a bunch of uh external contributors have put a lot of work into the tutorial and the documentation that we have, but it's starting to get a little messy. And so I want to make sure that we maintain like world-class, really deep documentation, because that to me, that's everything. Like you go to an open source project and you're like, ah, this looks amazing. I want to use this. I heard about it on a podcast. And then you go to the website and it's like one crappy tutorial that does is totally broken in like 12 different ways. And that's like, and that's it. And maybe it doesn't even have a tutorial and it's like a README, but the README doesn't, it's like a couple of code examples and you're like, I don't even know like what the context of these code examples is. That person's gone. Right. You're just like, I don't have time for this. Right. So I want Redwood to be like, oh, I have a journey. Put me on the journey, um, tell me how to do- like, if I want to go deeper, how do I do that? So I want world-class, like, super world-class, like, like Stripe-level documentation, right? Like, to me, that's the- that's the bar.

[01:12:38] Michael Chan: That's the gold standard, right?

[01:12:40] Tom Preston-Werner: Stripe is amazing. Like, they kill it on that. So that's- so I want that, and I want a world-class community, like the best community. Like, how do you build- how do you build the greatest community? And it's really- and it's really hard, and we're having to ask ourselves difficult questions about who's in the community because it's not very diverse right now. And- Yeah. It's like we're taking steps to try to improve that, but it's it doesn't happen by itself. You have to work very, very hard to make that happen. And so we're asking questions about that and talking to people about how do we get the right people here. But it's also a very hard thing to go to people and say, hey, do you want to come do free work for me on my framework? And so it's a it's a tricky it's a tricky question. So we're navigating those questions, but I would really love to have a community that is that people look at and they say, I wanna be part of that community and I can tell how much care they put into it and how helpful and kind they are and how much they wanna help me succeed. Um and that just creates this this spiraling sort of uh value in a community. That I don't think you see very often in open source. I think you see it very rarely. And I I'm wondering if we can do it differently. And we're putting a lot of time into thinking about how we can do it differently. So I think those really are, those are the things for Redwood that I want to see. In the greater ecosystem, I think Jamstack is gonna continue to iterate and improve and become more powerful and less restrictive. Things like Lambda, like what's AWS, what what what's Amazon gonna come out with next, right? Like they have all these pieces, like how can we leverage those to make developers' lives easier? And and in a little bit longer term, I would love to have to care less about what my data storage story is. Like it's so, it's really difficult right now. It's there's a million different ways to do it. There's relational, NoSQL. Like I want to not kind of have to care. Like right now, I don't have to care about where my frontend goes. It just goes on CDN, done.

[01:14:32] Michael Chan: Yeah.

[01:14:33] Tom Preston-Werner: And then my business logic, I'm like, well, if we can get the Lambda story figured out and the restrictions become fewer and and someone is gonna orchestrate it for me. And then it's like, boom, Lambdas everywhere, right? And they become super cheap. I can have like a globally distributed, fully edge web app in like a couple of minutes and it doesn't cost me very much. I think in 5 years we can totally be there.

[01:14:53] Michael Chan: Yeah.

[01:14:53] Tom Preston-Werner: But then even longer than that is what I call a universal deployment machine, which does everything, including data. And it like, you're just like, I I I want to read data and write data and like, you figure it out. You make indexes for me. You make it fast. I just want data. And you, you know, what's the CDN of easiness? Like how easy CDN is for like getting your front end out. What is that for data? I don't know. But that's that's what I want to see in 10 years.

[01:15:19] Michael Chan: I love that. I love that. And I feel like you have, you know, all of the, you know, the pieces in your experience, you know, from, you know, from from doing so much with Rails, with GitHub, to Jekyll, to, you know, TOML, which seems to be like a really important piece of, you know, actually like controlling your infrastructure and whatnot. Um, I'm just so excited to see um you kind of leading this charge and having the vision and sharing it through Redwood. Um, so if people do want to get involved in the community to to learn more and kind of share their first learner experiences, um, how do they how do they start doing that? How do they get involved?

[01:15:55] Tom Preston-Werner: So come to redwoodjs.com and there's links there to our Discourse forum and our Discord chat server where you, depending on what you're doing, you can you can engage in either of those ways. We're @redwoodjs on Twitter. And if you want a free sticker, we will send you 3 free stickers literally anywhere in the world as long as you have an address. We will send it to you completely for free. Go to redwoodjs.com/stickers and fill out that form right there and and I will send you- That's awesome. 3 Redwood stickers and you put on your laptop and then you're a bona fide member of the community. And we love for anyone to be there. Builders, contributors, people just noodling around, people that are early in their careers, people that have been doing this for decades. Everyone. We want everyone there. We want to help people build valuable stuff for the world.

[01:16:46] Michael Chan: Yeah. Well, I'm super excited to see how this project takes off. How can people uh find you about the internet and and uh kind of see as you continue to develop Redwood?

[01:16:56] Tom Preston-Werner: Um my handle is @mojambo on Twitter. And if you just— you can search for me on the internet and you'll find me in in the various places and how to email me. So I'm easy to find. And uh @redwoodjs on Twitter. Give us a follow. Give us a star on GitHub. That helps us a lot. If you want to see GitHub become more um more used and and continue development, a star on GitHub is really valuable. It's a signal for others that there's interest there and that it's gonna be a long-lived product. So those are those that's how you find us.

[01:17:27] Michael Chan: Awesome. Well, Tom, thank you so much for your time, your your abundance of time with us today. I really appreciate you taking the time to explain so much of this to me and our listeners. Uh and I hope a lot of them just kind of join in and uh just get really excited about what you're doing. Uh so thanks again for uh taking time to chat with us today.

[01:17:45] Tom Preston-Werner: Absolutely. It's my pleasure. And very happy to be here.

[01:17:47] Michael Chan: This has been episode 117 of React Podcast with Chantastic and guest Tom Preston-Werner. A transcript for this episode has been sponsored by me. If you'd like to support the show by sponsoring a transcript and have your name read into an episode of React Podcast, send me a DM on Twitter @Chantastic or @ReactPodcast. You can find transcripts, links, and show notes at reactpodcast.com. Podcast.com/117. Thanks to our sponsors, AWS Amplify and Infinite Red. AWS Amplify is the fastest, easiest way to develop web and mobile apps that scale. Learn how to get your React app into the AWS cloud with hosting, authentication, storage, managed GraphQL or REST API, serverless functions, and more. More. Check out awsamplify.info/react. Infinite Red is your friendly expert resource for React and React Native. They've worked with developers and entrepreneurs like you to design, build, and ship quality apps, and they've been doing it for over 10 years. Infinite Red will give you $750 when you start or refer a new project. Get expert React and React Native help at reactpodcast.infinite.red. If you like this show, there's a fast, free way to demonstrate your support. Leave us a review on iTunes. It's the best way for you to let me know what you think we're doing right and what we can improve. 2 to 3 minutes of your time helps us make the best show we possibly can. As always, links and show notes for all episodes are available at reactpodcast.com. This episode was edited by Mikael Delport. It was produced by Mikael Delport and Sarah Jackson at Spec, a network to help you level up in design and development. Check out spec.fm for other shows that are sure to fast-track your career. I'm your friend, Chantastic. Thanks for listening. We'll be in your ears again next week.