---
description: In this section we will install loopback and create a new backend.
---

# Install Loopback

#### Objective:

{% hint style="success" %}
&#x20;Learn about fundamental elements of a persistent storage system.
{% endhint %}

## **Loopback Backend Setup**

We are going to create our boilerplate (aka code that is included in many areas that don’t need much alternation. Aka template).

### **Step 1: Install Loopback**

* &#x20;If you haven't already **c**reated the final-project folder already, do so: **`mkdir final-project`**
* Change directory to final-project folder: **`cd final-project`**

#### **Important Note Moving Forward:**

{% hint style="warning" %}
We will be creating a **front-end folder** and a **back-end folder** inside of this new **final-project folder**.

**We need to make sure that we are not creating a back-end folder inside of the front-end folder**, **rather we need to create a back-end folder inside of the final-project folder.**
{% endhint %}

**Additionally:**

{% hint style="warning" %}
We will not be making new directory by running the following command:

**`$ mkdir <dir-name>`**&#x20;

Instead after we make sure we are in the **final-project folder** and we run the following commands  these folders will be created for us:

**`Creating front-end folder`**

&#x20;    **`$ ng new final-project-front`**

**`Creating a back-end folder`**&#x20;

&#x20;    **`$ lb`**
{% endhint %}

* &#x20;Check node version before install and ensure it is up to date.

| **`$ node -v`** |
| --------------- |

* Install loopback

{% embed url="https://gist.github.com/ssffacilitator/64b93b4e66f47f10cf2c52e3a974d393" %}

![](https://lh3.googleusercontent.com/dIn7xrPQ2EjrjZ2-ulieJPioirkg2joZVd-PlK06H0os2kwm76Yfknr5kNEyea9dpFzRhBPoWX8CHv_PwOh_fawwzOQsBUfM90ORpb7gyhpOKxOM53K8yHdADbWXhYI3WGIVm5vm)

It will give us some warnings but it is okay. This step is installing the loopback cli similar to angular cli. It will allow us to create a new loopback project.\


### **Step 2: Creating New Loopback Project**

* Inside `final-project` directory enter the following command in the terminal:

{% hint style="warning" %}
Make sure we are inside the **`final-project`** folder before running the following command
{% endhint %}

| **`$ lb`** |
| ---------- |

* **Name our application**

We will be asked to name our application.  **By default the name of the application is the folder name in the ( Final-Project ).**\
&#x20;We are going to use`Final-Project-BK`

* **Hit Enter**

![](https://lh5.googleusercontent.com/Rbcv5fWk3obqVEGVqHsO1SbTScMNjpY3xtLZMBCAO8bFqok_jCJCXypyhxFagIWw1-kLnW4_mDiHyNCdP9e9EREyliI75wijPqualEwOnPyRkaMHTf-qWNSp9XtZ96yPpTTGbV98)



* **Select version** of loopbac&#x6B;**:** We will select version 3.x

![](https://lh4.googleusercontent.com/55Pua_2kZWEp3NGI3rT_XFL4a6txxsWLkx3pXPoWerxueDzJWEQTDBP5akujxfvGoi6zdbreoUHwpfefHEoLw42fOwAWUtHS5QKKnkRT_7-ErYS254n2FXKc0waU6CwBE7huBBVP)



* **Select the type of loopback application we want:** Loopback has default settings for different types of projects. \
  We will be choosing: **api-server**. Press enter to select.

![](https://lh6.googleusercontent.com/UCTJ3iO294FXDvz3EWIfQqDCXlgAzMfUfmCYjhe0wgLcfLBOU-OXKGvl-QyjVYjYI8gEwm4MzgsxdwHhTXrIIrX7P3bEpGxP5LqNpT3RVXUi1aEwEcPNpHgS1xAzT0KU7ZwvwAcz)



* **Now let the install finish for your new project.** You will see the following:

![](https://lh5.googleusercontent.com/nVjnOvj7TamgPUetUbxZkFnWlYifJrdGV3wFRETP7xqO54UI9wfr6799gVyFoA77-npH3T7Ukg7YOSw9cDDT2A0I56RiczbURmRo0wzBgfBKBr9iiz0g-ZmthWVjRsWQfWEKxzLn)

A Successful install we will result in:

![](https://lh6.googleusercontent.com/KDuqnlDFgVtKQrGz7t16IsABuz-tl8zveGUApFoQL5m95BA8A08e8BadTca2xer3L4-vhQL7JSSpKo8-zILaJ-SB7Uht2JHpdp7LxxoOZRq0vnEO2rSK9Jh3i8mXlujRVZNDXni3)

**To start, type in the terminal from within the final-project-bk folder run the following terminal command.**

| **`$ node .`**  |
| --------------- |

**Result:**

![](https://lh4.googleusercontent.com/7ZbwfL9Cx6arLsz5UDDOGl7R8Opz7uE0z9riBRx-ncwbeLneuhgEPdB14FHRZe_9QdxRcomKX1cOFxdszOqfXKSyWnFV9lV8qZ6qqL2V_b_oPQqt0-FShbd92CdH4gWj-mcr7e7F)

This means the server is running. It needs to be running in order for our app to work. Keep the loopback app running in the terminal.

{% hint style="success" %}
Successfully installed Loopback and created a new project
{% endhint %}
