This repository contains the second iteration of ResearchEquals.com that we are developing. For the in production code (v1
), please see libscie/ResearchEquals.com
.
macOS installation
Ensure you have brew
installed before following this guide.
# Install nodejs + npm
brew install nodejs
# Install corepack (required for yarn)
npm install -g corepack
# Enable yarn
corepack enable
# Install dependencies
yarn install
# Install mysql
brew install mysql
# Add local variables
cp .env.example .env
echo "DATABASE_URL=mysql://root:@localhost:3306/dev-db-researchequals" >> .env
# Apply the migrations to your database
yarn rw prisma migrate dev
# Start the development environment
yarn rw dev
Linux installation
To be added - see issue #6.
Windows installation
To be added - see issue #5.
yarn rw install
yarn rw dev
Here are some common actions:
# Create a new component
yarn rw g <component>
# Migrate the database
yarn rw prisma migrate dev
# Open the database studio env
yarn rw prisma studio
# TODO - sort these commands
yarn rw g scaffold <model>
yarn rw prisma format
Redwood description
? Enter a name for the new migration: › create posts ```
rw
is short forredwood
You'll be prompted for the name of your migration. create posts
will do.
Now let's generate everything we need to perform all the CRUD (Create, Retrieve, Update, Delete) actions on our Post
model:
yarn redwood generate scaffold post
Navigate to http://localhost:8910/posts/new, fill in the title and body, and click "Save".
Did we just create a post in the database? Yup! With yarn rw generate scaffold <model>
, Redwood created all the pages, components, and services necessary to perform all CRUD actions on our posts table.
Don't know what your data models look like? That's more than ok—Redwood integrates Storybook so that you can work on design without worrying about data. Mockup, build, and verify your React components, even in complete isolation from the backend:
yarn rw storybook
Seeing "Couldn't find any stories"? That's because you need a *.stories.{tsx,jsx}
file. The Redwood CLI makes getting one easy enough—try generating a Cell, Redwood's data-fetching abstraction:
yarn rw generate cell examplePosts
The Storybook server should hot reload and now you'll have four stories to work with. They'll probably look a little bland since there's no styling. See if the Redwood CLI's setup ui
command has your favorite styling library:
yarn rw setup ui --help
It'd be hard to scale from side project to startup without a few tests. Redwood fully integrates Jest with both the front- and back-ends, and makes it easy to keep your whole app covered by generating test files with all your components and services:
yarn rw test
To make the integration even more seamless, Redwood augments Jest with database scenarios and GraphQL mocking.
Redwood is designed for both serverless deploy targets like Netlify and Vercel and serverful deploy targets like Render and AWS:
yarn rw setup deploy --help
Don't go live without auth! Lock down your app with Redwood's built-in, database-backed authentication system (dbAuth), or integrate with nearly a dozen third-party auth providers:
yarn rw setup auth --help
The best way to learn Redwood is by going through the comprehensive tutorial and joining the community (via the Discourse forum or the Discord server).
- Stay updated: read Forum announcements, follow us on Twitter, and subscribe to the newsletter
- Learn how to contribute