RedwoodJS: The Full-Stack React App Framework of Your Dreams

Rate this content
Bookmark

Tired of rebuilding your React-based web framework from scratch for every new project? You're in luck! RedwoodJS is a full-stack web application framework (think Rails but for JS/TS devs) based on React, Apollo GraphQL, and Prisma 2. We do the heavy integration work so you don't have to. We also beautifully integrate Jest and Storybook, and offer built-in solutions for declarative data fetching, authentication, pre-rendering, logging, a11y, and tons more. Deploy to Netlify, Vercel, or go oldschool on AWS or bare metal. In this talk you'll learn about the RedwoodJS architecture, see core features in action, and walk away with a sense of wonder and awe in your heart.

This talk has been presented at React Summit Remote Edition 2021, check out the latest edition of this React Conference.

FAQ

Redwood JS is a full-stack React app framework designed to simplify web app development by integrating essential technologies and automating common tasks. It combines React, GraphQL, and Prisma, among other tools, to provide a cohesive development experience that handles both front-end and back-end aspects seamlessly.

Redwood JS approaches server-side rendering with a focus on scalability and performance, primarily through pre-rendering. This feature allows static generation of marketing pages and other content at build time, which can then be rehydrated for dynamic functionality, optimizing both performance and SEO.

Redwood JS differs mainly in its foundational approach, emphasizing a clean-slate architecture not based on existing frameworks like Next.js. It uses GraphQL extensively for a unified API across multiple clients and focuses on providing a comprehensive solution with less boilerplate and more built-in functionalities.

Redwood JS integrates Jest for testing and Storybook for component design, allowing developers to test and design components in isolation. This integration helps ensure robust and reliable applications by facilitating thorough testing and modular component development.

Redwood JS supports a variety of deployment options, including Vercel, Netlify, and AWS, among others. The framework is designed to be flexible, accommodating various deployment environments whether they are serverless, containerized, or traditional virtual machines.

Data fetching in Redwood JS is uniquely handled through the use of 'cells,' which are components that declaratively fetch data using GraphQL. Cells simplify data management by automatically handling loading, error, and success states, making it easier for developers to manage data-driven components.

The Redwood JS team is focused on ensuring full TypeScript support, securing the GraphQL API, and ironing out any remaining issues for a stable release. The project aims for a release candidate in the upcoming months with a stable 1.0 release expected mid-year.

Tom Preston-Werner
Tom Preston-Werner
43 min
14 May, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Redwood JS is a full stack React app framework that simplifies development and testing. It uses a directory structure to organize code and provides easy data fetching with cells. Redwood eliminates boilerplate and integrates Jest and Storybook. It supports pre-rendering and provides solutions for authentication and deployment. Redwood is a cross-client framework that allows for building web and mobile applications without duplicating work.

1. Building a Web App with React, Prisma, and More

Short description:

To make a web app, I'll need React, Prisma, Apollo, Jest, Storybook, Webpack, Babel, authentication (probably Auth0), authorization, logging, code-splitting, OG tags, pre-rendering, and accessibility. Let's start with Create React App and then learn Prisma.

I know what you're thinking. I want to make a web app. So I'm going to need React. I'm going to need Prisma on the backend to talk to a database. I'm going to need Apollo to talk from the frontend to the backend.

I'm going to need Jest so I can write some tests. I'm going to need Storybook so I can design code and test my components in isolation. I'm going to need Webpack to glue this whole thing together. And I'm going to need Babel so I can compile, transpile ES6 down to ES5.

That's the web app, but I'm going to need to figure out how to deploy this thing. Maybe it could go to Netlify. They're really into Jamstack. Maybe it could go to Vercel. They've got a cool Triangle logo. What about render? Maybe then I could use containers and get long-running requests and GraphQL subscriptions. Or maybe I need the full power of AWS. I haven't decided yet.

In any case, I'm going to need some kind of authentication so I could use Auth0 for that. I'm not going to write my own. Gotta go further than that, though. I also need authorization. So I'm going to need some role-based access controls. And what about logging? I'm going to need really good logging send out to the provider of my choice.

I'm going to have to code-split this thing so the browser doesn't get too much code at any one time. I'm going to need OG tags, so this thing will unfurl on Twitter and Facebook. Gotta have pre-rendering probably in order to do that. And I'm going to need accessibility right out of the box. This thing works in screen readers.

All right. Let's do this thing. That's not really how it works, is it? It's more like this.

All right. Google my old friend, create react app. Okay, there you are. What's this? There we go. Launch. CX. Create react app. All right. What am I to call this thing? Gloobnox? That works. All right, we'll let that do its thing for a while. Let's learn how to use Prisma. Okay, Prisma, here we go. Nope. Not that one. Nope. Not that one either. Aha! Found you. Yep. Here we go.

2. Introduction to Redwood JS and Project Structure

Short description:

I'm here to tell you about Redwood JS, the full stack React app framework. A Redwood application is broken down into two sides: the web side with React and the API side with GraphQL and Prisma. Let's see some code. I have a simple to-do application written in Redwood. I've initialized the database and spun up the web server. I can add and toggle items on my to-do list, all via GraphQL. The project structure includes separate web and API folders within a monorepo.

Prisma docs. Quick start. All right. In this page you will learn how to send queries to a, okay, great. All right. This is going to take the rest of my life. But despair not, because I'm here today to tell you about Redwood JS, the full stack React app framework of your dreams.

Now, I know what you're wondering. Who is this bozo telling me what to do? Well, I'm Tom Preston Werner. You can find me online, at MoJombo on Twitter and GitHub. In the past I've created such companies as GitHub and Chatterbug, best place to learn a foreign language. I have also very active in open source. I created Jekyll. I wrote the semver, the semantic versioning specification, TOML, the configuration language used by a variety of packages, and Gravatar, the avatars that follow you around.

Now, getting back to this screen, remember all these technologies? These technologies are awesome, but you don't necessarily want to think about all of them. In fact, Apollo is great. But really, when I write an application, I want to worry about GraphQL and not really the intricacies of Apollo. And I also really don't want to worry about Webpack or Babel at all. In fact, I want to focus my attention on writing JavaScript or TypeScript. That's what I'm here for. I'm a programmer. Let me write code. That's what I do.

And so a Redwood application is going to be broken down into two sides. Very simple. A very simple model to think about. On the web side, you have your React application. This is where you think about your testing with Jest and your storybook. Those happen locally but conceptually they are really part of the web side of this. And then on the API side, you have an implementation of a GraphQL API that uses Prisma and a bunch of JavaScript or TypeScript to create your services, your business logic that is going to talk to your database and do what you need it to do. In between you've got GraphQL that talks back and forth. And GraphQL is how you make queries and also how you specify the queries and mutations that are going to happen. But enough chit-chat, let's see some code. I have here on the right opened GitHub.com slash Redwood JS slash example to do. This is a simple to do application written in Redwood that I thought I'd run you through a few things, and show off how Redwood works and how it thinks about the world. So I've cloned this down to my local machine. I've run Yarn, you can see the instructions here. And I've initialized the database. So it's all set up, ready to go. So the first thing that I'm going to do is run Yarn Redwood dev to spin up the web server. This is going to spin up both sides that I talked about before, both the web side and the API side, the front end and the back end, link them together, and fire up a new browser window with my to do list. So I'll show you how it works. I can say I need to order some milk, and some cheese, and some eggs. And I can toggle these things on and off. This is talking to the back end via GraphQL. You can see here in the logs, the posts to the GraphQL back end. So how does that work? Well, in the editor over here, you'll see the web folder and the API folder. This is a monorepo structure. So these are each separate packages within a single Git repository. So let's start where everything starts, which is with the routes.

QnA