Tutorial: Scaffolding vs custom cells

Hi, I’ve starting following through the tutorial and am a little confused around the purpose of some core concepts, particularly scaffolding.

At this stage, we’ve just seen the power of scaffolds; creating an entire CRUD interface complete with files like PostCell.
The tutorial then moves on to creating a new cell for the purpose of listing posts on the home page, which is named ArticlesCell (to avoid a name clash). This is briefly justified in the “Creating a Blog Homepage” section I linked above.

Could someone give me the gist of why we’d create a new cell here, rather than reusing + customise the existing ones created by the scaffold?
I understand this is a contrived example for the sake of demo, but I’m a little conflicted over the purpose of scaffolding; it seems to have massively accelerated the dev process, only to be thrown aside and (presumably) relegated to an admin screen that may not be any use at all. With awkward naming thrown into the mix - naming is hard enough without having to think of additional synonyms for duplicated functionality!

I’d really appreciate any clarity on the purpose of scaffolding, and people’s habits for using it.

Thanks for reading.

EDIT: also, the scaffolding happens just after we’ve been introduced to Prisma Studio, precisely for the purpose of being able to manipulate our Post data without building a UI! So as powerful as the scaffolding is, it doesn’t seem to be giving us much here.

None of this is in any way a criticism, I love what you’re doing and just looking to get these concepts + tools right in my head : )

1 Like

A scaffold will take a Prisma model and create all the basic CRUD functionality.
It’ll make the pages associated with the model (single post page , all posts page), it’ll make routes to those pages in Routes.tsx or Routes.jsx, it’ll make the edit pages too which is helpful to not need all that boilerplate each time, you’ll see it actually makes cells as well. It will also make the service and sdl files on the api side.
I use scaffold when I want that CRUD functionality for a model like we do for the posts in the tutorial.

So then you use a cell when you want to fetch data, but you do not necessarily need all that extra. That might include fetching data from a 3rd party like in the reference examples at bottom of the docs page. In this case you need to make the service and sdl yourself.

As for Prisma Studio, it is an awesome tool to visualize your database, models, schema and be able to edit it there, but it’s not what you want users messing with so it’s a dev admin tool. I use it all the time to massage data that might be weird or faulty.

You absolutely can edit the posts cell to do what you want in service or sdl (Say you only want posts from the last 5 days in one version of the query)

As the app grows it can help to seperate out all that so cells give a way to maybe hit the same query, but then do something different with it like what the articles section is doing.

I think that’s what the tutorial is showing that:

  1. you want to avoid the naming conflict and
  2. you can reuse your service logic into different cells

The generators get you started then after that it’s all TS/JS and you can hack away at. There’s also the contact form example later in the tutorial showing the no-crud flag.

Cheers for the response. The scaffolds do seem incredibly useful, it just seemed like the tutorial shows off the magic available and then didn’t really make much actual use of it. But I see your point about tweaking the files it gens for us, I’m sure once I get cracking properly I’ll find all sorts of uses for it.

Overall though I’m so impressed so far, Redwood people. Please do keep it up!

Also the tutorial + docs are written so clearly, great work!