Skip to content

Need way of marking server class for inclusion in client #993

Closed

Description

@lukehutch

Is your feature request related to a problem? Please describe.

Often a client and server need to share code. Currently with Serverpod, as far as I can tell you have to manually keep in sync two copies of any class that you need on both the client and server.

Describe the solution you'd like

There needs to be an annotation (e.g. @clientAndServer) that can be added to a server class to cause that class to be copied over verbatim into the client when serverpod generate is called.

Activity

  1. Isakdl commented on Jun 5, 2023

    @Isakdl
    Collaborator

    When you run serverpod generate any classes defined in a yaml file in the protocol folder will generate client classes too. They are located in the client project, so I think what you want already exists.

  2. lukehutch commented on Jun 5, 2023

    @lukehutch
    ContributorAuthor

    I don't need record classes to be generated from a yaml description, I need an entire dart class to be copied from server to client. There are some non-record methods that I want to add to the shared class, and the yaml description doesn't allow for that.

  3. added
    area: models
    enhancement
    on Dec 18, 2024
  4. moved this from Backlog 🗂️ to Done 🚀 in Serverpod Frameworkson Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: modelsenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions