Working with MEAN

Lando offers a configurable recipe for spinning up apps that use the MEAN stack, a common set of infrastructure designed to run NodeJS applications.

Let's go over some basic usage.

Getting Started

Before you get started with this recipe we assume that you have:

  1. Installed Lando
  2. Read up on how to get a .lando.yml

If after reading #2 above you are still unclear how to get started then try this

# Go into a local folder with your site or app codebase
# You can get this via git clone or from an archive
cd /path/to/my/codebase

# Initialize a basic .lando.yml file for my recipe with sane defaults
lando init

# Commit the .lando.yml to your git repo (Optional but recommended)
git add -A
git commit -m "Adding Lando configuration file for easy and fun local development!"
git push

For more info on how lando init works check out this.

Starting Your Site

Once you've completed the above you should be able to start your MEAN site.

# Install dependencies your app needs to run
lando npm install || lando yarn install

# Start up app
lando start

If you visit any of the green-listed URLS that show up afterwards you should be presented with whatever content is loaded by the main script in your package.json.


Each MEAN recipe will also ship with some helpful node dev utilities. This means you can use things like node and npm via Lando and avoid mucking up your actual computer trying to manage node versions and global npm tooling.

If you are interested in installing other helpful global node commands like bower or gulp we recommend you read our Setting up front end tooling guide.

lando mongo                    Drop into the mongo shell
lando node                     Run node commands
lando npm                      Run npm commands
lando yarn                     Run yarn commands
# Drop into a mongo shell
lando mongo

# Install the redis module
lando npm install redis --save

# Install wahts in my package.json with yarn
lando yarn install

# Run a node command
lando node -e "console.log('hi');"

You can also run lando from inside your app directory for a complete list of commands.



You can also manually configure the .lando.yml file to switch node or mongo versions, set a custom command besides npm start to run when you start your app or to use a custom mongo config file.

# MEAN recipe example
name: mean

# Start with the default MEAN recipe
recipe: mean

# Configure the MEAN recipe

  # Specify the command you want to run to start up your node appserver
  # If unspecified this will run `npm start`
  command: npm start

  # Optionally specify the node version to use.
  # If ommitted this will default to the node LTS 6.10. Consult the `node`
  # service to see what versions are available
  # NOTE: that this needs to be wrapped in quotes so that it is a string
  node: '8.0'

  # Optionally specify the node version to use.
  # If ommitted this will default to the mongo LTS 3.4. Consult the `mongo`
  # service to see what versions are available
  # NOTE: that this needs to be wrapped in quotes so that it is a string
  mongo: '3.2'

  # Optionally specify global dependencies you need a la gulp-cli.
  # NOTE: you will need to make sure you add tooling routes for these if applicable
    gulp-cli: "latest"

  # Optionally mix in our own config files
  # If ommitted this will use the default config files for the respective services.
  # Definitely consult the relevant documentaion for each service to make sure
  # you are specifying the correct value for the config.
  # conf:
  #   database: mongo.yml

    service: appserver

You will need to rebuild your app with lando rebuild to apply the changes to this file. You can check out the full code for this example over here.

Environment Variables

The below are in addition to the default variables that we inject into every container.

# The below is a specific example to ILLUSTRATE the KINDS of things provided by this variable
# The content of your variable may differ

NOTE: These can vary based on the choices you make in your recipe config. NOTE: See this tutorial for more information on how to properly use $LANDO_INFO.


You can take advantage of Lando's events framework to automate common tasks. Here are some useful examples you can drop in your .lando.yml to make your MEAN app super slick.


  # Runs yarn install after you start your app
    - appserver: cd $LANDO_MOUNT && yarn install

Advanced Service Usage

You can get more in-depth information about the services this recipe provides by running lando info.

Read More

Workflow Docs

Advanced Usage

results matching ""

    No results matching ""