Skip to content

docs: Clarify how endpoint names map to client properties - #767

Open
Benzzick wants to merge 1 commit into
serverpod:mainfrom
Benzzick:improve-creating-endpoints-for-beginners
Open

docs: Clarify how endpoint names map to client properties#767
Benzzick wants to merge 1 commit into
serverpod:mainfrom
Benzzick:improve-creating-endpoints-for-beginners

Conversation

@Benzzick

Copy link
Copy Markdown

Summary

Adds a tip explaining how Serverpod endpoint class names map to
properties on the generated client.

For example:

  • RecipeEndpoint
  • client.recipe

This helps clarify why endpoint methods are called through
client.recipe.generateRecipe(...) after code generation.

@developerjamiu developerjamiu changed the title docs: clarify how endpoint names map to client properties docs: Clarify how endpoint names map to client properties Aug 27, 2026
Comment on lines 107 to +111
`serverpod generate` will create bindings for the endpoint and register them in the server's `generated/protocol.dart` file. It will also generate the required client code so that you can call your new `generateRecipe` method from your app.

:::tip Endpoint names become client properties
In the next section you'll call `client.recipe.generateRecipe(...)` — not `client.recipeEndpoint.generateRecipe(...)` or `client.generateRecipe(...)`. That's not a typo: Serverpod derives the property name from your endpoint's class name by dropping the `Endpoint` suffix and lowercasing the first letter, so `RecipeEndpoint` becomes `client.recipe`. Every method you add inside the class shows up under that property, e.g. `client.recipe.generateRecipe(...)`. This mapping is generated automatically by `serverpod generate` above — there's nothing to configure by hand, but it's worth knowing the rule so the client code doesn't feel like it's coming out of nowhere.
:::

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tip covers a real gap: the 4.0 version of this page explains this mapping and the 3.4 page doesn't. Two things about the form though. It sits directly above an existing :::note, so the section runs prose, tip, note, heading, and callouts stacked like that compete rather than stand out. It also introduces the only em dash on this page.

The 4.0 page carries the same fact as one clause in a paragraph, which reads lighter here too:

Suggested change
`serverpod generate` will create bindings for the endpoint and register them in the server's `generated/protocol.dart` file. It will also generate the required client code so that you can call your new `generateRecipe` method from your app.
:::tip Endpoint names become client properties
In the next section you'll call `client.recipe.generateRecipe(...)` — not `client.recipeEndpoint.generateRecipe(...)` or `client.generateRecipe(...)`. That's not a typo: Serverpod derives the property name from your endpoint's class name by dropping the `Endpoint` suffix and lowercasing the first letter, so `RecipeEndpoint` becomes `client.recipe`. Every method you add inside the class shows up under that property, e.g. `client.recipe.generateRecipe(...)`. This mapping is generated automatically by `serverpod generate` above — there's nothing to configure by hand, but it's worth knowing the rule so the client code doesn't feel like it's coming out of nowhere.
:::
`serverpod generate` will create bindings for the endpoint and register them in the server's `generated/protocol.dart` file. It will also generate the required client code so that you can call your new `generateRecipe` method from your app. The class name's `Endpoint` suffix is dropped and the first letter lowercased, so `RecipeEndpoint` is called via `client.recipe`, and every method in the class appears under that property.

@@ -241,4 +245,4 @@ Try out the app by clicking the button to get a new recipe. The app will call th

## Next steps

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This drops the trailing newline on a line the change doesn't otherwise touch. Restore it.

@developerjamiu developerjamiu added the enhancement New feature or request label Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants