• Documentation
  • Pricing
© 2026 Serverless, Inc. All rights reserved.

Framework

  • Overview
  • Documentation
  • Plugins360
  • Pricing

Learn

  • Blog
  • GuidesUpdated
  • Examples240
  • Courses

Resources

  • Support
  • Security
  • Trust Center
  • Status

Community

  • Slack
  • GitHub47k
  • Forum
  • Meetups

Company

  • About
  • Careers
  • Contact
  • Partners

Legal

  • Terms of Service
  • Privacy Policy
  • Trademark
  • DMCA
Serverless Framework Logo

Serverless Framework

Intro
SetupUpgrading To V4ConceptsTutorialAWS CredentialsLicense Keys
DeployingPackagingBuildingTestingDev ModeServicesFunctions
OverviewHTTP (API Gateway v2)REST (API Gateway v1)ActiveMQApplication Load BalancerAlexa SkillAlexa Smart HomeCloudWatch EventCloudWatch LogCloudFrontCognito User PoolEventBridge EventIoTIoT Fleet ProvisioningKafkaKinesis & DynamoDBMSKRabbitMQS3ScheduleSNSSQSWebsocket
LayersManaged InstancesWeb Apps (Lambda Web Functions)Sandboxes (Lambda MicroVMs)MCP ServersAlertsVersion PruningDomainsIAM Function PermissionsParameters
OverviewSelf-reference serverless.ymlServerless CoreEnvironment VariablesCLI OptionsExternal YAML/JSON FilesJavascript propertiesGitDoppler
OverviewS3 ObjectsSSM Parameter Store & Secrets ManagerCloudFormation Stack Outputs
OverviewVaultTerraform State Output
ResourcesComposing ServicesDeployment BucketStateAgent SkillsPython support
OverviewRuntimeGatewayMemoryBrowserCode InterpreterDev Mode
API Gateway Proxy
OverviewGeneral ConfigurationAuthenticationAPI KeysData SourcesResolversPipeline FunctionsSubstitutionsCachingDelta SyncCustom DomainWAFCLI Commands
Deploying SAM/CFN TemplatesWorkflow Tips
OverviewCreating PluginsCLI OutputCustom CommandsCustom VariablesExtending the Configuration schemaExtending and overriding configuration
OverviewDashboardAxiom
Overviewagent docsagent inspectagent setupagent skills installagent skills list / readdeploydeploy functiondeploy listdevdiffinfoinvokeinvoke localloginlogin awslogin aws ssologsmetricspackageplugin installplugin uninstallprintprunereconcileremoverollbackrollback functionusage
OverviewConcepts
OverviewMetricsTracesTroubleshoot
OverviewNode.jsPython
OutputsProviders
OverviewBranch DeploymentsPreview DeploymentsCustom ScriptsTestingPrivate PackagesNotificationsMono ReposDeploy in your own CI/CDBest PracticesTroubleshootingFAQ
OverviewSetupToolsAWS Integration
Serverless.yml Reference
Examples and TutorialsConfiguration Validation
  1. Usage
  2. Plugins
  3. Overview

Plugins

A plugin is a JavaScript or TypeScript module that extends the Serverless Framework: it adds CLI commands, runs code at steps of commands such as deploy, defines variable sources, or adds keys to serverless.yml. Plugins apply per service: a service loads the plugins its serverless.yml lists under plugins.

To add a plugin from npm to the service in the current directory, run:

serverless plugin install -n custom-serverless-plugin

The command installs the package and lists it in serverless.yml:

# serverless.yml
service: my-service

provider:
  name: aws
  runtime: nodejs24.x

plugins:
  - custom-serverless-plugin

Browse community plugins in the Serverless Framework plugins directory.

Install a plugin from npm

serverless plugin install -n <name> works in a service directory, the directory with serverless.yml. It does two things:

  1. Runs npm install --save-dev <name>@latest in the service directory, which adds the package to devDependencies in package.json and installs it in node_modules.
  2. Adds <name> to the plugins list in serverless.yml.

To install a specific version, pass it after the name: serverless plugin install -n custom-serverless-plugin@1.2.3. When package.json lists serverless as a dependency, the command also adds an overrides entry so the plugin uses that serverless version.

To install a plugin without the command, install the package and add its name to plugins yourself:

npm install --save-dev custom-serverless-plugin

To remove a plugin, run serverless plugin uninstall -n custom-serverless-plugin. It runs npm uninstall --save-dev and removes the name from plugins.

Configure a plugin

Plugins read their settings from the custom section of serverless.yml, under a key the plugin's documentation names:

# serverless.yml
plugins:
  - custom-serverless-plugin

custom:
  customServerlessPlugin:
    enabled: true

Load a plugin from a local file

To use a plugin that lives in the service, for one project or while you develop it, list its path. The path starts with ./ and is relative to the service directory:

# serverless.yml
plugins:
  - ./plugins/my-plugin.mjs

The Framework resolves the path like Node.js require.resolve:

  • A .js file loads with or without the extension (./plugins/my-plugin).
  • A .mjs or .cjs file needs the extension in the path (./plugins/my-plugin.mjs).
  • A directory loads its package.json main file or its index.js.
  • A TypeScript file (.ts) loads without the extension (./plugins/my-plugin).

When the Framework can't find a listed plugin, the command stops with:

Serverless plugin "./plugins/my-plugin" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file. Use the --debug flag to learn more.

The Framework looks for an npm plugin the way Node.js does from the service directory (its node_modules, then the node_modules of parent directories), then in the Framework's own installation. Run npm install in the service directory after cloning it.

Plugin load order

The Framework loads its own plugins first, then the plugins in plugins: those tagged as build plugins first, then the rest in the order you list them. With this list, plugin-one loads before plugin-two:

# serverless.yml
plugins:
  - plugin-one
  - plugin-two

Hooks registered for the same lifecycle event run in load order, so a listed plugin's before:deploy:deploy hook runs after the Framework's own hook for that event. A plugin listed twice stops the command with Encountered duplicate plugin definition. Please remove duplicate plugins from your configuration.

Plugins included in the Framework

The Framework includes the features of some community plugins. Listing one of them in plugins prints a notice that you can remove the entry:

PluginWhat the Framework does when it's listed
serverless-python-requirementsLoads the installed community plugin instead of the included one
serverless-appsync-pluginLoads the installed community plugin instead of the included one
serverless-prune-pluginLoads the installed community plugin instead of the included one
serverless-plugin-aws-alertsUses the included version and ignores the entry
serverless-apigateway-service-proxyUses the included version and ignores the entry

The Framework also builds TypeScript and JavaScript with its own esbuild integration. Listing serverless-esbuild, serverless-webpack, serverless-plugin-typescript or serverless-bundle stops the command with a PLUGIN_TYPESCRIPT_CONFLICT error unless build.esbuild: false is set.

Write your own plugin

  • Create a plugin: the plugin class, lifecycle hooks, configuration and options
  • Custom commands: add serverless <command> commands with options
  • Custom variables: add ${source:...} variable sources
  • Custom configuration: validate the keys your plugin adds to serverless.yml
  • Extending and overriding configuration: change the service configuration from a plugin
  • CLI output: write logs, progress and text from a plugin
Edit this page
Prev Workflow TipsNextCreating Plugins

Contents

  • Plugins
  • Install a plugin from npm
  • Configure a plugin
  • Load a plugin from a local file
  • Plugin load order
  • Plugins included in the Framework
  • Write your own plugin

Related

GuidesPluginsExamplesSlack CommunitySupport