redwoodjs / redwood

The App Framework for Startups

Home Page:https://redwoodjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[RFC]: Ability to use redwood generate scaffold as a standalone tool

Tsimopak opened this issue · comments

Summary

Hi,

I would like to suggest (or perhaps ask if) using Redwood generate scaffold tool as a standalone one.

Motivation

This scaffold tool is very powerful and had the ability to do the following: (taken from redwood's docs):

A scaffold quickly creates a CRUD for a model by generating the following files and corresponding routes:
sdl
service
layout
pages
cells
components

I would very much like to get the backend abilities - the jest testing, sdl file + mutations, crud operations and the ability to also get the typescript version of it as a standalone tool.

I think that the output of this tool at its current state is very much generic and can fit to so many other projects as well, so it will be very excited to tweak it up to be a bit more generic.

Detailed proposal

It could either stick with current scaffold convention or serve as an official prisma generator as other do:
https://www.prisma.io/docs/orm/prisma-schema/overview/generators#community-generators

An example to CLI structure as it is right now

npx redwood generate scaffold <MODEL> <FLAGS>

Would generate in a certain folder, the CRUD operations, SDL that can be imported and used in any project.

Are you interested in working on this?

  • I'm interested in working on this

@Tsimopak Thanks for your RFC. First time I heard someone ask this 🙂 Very interesting!
How would you use the generated files? With some other web frontend? Or some other way?

Thanks for the fast response @Tobbe,
I want to build my server a bit differently and explore different tools.
I also feel like exporting the scaffold tool to be a Prisma generator for CRUD + SDL could very much be benefitial for others to use outside of redwood ecosystem :)

I think it's going to be very difficult to use it outside of RW. Especially outside of Redwood's API side. We have a special way of doing gql resolvers (that we think is much easier!). But that does mean they're not so easy to transfer to some other server.
Also, a lot of what our scaffold generator does is generate the frontend, with List, Details and Edit views, (including things like tables, forms, mutations, queries, loading states etc)

@Tobbe Thanks!, is it possible to use only the backend of RedwoodJS?

@Tobbe Thanks!, is it possible to use only the backend of RedwoodJS?

Yes! We've had people do that before 🙂 There is not automatic way to do it, but it is doable.