How to not mess with Server Actions and Filestructure?

there is no such thing unfortunately
i wish the team come with a solution for this. since its really hard to manage the project when it increase in size.

You can search for any references to an action file.

image

Why you dont have regular server action group. This is so hard for you.

You can create directory for server actions then you can group them …why you didnt try this way ?

Maybe you can try directory names like your pages name or etc …

You can find used server actions in page . Check your page . You will see the used server actions and can see the actions in url

3 Likes

that’s not that great with many server actions. where i have to go to every page and check if i used that server action there.
it will be better (for example) if you could see a list of pages where this server action is on.

I have to admit, even i can get quite confused from time to time, and its not like you can just rename them all that easily without going through the file structure, so my suggestion would be to add in one more area called INTERNAL NOTES, in this area you can type whatever you like, such as used on Page x, y, z. Or a long description or something. It will make it so much easier when you go back to a project a year later if there were some notes, just like commenting does for us.

If you store your action files in properly named and structured folders I don’t think there would be any confusion.
For example, you won’t expect to to find a server action for user registration which is located here:

/uploads/gallery/imageUploadInsert.php

I don’t really see any issues the way action files work. It all depends on your own files organization/structure.

@Teodor will that is not always the case since sometimes you use the same server action in multiple pages that have nothing in common from the name.

Well, that’s what I said it all depends on how you name and store your server actions :slight_smile:
If you organize your files properly and following a certain logic you won’t have issues.

Youre right with that and thats also the way im working: FileNaming and Folderstructure.

But as you can mess your whole project with changing the wrong Serveraction located in different Files it could get worse. It would be nice to see some depencies

X[quote=“mrbdrm, post:5, topic:3542”]
if you could see a list of pages where this server action is on.
[/quote]

Isn’t this exactly what you see if you do a search for an action file?

no search will not just show you the pages. its a search by words. so it will show everything server action or not.

I wouldn’t have thought it likely that an action file name would occur in other contexts. I’ve decided to rename action files quite a few times; finding all references to the file has never struck me as as being been a problem.

thats not a solution :sweat_smile:
as i explained its easy to follow this with small projects and handful of server actions but its get messy as your project grow.

its like me building an application and not including the proper filtering and saying to my client " well you should name your items correctly" :joy:

cant force naming to be the only way to organize my work.

its not a show stopper but a thing to improve on if possible. im just providing feedback as a user

1 Like

you could name your actions with a space. so its not a requirement to be a single word.

Im using UpperLowercase as Im using them in Classes/Functions, but even then: Depencies would be nice

That’s true. I rarely use spaces in filenames. Perhaps you can surround the filename with “” when searching. (I’m not in front of a computer at the moment.)

For me, this problem is not identifying which server action goes with which page but sometimes when switching between pages finding the wrong server action is selected and then editing the wrong one! A “lock action file” option would be useful to ensure working server actions don’t accidentally get edited and hence broken.

2 Likes

@Hyperbytes good idea. Locking or showing depencies/affection. Anyway for bigger projects very helpful. Or at least some kind of rollback…

One approach to follow when organizing your server actions is for example the CRUD naming that follows your database tables.

So you will have folders same as database tables names and below then actions like get, list, insert, update and delete.

This way at least you can find the right database actions pretty quickly.

The rest of the general actions or combined actions you should group by major functionally part so they all make sense when searching.

I think this falls in the “ best practices” and maybe other people working with larger project can share their logical organization

1 Like

@George this is a good idea :ok_hand:t5: and ill start with that! Cause every table has „only“

  1. Create :heavy_plus_sign:
  2. Read :eyes:
  3. Update :arrows_counterclockwise:
  4. Delete :heavy_minus_sign:

possibilities and your naming concept makes sense to me.

And now about ordering the Action Steps I think there is also some best practice. As first a DB connection/CRUD is needed before going with a Security Provider.