From GraphQL Zero to GraphQL Hero with RedwoodJS

Rate this content
Bookmark
Redwood.js is a full stack app framework designed for rapid prototyping and building startups. It uses a React-based front end and a Node.js back end. To start a new Redwood.js application, use 'yarn create redwood-app' followed by your application name. Prisma manages database interactions, and you can run 'yarn redwood prisma migrate-dev' to apply migrations. Redwood.js simplifies GraphQL API development by mapping SDL queries and mutations to JavaScript functions in the service layer. It offers integrated testing, depth limiting, and secure-by-default functionalities. You can generate scaffolds for CRUD operations using 'yarn redwood g scaffold'. While still in the release candidate phase, Redwood.js is stable enough for production use. It supports various authentication mechanisms and plans to expand to multiple frontend frameworks. Contributing to the project is encouraged, as it is open-source under the MIT license.

From Author:

We all love GraphQL, but it can be daunting to get a server up and running and keep your code organized, maintainable, and testable over the long term. No more! Come watch as I go from an empty directory to a fully fledged GraphQL API in minutes flat. Plus, see how easy it is to use and create directives to clean up your code even more. You're gonna love GraphQL even more once you make things Redwood Easy!

This talk has been presented at GraphQL Galaxy 2021, check out the latest edition of this Tech Conference.

FAQ

Redwood.js is a full stack app framework designed for rapid prototyping and building startups. It consists of a React-based front end and a Node.js based back end, utilizing Apollo Client, GraphQL Helix, Envelop, and Prisma for database management.

To create a new Redwood.js application, use the command 'yarn create Redwood app' followed by your application name. This sets up the necessary folder structure and installs dependencies.

After defining your database schema, run 'yarn Redwood Prisma migrate-dev' to apply migrations. Then, use 'yarn Redwood Prisma db seed' to populate your database with initial data.

Redwood.js simplifies GraphQL API development by automatically mapping SDL queries and mutations to corresponding JavaScript functions in the service layer. It uses GraphQL Helix and Envelop to facilitate the server-side operations.

Redwood.js offers a streamlined setup for GraphQL APIs, integrated testing, depth limiting to prevent abuse, secure-by-default functionalities, and easy integration with various authentication mechanisms.

Use the command 'yarn redwood g' followed by 'scaffold' and the name of the entity to automatically generate CRUD operations for both front-end and back-end, enhancing rapid development.

While Redwood.js is still in the release candidate phase and not yet version 1.0, it is stable enough for production, with many startups already using it actively for development.

Redwood.js uses directives like 'require auth' to secure GraphQL queries and mutations, ensuring that operations are authenticated and authorized according to custom logic defined within the framework.

Currently, Redwood.js supports a React-based frontend but plans to expand to support multiple frontend frameworks and technologies, enhancing flexibility for developers.

Yes, Redwood.js is an open-source project under the MIT license, welcoming contributions from developers. Interested individuals can contribute to its development by submitting pull requests and participating in community discussions.

Tom Preston-Werner
Tom Preston-Werner
32 min
09 Dec, 2021

Comments

Sign in or register to post your comment.

Video Transcription

1. Introduction to Redwood.js

Short description:

Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably.

♪♪ ♪♪ ♪♪ Hey, everyone. Tom Pressenwurter here with a simple question for you. What's the easiest way to get a GraphQL API up and running? We all love GraphQL, but it can feel a little daunting sometimes to get a project going. And here's another question. Can it be easy and maintainable? Can you keep things in an orderly fashion over the long term? Well, that's where Redwood.js comes in. Redwood.js is a full stack app framework, perfect for everything from rapid prototyping to building startups. I've been working on it for the past two years, and I think it's become something really useful, both on the front end and the back end.

2. Redwood.js Application Overview and Setup

Short description:

Tom Pressenwurter demonstrates a Redwood.js application, with a React-based front end and a Node.js API on the back end. Prisma is used for database communication. He then creates a new Redwood.js app called 'tracks' and sets up the development environment.

Let me show you what a Redwood.js application looks like. On the front end, we have a web application, single page app, React-based. And on the back end we have a Node.js based API written in JavaScript or TypeScript. The front end talks to the back end using Apollo Client and speaks GraphQL to the back end where we use GraphQL Helix and Envelop to create the GraphQL server.

In your business logic, you'll use Prisma to talk to a database. While Redwood.js provides the front end and the back end, today I'm gonna focus mostly on the back end and creating the GraphQL API. So let's go look at some code.

Okay, so the first thing I'm gonna do is create a new Redwood.js app using yarn create Redwood app, and I'm gonna make a simple music app. So I'm gonna call it tracks. This is going to fetch all the dependencies. Run yarn install, et cetera. Usually takes a little while, so let me speed that up for you. There we go. I'm gonna go into that directory and I'm gonna open up VS code from there. First thing I'm gonna do, I'm gonna grab a terminal window here and I'm gonna make this a git repository so you can more easily see what files I'm changing.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
React Compiler - Understanding Idiomatic React (React Forget)
React Advanced Conference 2023React Advanced Conference 2023
33 min
React Compiler - Understanding Idiomatic React (React Forget)
Top Content
Watch video: React Compiler - Understanding Idiomatic React (React Forget)
Joe Savona
Mofei Zhang
2 authors
The Talk discusses React Forget, a compiler built at Meta that aims to optimize client-side React development. It explores the use of memoization to improve performance and the vision of Forget to automatically determine dependencies at build time. Forget is named with an F-word pun and has the potential to optimize server builds and enable dead code elimination. The team plans to make Forget open-source and is focused on ensuring its quality before release.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Full Stack Documentation
JSNation 2022JSNation 2022
28 min
Full Stack Documentation
Top Content
The Talk discusses the shift to full-stack frameworks and the challenges of full-stack documentation. It highlights the power of interactive tutorials and the importance of user testing in software development. The Talk also introduces learn.svelte.dev, a platform for learning full-stack tools, and discusses the roadmap for SvelteKit and its documentation.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Suspense is a mechanism for orchestrating asynchronous state changes in JavaScript frameworks. It ensures async consistency in UIs and helps avoid trust erosion and inconsistencies. Suspense boundaries are used to hoist data fetching and create consistency zones based on the user interface. They can handle loading states of multiple resources and control state loading in applications. Suspense can be used for transitions, providing a smoother user experience and allowing prioritization of important content.
Jotai Atoms Are Just Functions
React Day Berlin 2022React Day Berlin 2022
22 min
Jotai Atoms Are Just Functions
Top Content
State management in React is a highly discussed topic with many libraries and solutions. Jotai is a new library based on atoms, which represent pieces of state. Atoms in Jotai are used to define state without holding values and can be used for global, semi-global, or local states. Jotai atoms are reusable definitions that are independent from React and can be used without React in an experimental library called Jotajsx.

Workshops on related topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.