You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support sharing logic between client and server for models #3339
Right now all models are generated in server & client. This results in having duplicated classes if you want to use a shared package that can be used by server & frontend. (like extensions)
Why is server just no using client for all the models?
To reproduce
Just any serverpod project
Expected behavior
I would assume that server depends on client
Library version
2.4.0
Platform information
all platforms
Additional context
No response
How experienced are you with this library?
Expert - Experienced and comfortable with using this library in complex projects
Indeed the ServerOnly fields will still only be generated in the server package. but everything else should be the exact same class between server & frontend
changed the title [-]server should depend on client to fix duplicate classes[/-][+]Support sharing logic between client and server for models[/+]on Mar 24, 2025
Activity
SandPod commentedon Mar 24, 2025
This is discussed in part here with a possible workaround (quite advanced): #1256
The client versions of the models can't be used directly because there might be
ServerOnlyfields.With the introduction of interfaces, #2842, it would be possible to use the same definition if we were to exclude that feature.
SandPod commentedon Mar 24, 2025
Is it OK if I change the title of this issue to "Support sharing logic for server and client classes"?
Then we could track this specific usecase there.
vanlooverenkoen commentedon Mar 24, 2025
@SandPod perfect!
Indeed the ServerOnly fields will still only be generated in the
serverpackage. but everything else should be the exact same class betweenserver&frontend[-]server should depend on client to fix duplicate classes[/-][+]Support sharing logic between client and server for models[/+]