serverpod-endpoints

Define Serverpod RPC endpoints with typed Session-aware methods for Flutter clients.

3.2k|369|Updated May 22, 2021
One-click install
npx skills add https://github.com/serverpod/serverpod --skill serverpod-endpoints
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: serverpod-endpoints
Source: https://github.com/serverpod/serverpod/tree/main/packages/serverpod/skills/serverpod-endpoints
Command: npx skills add https://github.com/serverpod/serverpod --skill serverpod-endpoints

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It removes the friction of building and wiring server RPC endpoints by letting you define typed endpoint methods that automatically become callable client APIs.

Core Features & Use Cases

  • Typed endpoint definitions: Extend Endpoint and write methods that accept a Session plus strongly typed parameters, returning Future<T> (or Stream<T> for real-time).
  • Client code generation: Use the class name to generate a consistent client API, so calling an endpoint feels like calling a local method.
  • Safe parameter/return modeling: Support primitives, common standard types (e.g., DateTime, Uri), generated serializable models, and strictly typed collections/records for end-to-end serialization.
  • Session-centered design: Use session for database access (session.db, model DB helpers), caching, logging, and request context without leaking it beyond the request lifecycle.
  • Codegen controls and evolution: Exclude endpoints or methods with @doNotGenerate, and preserve backward compatibility by not renaming or breaking existing signatures while using versioned endpoints when changes are unavoidable.
  • Use case: You want a Flutter client to authenticate and fetch domain data; define an endpoint method like Future<UserProfile> getProfile(Session session, String userId) and then call it from the generated client as await client.user.getProfile(userId).

Quick Start

Create a Dart class extending Endpoint under your server lib/ directory, define an async method whose first parameter is Session and whose return type is Future of your result model.

Frequently Asked Questions about serverpod-endpoints

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define RPC endpoints in Dart for a Flutter app?

To define RPC endpoints in Dart for a Flutter app, create a class extending Endpoint under your server lib/ directory, write async methods accepting a Session as the first parameter, and return Future<T> or Stream<T>.

How do I generate Flutter client APIs from server-side Dart methods?

You generate Flutter client APIs from server-side Dart methods by using serverpod generate, which automatically creates a consistent client API so calling an endpoint feels like calling a local method.

Can I use Stream for real-time data in Serverpod endpoints?

Yes, you can use Stream for real-time data in Serverpod endpoints by returning Stream<T> from your endpoint method, enabling streamed real-time data handling between the server and generated Flutter clients.

What parameter and return types are safe for Serverpod RPC methods?

Safe parameter and return types for Serverpod RPC methods include primitives, standard types like DateTime and Uri, generated serializable models, and strictly typed collections or records for end-to-end serialization.

How do I exclude specific Serverpod endpoints from client code generation?

To exclude specific Serverpod endpoints from client code generation, annotate the endpoint classes or methods with the @doNotGenerate tag, preventing them from being exposed in the generated client API.

How do I maintain backward compatibility when changing Dart RPC method signatures?

To maintain backward compatibility when changing Dart RPC method signatures, avoid renaming or breaking existing signatures, and instead use versioned endpoints when signature changes are unavoidable.