create-relay-app

Easy configuration of Relay.js for existing projects

Latest version published to npm npm downloads per month Project license

Showcase

Motivation

Setting up Relay can be quite time consuming, since there are many setup steps that might differ, depending on the toolchain you use.

The goal of this project is to automate the setup process as much as possible and give you a fast and consistent configuration experience across the most popular React toolchains.

Contrary to many existing tools that aim to solve similiar use cases, this project isn’t simply scaffolding a pre-configured boilerplate. We actually analyze your existing code and only insert the necessary Relay configuration pieces.

Supported toolchains

create-relay-app supports:

Usage

  1. Scaffold a new project using the toolchain of your choice (as long as it’s supported
    • Next.js: yarn create next-app --typescript
    • Vite.js: yarn create vite --template react-ts
    • Create React App: yarn create react-app <new-project-directory> --template typescript
  2. Install all the packages and ensure that the template is functioning. If it comes with a Git repository, ensure your working directory is clean, by commiting or discarding any changes.
  3. Run the script inside of the scaffolded directory:
npm/yarn/pnpm create @tobiastengler/[email protected]

Note: We are working on getting the create-relay-app name!

This will prompt you for a bunch of questions around your project setup. If you do not want to specify these options interactively, you can also specify them through the CLI arguments. Passing -y will infer all arguments based on your project.

GitHub

View Github