packages/serverpod/skills/serverpod-endpoints/SKILL.md
Define Serverpod endpoints, use Session, pass parameters, and call from client. Use when creating RPC endpoints, working with Session, or client code generation.
npx skillsauth add serverpod/serverpod serverpod-endpointsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Extend Endpoint with instance methods; first parameter is Session, return Future<T> (or Stream<T> for real-time data streaming). Place anywhere under server lib/. If serverpod start is not running with hot-reload, run serverpod generate to update the client.
import 'package:serverpod/serverpod.dart';
class ExampleEndpoint extends Endpoint {
Future<String> hello(Session session, String name) async {
return 'Hello $name';
}
}
Client name is derived from the class name minus Endpoint suffix (ExampleEndpoint → example).
var result = await client.example.hello('World');
Client initialized once:
final serverUrl = await getServerUrl();
client = Client(serverUrl)
// When using Flutter:
..connectivityMonitor = FlutterConnectivityMonitor()
// When using authentication:
..authSessionManager = FlutterAuthSessionManager();
bool, int, double, StringDuration, DateTime (UTC), ByteData, UuidValue, Uri, BigInt.spy.yaml)List, Map, Set, Record — strictly typed with the aboveDefault request size limit: 512 kB. Change with maxRequestSize in config. Use the file upload API for large files.
Provides: database access (session.db, Model.db), cache (session.caches), logging, request context. Do not capture for use after the request completes.
@doNotGenerate on the class.@doNotGenerate on the method.@doNotGenerate: Parent hidden; subclass gets a client implementing inherited methods.Overriding is allowed: same signature, different behavior, client code unchanged.
Older app versions may still call your server. Do not rename parameters (REST API passes by name). Do not delete methods, add required parameters, or change signatures; add new methods or optional named parameters instead.
When you must break an endpoint's API, create a versioned endpoint:
@Deprecated('Use TeamV2Endpoint instead')
class TeamEndpoint extends Endpoint {
Future<TeamInfo> join(Session session) async { /* ... */ }
}
class TeamV2Endpoint extends TeamEndpoint {
@override
@doNotGenerate
Future<TeamInfo> join(Session session) async => throw UnimplementedError();
Future<NewTeamInfo> joinWithCode(Session session, String invitationCode) async {
// New implementation
}
}
Old clients use client.team.join(); new clients use client.teamV2.joinWithCode(...). Remove the old endpoint after all clients upgrade. Alternative: extract logic into a helper class callable from both endpoints.
development
Build highly distinctive, production-ready Flutter interfaces with exceptional design fidelity. Include this skill whenever a user requests Flutter widgets, screens, or full apps.
testing
Serverpod Authentication — Signing in users, verify if they are authenticated, assinging scopes (e.g., admin). Use when adding features that require the user to be signed in.
development
Serverpod web server (Relic) — REST APIs, webhooks, middleware, static files, server-rendered HTML, SPAs, Flutter web. Use when adding HTTP routes, serving web pages or web apps, intercepting requests, or working with the Relic web server.
tools
Serverpod overview — what it is, project structure, how to work with. Always use at least once when working with projects that use Serverpod.