serverpod-modules

Package reusable Serverpod server, client, and Flutter code into modules.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Serverpod modules help you avoid duplicating server, client, and optional Flutter code across projects, while keeping generated APIs and model references consistent.

Core Features & Use Cases

  • Add reusable modules: Package server, client, and optionally Flutter code into versioned modules that plug into your Serverpod app.
  • Customize generation with nicknames: Configure config/generator.yaml to map long module names to convenient nicknames for cleaner model types.
  • Reference module types in models: Use module-qualified class references in model definitions to share entities safely across boundaries.
  • Create custom modules: Use the module template to generate server + client packages, with optional Flutter package scaffolding.

Quick Start

Add the module server package to your app’s pubspec.yaml, (optionally) declare generator nicknames in config/generator.yaml, then run dart pub get and serverpod generate.

Frequently Asked Questions about serverpod-modules

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

FAQPage Schema
How do I share Serverpod server and client code across multiple projects?

Serverpod modules package server, client, and optional Flutter code into versioned modules to share APIs across projects. You add the module server package to your `pubspec.yaml` and run generation to reuse code without duplicating logic.

How do I configure generator nicknames for Serverpod modules?

Generator nicknames are configured in `config/generator.yaml` to map long module names to convenient aliases. This yields cleaner model types when referencing shared entities across module boundaries.

What is the best way to reference shared model types between Serverpod apps?

The best way is using Serverpod modules with module-qualified class references in model definitions. This safely shares entities across boundaries by ensuring namespaces and references resolve correctly in both server and client code.

Do I need to run serverpod generate after adding a module package dependency?

Yes, you must run `dart pub get` followed by `serverpod generate` after adding module dependencies. This ensures module namespaces and references resolve correctly in server and client code.

Can I include Flutter code when creating a custom Serverpod module?

Yes, creating a custom Serverpod module can include optional Flutter package scaffolding. The module template generates server and client packages, with optional scaffolding for your Flutter UI code.

When should I avoid using Serverpod modules for code sharing?

You should not use Serverpod modules for code sharing when building a standalone app with no shared features or subsystems. Modules are designed for reusing server, client, and Flutter code across multiple projects.