Skip to content

feat(cli): Add serverpod run command to execute scripts from pubspec.yaml #4402

Closed

Description

@SandPod

Problem to Solve

Currently, there is no convenient built-in way to execute project-specific scripts directly through the serverpod CLI. This limits automation and makes it harder to run workflows like starting a Flutter client or executing custom operations defined in a project's configuration.

Proposal

Introduce a new serverpod run <script> command in the serverpod CLI. This command will look for a serverpod_scripts section in the project's pubspec.yaml and execute the corresponding script value. For example:

serverpod_scripts:
  start: dart bin/main.dart --apply-migrations

Running serverpod run start would execute the specified command. This enables teams to easily integrate and automate cross-tool behaviors within their workflow, managed through pubspec.yaml.

Use Case

A developer can add frequently-used scripts to the pubspec.yaml and trigger them via serverpod run <script>. For example, starting the frontend and backend simultaneously for development, database migrations, or custom checks—without manually hunting for the correct shell command.

Alternatives

  • Manually running scripts from the terminal, which reduces consistency and automation
  • Using other CLI wrappers, but these do not integrate with Serverpod's workflow
  • Custom bash scripts, which are less discoverable and not linked to Serverpod's project structure

Additional context

This will enhance developer experience and enable complex integration scenarios involving Flutter, backend, and third-party tools—while keeping workflow management in a single configuration file

How experienced are you with this library?

Expert - Experienced and comfortable with using this library in complex projects

Are you interested in working on a PR for this?

  • I want to work on this

Activity

  1. added theissue type on Dec 10, 2025
  2. added
    enhancement
    area: cli
    on Dec 10, 2025
  3. removed theissue type on Dec 10, 2025
  4. moved this from Inbox 📫 to Next Up 🎯 in Serverpod Frameworkson Dec 10, 2025
  5. nielsenko commented on Dec 12, 2025

    @nielsenko
    Collaborator

    We will use serverpod/scripts instead. Allowing for future expansion.

    Example:

    name: test_server
    environment:
      sdk: ^3.0.0
    dependencies:
      serverpod: any
    
    serverpod:
      scripts:
        hello: echo "Hello from script"
        fail: exit 42
        start: dart bin/main.dart
        test: dart test
        trap: trap "echo SIGINT; exit 0" INT; while :; do sleep 0.1; done
  6. moved this from Next Up 🎯 to Done 🚀 in Serverpod Frameworkson Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: clienhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions