---
title: Use LocalStack to Build a Development Environment for a Serverless App
description: Increase development speed & take advantage of mock AWS services when you create local development environments for Serverless apps with LocalStack!
image: https://www.bitovi.com/hubfs/Use%20LocalStack%20to%20Build%20a%20Development%20Environment%20for%20a%20Serverless%20App-1.png
---

- ![AI implementation](https://www.bitovi.com/hubfs/AIConsultingIcon.svg)
  
  [AI implementation](https://www.bitovi.com/services/ai-consulting)
- ![Systems engineering](https://www.bitovi.com/hubfs/icon%20-%20backend.svg)
  
  [Systems engineering](https://www.bitovi.com/services/systems-engineering-consulting)
- ![Project Management](https://www.bitovi.com/hubfs/icon%20-%20PM.svg)
  
  [Project Management](https://www.bitovi.com/services/agile-project-management-consulting)
- ![Product Design](https://www.bitovi.com/hubfs/icon%20-%20design.svg)
  
  [Product Design](https://www.bitovi.com/services/product-design-consulting)
- ![Frontend development](https://www.bitovi.com/hubfs/icon%20-%20frontend.svg)
  
  [Frontend development](https://www.bitovi.com/services/frontend-development-consulting)
- [View more
  
  →
  
  ](https://www.bitovi.com/digital-consulting-services)

We're Experts in...

- [JavaScript](https://www.bitovi.com/services/frontend/javascript-consulting)
- [AI training](https://www.bitovi.com/ai-training-for-software-engineers)
- [Angular](https://www.bitovi.com/services/frontend/angular-consulting)
- [Design systems](https://www.bitovi.com/services/axure-figma-migration)
- [React](https://www.bitovi.com/services/frontend/react-consulting)
- [Temporal](https://www.bitovi.com/services/backend/temporal-consulting)
- [React Native](https://www.bitovi.com/services/frontend/react-consulting/react-native)
- [Node.js](https://www.bitovi.com/services/backend/nodejs-consulting)

Showcase

![Yum! Brands](https://www.bitovi.com/hubfs/yum-showcase-link-1.png)

[View case study](https://www.bitovi.com/en/bitovi-yum-case-study)

More Projects

- [![Levi's](https://www.bitovi.com/hubfs/levis.svg)](https://www.bitovi.com/web-application-consulting-work/levis-ecommerce-responsive-redesign)
- [![Christie's International Real Estate](https://www.bitovi.com/hubfs/christies.svg)](https://design.bitovi.com/christies)
- [![BAFS](https://www.bitovi.com/hubfs/bafs.svg)](https://www.bitovi.com/ux-design-consulting/ux-case-studies/bafs-ppp)
- [View more
  
  →
  
  ](https://www.bitovi.com/our-software-consulting-work)

Open Source Tools

We build powerful tools and open source them to support the community.

[See what we've built →](https://www.bitovi.com/open-source)

- [![Blog](https://www.bitovi.com/hubfs/icon%20-%20blog.svg)
  
  BlogWe post about delivering products and solving problems.
  
  ](https://www.bitovi.com/blog)
- [![Partnerships](https://www.bitovi.com/hubfs/Handshake-1.svg)
  
  PartnershipsLearn about Bitovi's technology partners
  
  ](https://www.bitovi.com/partnerships)
- [![Academy](https://www.bitovi.com/hubfs/icon%20-%20academy%20(4).svg)
  
  AcademyFree courses to build delivery skills
  
  ](https://www.bitovi.com/academy)
- [![Open source tools](https://www.bitovi.com/hubfs/icon%20-%20open%20source.svg)
  
  Open source toolsUse or contribute to our community
  
  ](https://www.bitovi.com/open-source)

Let's Connect

- [![Discord](https://www.bitovi.com/hubfs/DiscordLogo.svg)
  
  Discord
  
  ](https://discord.gg/J7ejFsZnJ4)
- [![LinkedIn](https://www.bitovi.com/hubfs/LinkedinLogo.svg)
  
  LinkedIn
  
  ](https://www.linkedin.com/company/bitovi/)
- [![GitHub](https://www.bitovi.com/hubfs/GithubLogo.svg)
  
  GitHub
  
  ](https://github.com/bitovi/)

![Eggbot](https://www.bitovi.com/hubfs/build_assets/bitovi-limbo-cms-react/338/js_client_assets/assets/eggbot-LTGhdSGL.png)

Name *

Work Email *

Phone

What's your project?

Send

### Contact Us

(312) 620-0386contact@bitovi.com

[ Backend ](https://www.bitovi.com/blog/topic/backend) |  November 11, 2022

# Use LocalStack to Build a Development Environment for a Serverless App

 Increase development speed & take advantage of mock AWS services when you create local development environments for Serverless apps with LocalStack!

![Austin Kurpuis](https://www.bitovi.com/hubfs/Austin%20Kurpuis%20headshot.png)

 Austin Kurpuis

Share:

[![Twitter](https://www.bitovi.com/hubfs/limbo-generated/_astro/twitter-white.os3xLc3C_Z2nW4or.svg) ](https://twitter.com/intent/tweet?text=) [![Reddit](https://www.bitovi.com/hubfs/limbo-generated/imgs/icons/reddit.png) ](http://reddit.com/submit?url=)

Local development environments allow you to speed up both development and the feedback cycle for your Serverless apps. The LocalStack plugin gives you the tools to build local development environments quickly, accessing mock AWS services without credentials.

In this article, we’re going to explore how you can leverage LocalStack to create a local development environment for a Serverless application.

### Prerequisites

In order to follow along with the example, you will need the following items installed:

- Docker
- Node.js + npm
- Serverless

## Getting Started

Start by generating a new Serverless application using the Serverless CLI and change directory into the newly created project folder.

```
serverless create --template aws-nodejs --path serverless-app-example
cd serverless-app-example
```

At this point, you have a basic Serverless application scaffolded with a `hello` function. Now you need to set up npm in the project.

Run `npm init` and follow the prompts to fill out the details in the `package.json` file.

Next, you’ll need to install the `serverless-localstack` plugin as a dev dependency. You can install the plugin by running `npm i -D serverless-localstack`.

Finally, configure the `serverless-localstack` plugin by adding the following lines to the `serverless.yml` file:

```
# Enable localstack plugin
plugins:
  - serverless-localstack
# Configure localstack plugin
custom:
  localstack:
    # Only use localstack for the local stage
    stages:
      - local
    # Setup a docker volume for localstack to run code from to improve performance
    lambda:
      mountCode: true
    # Startup localstack automatically
    autostart: true
```

While you’re in here, you might as well set up an HTTP endpoint for your handler. You can do so by updating the `hello` function in the `serverless.yml` file. It should look something like this:

```
functions:
  hello:
    handler: handler.hello
    events:
      - http: 'GET /hello'
```

## Developing

With all the setup complete, it’s time to get started developing! Run `serverless deploy --stage local`, which will automatically deploy your application to LocalStack and print out an endpoint URL that looks like something like `http://localhost:4566/restapis/ugpfwxng1p/local/_user_request_`. You can append the path of your function, `/hello` in this example, and use curl or your favorite HTTP client to hit the endpoint.

```
curl http://localhost:4566/restapis/ugpfwxng1p/local/_user_request_/hello
```

Since you configured the LocalStack plugin to mount your app code into the LocalStack container, changes to your function code will be reflected immediately, without the need to deploy the stack again or rebuild! Just make changes to the `handler.js` and hit the endpoint to see your changes take effect. Any changes to the `serverless.yml` will require running the deploy command again.

To make it even faster to start up the development environment, you can add an npm script to the `package.json`.

```
"scripts": {
  "start": "serverless deploy --stage local"
  },
```

Now you can start up the dev environment by running `npm start`.

## Conclusion

Congratulations, you now have a Serverless local development environment built with LocalStack. This will allow you to speed up the feedback cycle of development and build your application in an environment where you have access to mock AWS services, allowing you to write integration tests without the need to provision real AWS services or have AWS credentials configured.

 

 Previous Post

![Angular & Apollo Client: Getting Started with GraphQL in Angular](https://www.bitovi.com/hs-fs/hubfs/Angular%20%26%20Apollo%20Client-%20Getting%20Started%20with%20GraphQL%20in%20Angular.png?height=117&name=Angular%20&%20Apollo%20Client-%20Getting%20Started%20with%20GraphQL%20in%20Angular.png) [ Angular & Apollo Client: Getting Started with GraphQL in Angular ](https://www.bitovi.com/blog/angular-and-apollo-client-get-started-with-graphql-in-angluar)

  

 Next Post

![TypeScript 4.9 Features and Improvements](https://www.bitovi.com/hs-fs/hubfs/TypeScript%204.9%20Features%20and%20Improvements-1.png?height=117&name=TypeScript%204.9%20Features%20and%20Improvements-1.png) [ TypeScript 4.9 Features and Improvements ](https://www.bitovi.com/blog/typescript-4.9-features-and-improvements)

```json
{
  "@context" : "http://schema.org",
  "@type" : "Organization",
  "address" : {
    "@type" : "PostalAddress",
    "addressCountry" : "United States",
    "addressLocality" : "Libertyville",
    "addressRegion" : "IL",
    "postalCode" : "60048",
    "streetAddress" : "1134 Pine Tree Lane "
  },
  "alternateName" : "Bitovi",
  "areaServed" : {
    "@type" : "GeoCircle",
    "geoMidpoint" : {
      "@type" : "GeoCoordinates",
      "latitude" : "41.8781",
      "longitude" : "87.6298"
    },
    "geoRadius" : "5000 km"
  },
  "description" : "Bitovi is a UX, UI design and front-end JavaScript development consulting company",
  "email" : "contact@bitovi.com",
  "image" : "https://www.bitovi.com/hubfs/bitovi-logo-x2.png",
  "logo" : "https://www.bitovi.com/hubfs/bitovi-logo-23-1.svg",
  "mainEntityOfPage" : {
    "@id" : "https://www.bitovi.com/blog/use-localstack-to-build-development-environment-for-serverless-app",
    "@type" : "WebPage",
    "description" : "Increase development speed & take advantage of mock AWS services when you create local development environments for Serverless apps with LocalStack!"
  },
  "naics" : "541511",
  "name" : "Bitovi Web App Consulting",
  "sameAs" : [ "https://www.facebook.com/BitoviLLC/", "https://twitter.com/bitovi", "https://www.linkedin.com/company/bitovi" ],
  "telephone" : "312-620-0386",
  "url" : "http://bitovi.com"
}
```

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Austin Kurpuis"
  },
  "dateModified" : "October 5, 2023, 7:13:54 PM",
  "datePublished" : "2022-11-11 16:11:00",
  "description" : "Increase development speed & take advantage of mock AWS services when you create local development environments for Serverless apps with LocalStack!",
  "headline" : "Use LocalStack to Build a Development Environment for a Serverless App",
  "image" : {
    "@type" : "ImageObject",
    "url" : "https://www.bitovi.com/hubfs/Use%20LocalStack%20to%20Build%20a%20Development%20Environment%20for%20a%20Serverless%20App-1.png"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://www.bitovi.com/hubfs/bitovi-logo-23-1.svg"
    },
    "name" : "Bitovi"
  }
}
```