# Let’s go serverless.. getting started

This is a post that shows how to install and configure serverless framework for google cloud platform.

## What do you mean serverless?..

For those of you who don’t know, serverless architecture is an architecture in which you get a dynamic allocation of machine resources and charged for the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity. So, if you have some highly scalable short tasks this should be perfect, but if you have some very frequent and long-running tasks, this type of architecture might not the best feat.

Serverless architecture doesn’t imply running application without an actual server-side, but won’t need to host or manage it by your self. Many people will also consider BaaS(Backend as a Service) a serverless solution, but we won’t talk about that here, instead, we are going to dive into FaaS(Function as a Service).

## What do I need?(requirements)

We will work with npm and Node.js. If you don’t know what it is, get familiar and to install here. I will use the Serverless framework here with Google Cloud Function as this is what I have at my disposal right now.(Although we do it here with Google Cloud, all this can be easily adapted to run on AWS, Azure or Bluemix) If you don’t have Google Cloud Account, you can get a free trial for a year here.

## The Serverless Framework

Although we can just use Google Cloud Functions directly, we will use here Serverless Framework for few reasons:

1. it abstracts out a lot of  hassle with building and deployment(also it will help us with our CI)
2. it adds  some convenient structure to the project

We will get to the former in next part but for now, let’s talk about the project structure. If you dealt with microservices architecture before, then you are familiar with the concept of service. If you unfamiliar, services is a separate application unit organized around capabilities, e.g., user interface front-end, recommendation, logistics, billing, etc. Ideally, it should be independent and easily replaceable. In Serverless Framework your functions are also organized in services. So if want to build our articles sharing system, we will need three services: users service, articles service, and sharing service.

npm install -g serverless


serverless create --template google-nodejs --path my-service


Install the dependencies by running npm instal from your my-service folder, deploy it to your cloud using serverless deploy command.