npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

serverless-build-client

v2.5.0

Published

A Serverless Framework plugin used to build front end applications

Readme

Serverless Build Client

npm CircleCI GitHub license Coverage Status

A Serverless Framework plugin for building the frontend with environment variables defined in serverless.yml

Introduction

Plugins such as serverless-finch make it easy to host static websites in S3. These websites usually need to be built before being uploaded. Without this plugin, environment variables defined in serverless.yml will not be included in the build.

Table of Contents

Installation

First, install the package to your dev dependencies

$ yarn add --dev serverless-build-client

Then add the plugin to your serverless.yml file

...

plugins:
  - serverless-build-client

...

Usage

In your command prompt, run the following command to build the client

serverless client build

This will add all of the environment variables in your serverless.yml file to process.env, and then it will execute yarn build to build the frontend

Options

--packager, -p

The packager that should be used to build the client. Valid options are yarn and npm. Default value is yarn

Example
$ serverless client build --packager yarn

--command, -c

The command that will build the client. Default value is build for yarn and run build for npm

Examples
$ serverless client build --packager yarn --command build
$ serverless client build --packager npm --command "run build"

--cwd, -d

The directory that will be used to run the packager. Default value is the current folder. This option is intended for use when the client package.json is in a subfolder or alternate folder.

Example
$ serverless client build --packager npm --command "run build" --cwd client

--verbose, -v

Flag that determines if we should print the environment variables to the console. Default value is false

Example
$ serverless client build --verbose

Configuration

Options

The above options may also be configured using custom configuration options in your servless.yml file

...

custom:
  buildClient:
    packager: npm
    command: run build
    cwd: client
    verbose: true

Environment variables

Environment variables may be set for the entire provider:

provider:
  environment:
    REACT_APP_BACKEND_ENDPOINT: ${cf:<backend service name>.ServiceEndpoint}

Or they may be set specificly for this plugin:

custom:
  buildClient:
    environment:
      REACT_APP_BACKEND_ENDPOINT: ${cf:<backend service name>.ServiceEndpoint}

The plugin will apply both provider environment variables and specific plugin environment variables. In the case of a conflict, the specific plugin environment variable will override the provider environment variable.

Example

Let's say you have two separate Serverless Framework projects: one for the frontend, and one for the backend. When you deploy the backend service, a ServiceEndpoint is automatically outputted in the CloudFormation stack.

In order to avoid hardcoding this value, the frontend should reference an environment variable containing the endpoint. In your frontend's serverless.yml file, you would have something similar to

...

provider:
  ...
  environment:
    REACT_APP_BACKEND_ENDPOINT: ${cf:<backend service name>.ServiceEndpoint}

...

or

...

custom:
  buildClient:
    environment:
      REACT_APP_BACKEND_ENDPOINT: ${cf:<backend service name>.ServiceEndpoint}

...

To deploy your front end, you need to run a series of commands (in this example, I am using serverless-finch)

$ serverless deploy
$ serverless client build
$ serverless client deploy --no-confirm

These commands will first deploy your application to AWS. Then it will build the front end with the environment variable defined above. Then it will upload the built website to S3.