@redswitch/generator
v0.0.7-alpha
Published
A Strapi to Feature-based React frontend generator for models
Downloads
2
Readme
rsgen
A plop-based generator to generate opinionated React files from Strapi-defined models.
Templated applications currently available:
- Atomic React frontend
- Generate a fully featured frontend with Auth
- Generate Feature components from Strapi Models
- Strapi backend
- User and user datum models included
- Clients for heavy AWS integrations
Templated applications to come soon:
- Terraform
How to use
Every generation prompt is run through one command:
rsgen
1. Generate the rsgen config file
Run rsgen
to generate the rsgen.config.json
file. This will generate a file with the configurations below:
{
/* These properties are generated by rsgen */
// The name of the frontend directory
"frontendFolder": "<USER_INPUT>",
// The name of the backend directory
"strapiFolder": "<USER_INPUT>",
/* These properties can be added to the rsgen.config.json file after creation to override the defaults */
// The base path for the generator. By default, this will point to the app's base package.json (where @redswitch/generator is installed)
"base": "/base/root/path",
// The plurality of the folder names, grabbed from Strapi's model attributes fields. Can be 'pluralName' or 'singularName', defaults to 'pluralName'
"modelNamePlurality": "pluralName",
}
WARNING: Modifying the rsgen.config.json
fields frontendFolder
and strapiFolder
after it has been generated will break functionality unless you also change those folder names on your machine to match.
2. Bootstrap the necessary applications
Run rsgen
and choose Bootstrap Applications
in the prompts. The generator will generate the template files as well as npm install
the necessary modules.
NOTE: Make sure to refer to the README files within both your frontend and backend directory, as there is some additional setup depending on your choices.
3. Generate feature components
Run rsgen
and choose either Generate frontend feature from a strapi model
or Generate frontend features from all strapi models
. This step assumes you have read the backend README and provisioned the necessary resources to run the Strapi backend.