Redwood.js Setup/Command Cheatsheet
William Imoh

William Imoh

6 min readNov 16 2020

Redwood.js Setup/Command Cheatsheet

Heya!

If you're reading this like at the start of the week (like I'm writing now), I hope you have an amazing week!

I recently started using Redwood.js, an opinionated JAMstack framework bringing fullstack to the JAMstack. With Redwood, you have the web (front-end) and API(backend) portions of your project in a mono-repo. Redwood comes with all the flavors of the JAMstack in one project.

Redwood is amazing and it's 'opinion' of how Jamstack software should be built is great so far. I'll create a follow-up post once I'm done with the side-project, scratch that, once I'm done with my review of Redwood. We know side-projects never make it out of side-project paradise.

In this post, I'll be sharing a cheatsheet of useful commands I've encountered during development and deployment. If you want a quick cheatsheet look, this is for you, and me. You can look in the docs for the full set of CLI commands.

Redwood commands take the form of

yarn redwood <command> 

The commands are shortened to

yarn rw <command>

Create a redwood app

yarn create redwood-app <app-name>

Run a development server

yarn rw dev

Create a production build

yarn rw build [folder..]

folder can either be the web or api portion of the project and the full command looks like:

yarn rw build web

Running the command without folder will build both projects in the mono-repo.

Generators

Generators are useful in creating boilerplate code to quickly scaffold a project or feature in the project.

Generate a page

yarn rw generate page <page-name>

This generator command is further shortened to

yarn rw g page <page-name>

Generate a cell

yarn rw g cell <cell-name>

Generate a scaffold

Scaffolds are simply beautiful and create boilerplate code to handle UI presentation, manage and store data in your database.

yarn rw g scaffold <scaffold-name>

Generate a component

yarn rw g component <component-name>

Generate a layout

Layouts are used to create consistent user interfaces on multiple pages.

yarn rw g layout <layout-name>

Generate SDL

This generates a graphQL schema file for your database.

yarn rw g sdl <sdl-name>

Generate deployment config

This generates deployment configuration files in the root directory of the project. For Netlify we have:

yarn rw g deploy netlify

Generate authentication config

This applies to multiple authentication providers, for Netlify we have:

yarn rw g auth netlify

Database commands

Create migration record

yarn rw db save create <migration name>

Update Database schema

yarn rw db up

See CLI options

yarn rw --help

I use these commands frequently, while I keep them in mind, you could peek in this cheatsheet if you need any of them quickly.

Regard,

William.


About the author

I love solving problems, which has led me from core engineering to developer advocacy and product management. This is me sharing everything I know.

More articles

logo
Get insights and tips on technical Content creation

Augment your marketing and product team to publish original technical content written by subject-matter experts for developers.

+1 (302) 703 7275

hi@hackmamba.io

Copyright © 2024 Hackmamba. All rights reserved