Comprehensive Serverpod backend framework expertise for full-stack Dart/Flutter development. Use when building server-side applications with Serverpod, implementing backends for Flutter apps, working with type-safe ORMs, creating real-time features, managing authentication, or deploying production Dart servers. Covers installation, project setup, endpoints, database operations, authentication, real-time communication, file uploads, deployment, and testing.
From flutter-corenpx claudepluginhub aaronbassett/agent-foundry --plugin flutter-coreThis skill uses the workspace's default tool permissions.
examples/api-integration.mdexamples/full-stack-app.mdreferences/authentication.mdreferences/database-orm.mdreferences/deployment.mdreferences/endpoints.mdreferences/file-uploads.mdreferences/real-time.mdreferences/serverpod-setup.mdSearches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Build production-ready, full-stack Flutter applications using Dart for both frontend and backend with Serverpod, the next-generation app server explicitly designed for the Flutter and Dart ecosystem.
Serverpod is an open-source, scalable backend framework that enables developers to write complete applications—frontend and backend—using only Dart. It eliminates context-switching between programming languages and provides a streamlined development experience with automated code generation, type-safe database operations, and built-in real-time capabilities.
Single Language Stack: Write your entire application in Dart, from Flutter UI to server-side business logic, reducing cognitive load and maintaining consistent patterns across your codebase.
Type Safety Throughout: Serverpod's code generation ensures type safety from database queries through API endpoints to client applications, catching errors at compile time rather than runtime.
Developer Productivity: Automated code generation, hot reload support, and intuitive APIs enable rapid development without sacrificing code quality or maintainability.
Serverpod provides a sophisticated ORM that translates Dart code into optimized PostgreSQL queries. Define your data models in YAML, and Serverpod generates fully typed database operations with support for complex queries, relations, and migrations.
Benefits: No SQL injection vulnerabilities, compile-time query validation, auto-completion for database operations, and seamless integration with your Dart types.
Built-in WebSocket support enables streaming data between server and client through Dart's native Stream API. Serverpod automatically manages connections, handles failures, and pipes multiple concurrent streams through a single WebSocket connection.
Use Cases: Live chat, real-time notifications, multiplayer games, collaborative editing, and any feature requiring instant data synchronization.
Production-ready authentication supporting email/password, Google Sign-In, and Apple Sign-In out of the box. Choose between JWT-based stateless authentication or traditional server-side sessions based on your architecture needs.
Features: Two-factor authentication, custom identity providers, automatic token refresh, and beautiful pre-built UI components that can be customized or replaced.
Handle file uploads with configurable storage backends including Amazon S3, Google Cloud Storage, or PostgreSQL. Serverpod manages upload permissions, file verification, and provides convenient access methods.
Configuration: Set file size limits, validate MIME types, generate signed URLs for secure access, and seamlessly switch between storage providers.
Replace complex cron jobs with type-safe future calls. Schedule method invocations at specific times or after delays, with automatic persistence across server restarts.
Reliability: Failed calls can be retried automatically, execution status is monitored, and scheduled tasks integrate seamlessly with your existing endpoint methods.
Creating a Serverpod project generates three integrated packages:
This structure supports monorepo workflows and makes it easy to share types and validation logic across your stack.
Serverpod's CLI analyzes your YAML model definitions and endpoint implementations, generating:
Run serverpod generate after modifying models or endpoints to keep everything synchronized.
The development environment uses Docker Compose to provide PostgreSQL and optional Redis services. Start the database with docker compose up, launch your server with dart run bin/main.dart --apply-migrations, and run your Flutter app with flutter run.
Changes to endpoints are immediately available after code generation. Database schema changes are managed through migrations, ensuring data integrity during development.
Structure endpoints by feature or domain rather than technical concerns. Each endpoint extends the Endpoint base class and contains related method groups. Use abstract endpoints to share common logic across multiple concrete endpoints.
Naming: Serverpod automatically removes the "Endpoint" suffix when generating client code, so UserEndpoint becomes client.user in the client application.
Define models in .spy.yaml files within your server's lib directory. Models support inheritance, sealed classes for exhaustive type checking, and field visibility control for sensitive data.
Database Mapping: Add a table property to persist models to PostgreSQL. Serverpod handles index creation, foreign keys, and schema migrations automatically.
Keep business logic in separate classes that endpoints call, making code testable independent of the network layer. Use dependency injection to provide database sessions, external API clients, or configuration to your business logic.
Testing: Serverpod's test framework provides the withServerpod helper for integration tests, automatically handling database transactions and cleanup.
Use include methods to eagerly load related data in a single query rather than making multiple database round trips. Apply filters before includes to reduce data transfer.
Pagination: Always use limit and offset for large result sets. Consider cursor-based pagination for real-time feeds or infinite scroll interfaces.
Create migrations after model changes with serverpod create-migration, review the generated SQL, and apply migrations during server startup with the --apply-migrations flag.
Production: Use maintenance mode for zero-downtime deployments, applying migrations before switching traffic to new server instances.
Serverpod automatically creates indexes for foreign keys and fields marked with !dbindex. For complex queries, add custom indexes through migration SQL or use database-specific features.
Choose JWT for stateless authentication suitable for serverless deployments or server-side sessions for traditional architectures. JWTs reduce database queries but require careful key management, while sessions provide easier revocation but add database overhead.
Configuration: Store secrets in config/passwords.yaml (excluded from version control) or environment variables following the SERVERPOD_PASSWORD_<key> pattern.
Implement identity providers by extending abstract endpoint classes and configuring provider-specific settings. Each provider handles its own OAuth flow, token exchange, and user profile retrieval.
Custom Providers: Create custom identity providers for enterprise SSO, SAML, or proprietary authentication systems by implementing the identity provider interface.
Serverpod projects include Dockerfiles configured for production deployment. Build containers with docker build, configure runtime behavior through environment variables, and deploy to any container orchestration platform.
Environment Variables: Control run mode (development/staging/production), server role (monolith/serverless/maintenance), and logging verbosity through container environment configuration.
Deploy to AWS using provided Terraform scripts that configure autoscaling EC2 clusters, RDS PostgreSQL, ElastiCache Redis, S3 storage, CloudFront CDN, and Route 53 DNS. Google Cloud Platform deployment follows similar patterns with GCP-specific resources.
Managed Services: Serverpod Cloud (currently in private beta) provides fully managed hosting with automatic scaling, monitoring, and zero-configuration deployment.
Serverpod Insights provides real-time monitoring of database queries, endpoint performance, and error logs. Integrate with external services like Sentry, Datadog, or Highlight using diagnostic event handlers.
Custom Logging: Use session.log() for application-specific logging with configurable severity levels. Logs persist to the database and are searchable through Serverpod Insights.
Serverpod provides three cache types: local cache for single-server deployments, priority cache for frequently accessed items, and distributed Redis cache for multi-server clusters.
Cache Miss Handlers: Automatically populate cache on misses by providing handler functions that load from the database and store results with configurable TTL.
Database connections are pooled automatically. Configure pool sizes in your environment's config file based on expected concurrent load and database server capacity.
Redis: Optional Redis integration provides distributed locking, pub/sub messaging, and cluster-wide caching. Enable through configuration without code changes.
Use withServerpod to create isolated test environments with automatic database cleanup. Each test runs in a transaction that rolls back after completion, ensuring tests don't interfere with each other.
Authentication Testing: Override authentication state using AuthenticationOverride.authenticationInfo() to test protected endpoints without requiring actual login flows.
Test business logic independently of Serverpod infrastructure by injecting mock sessions or database connections. Separate unit tests (testing pure logic) from integration tests (testing with real database).
Organization: Place unit tests in test/unit and integration tests in test/integration, using test tags to run them separately during CI/CD pipelines.
Flutter-First Development: When building applications where Flutter is the primary or only client, Serverpod's Dart-to-Dart communication eliminates friction and maintains type safety across the entire stack.
Real-Time Applications: Games, chat systems, collaborative tools, or live dashboards benefit from Serverpod's built-in streaming capabilities and efficient WebSocket management.
Rapid Prototyping: The combination of code generation, type safety, and integrated development tools enables faster iteration than traditional backend frameworks.
Team Consistency: Teams already proficient in Dart can immediately contribute to backend code without learning new languages, frameworks, or paradigms.
Non-Dart Clients: While Serverpod can serve generic HTTP/WebSocket clients, the generated client libraries and type safety benefits are Dart-specific. Consider GraphQL or REST frameworks if supporting diverse client platforms.
Database Support: Serverpod currently supports only PostgreSQL. Applications requiring MySQL, MongoDB, or other databases need to use them through custom integrations without ORM benefits.
Ecosystem Maturity: Compared to established frameworks like Django, Rails, or Express, Serverpod has fewer third-party integrations, examples, and community resources, though the ecosystem is growing rapidly.
Serverpod represents a paradigm shift for Flutter developers, enabling true full-stack development with a single language and unified tooling. By leveraging Dart throughout your application stack, you can build faster, maintain easier, and deploy with confidence.