# Netlify

## Summary


Netlify is a platform for web developers to host their sites in the cloud without managing any servers in the back-end where application logic and database works. Updates to the Web applications can be automated by integrating any git based Version Control System supported by Netlify.

 It can have dynamic functionalities which change constantly. Netlify builds its own kind of file storage and management system to push updates both to Git providers and Netlify simultaneously getting connected to the repository.

Every update/changes made to the content is distributed across the servers spread over in the content delivery network (CDN) and pre-built as static pages with file optimization before being delivered to the users.  Visitors of a website in Netlify get the pre-loaded version of website from a geographically nearest server reducing the loading time.

## Discussion

### Why should I use Netlify?

Netlify is the first one to offer Jamstack architecture with modern tools. .The Term "Jamstack" was coined by Netlify's Co-founder Mathias Billman which means a development stack made up of JavaScript, APIs, and templated Markup. .Netlify boosts web developer productivity since it is serverless and eliminates the need for developers to manage servers, which Netlify performs automatically. It provides many interesting features even in it's free plan. Web development sector is constantly moving to decoupled environment provided by Netlify in which the frontend,database and backend works independent of each other helping developers to easily to scale, manage and increase the performance of their websites.


### What are some useful features of Netlify?

    + **Rollbacks**: Previous versions of a web project can be selected and reverted using the Rollback option. This can be helpful if the present deployment has any issues in it. Netlify uses the atomic deploy concept in which changes are never in an inconsistent state and file uploads made sure for completed for a successful deployment.
    + **Development in Local Machine**: A local development environment with all the netlify features can be created using Netlify Dev.
    + **Redirects API** : Powerful feature to configure redirects, rewrites etc from the distributed content delivery network (CDN) of netlify. It can be done using adding a `redirects` file to the root of site folder.
    + **Serverless functions** : Adding serverless function requires only a single line of code addition to the `netlify.toml` file. It is built and deployed along with the netlify site for running server-side code without a dedicated server
    + **Deploy Previews** : Changes made to the site can be previewed even before deployment. Netlify generates previews by default for all pull and merge requests in Github and Gitlab.
    + **Playground** : An application where users can test configuration rules before setting those in the Netlify site in realtime.

### What's the Netlify architecture?

Netlify sites are prebuilt and deployed on the Global Edge Network, a CDN. This helps speed up the website loading by placing copies of files in the servers geographically closer to the website visitors. Netlify users are not required to manage any web servers. This is possible with the introduction of a new architecture known as the Jamstack.  

    + **Frontend**: Netlify is a infrastructure provider of Jamstack which decouples frontend from the backend and database. Netlify's Jamstack application delivers a precompiled and optimized static frontend which is deployed globally to the Edge CDN. The Frontend uses Javascript and APIs to communicate with backend services.
    + **Backend** : Backend Services are built as Serverless functions and distributed as various microservices making the load less. Functions built on Netlify are deployed to AWS Lambda and made as an API endpoint. Credentials required for the frontend to connect with the backend services are stored securely.
    + **Database** :Netlify does not provide database services directly. Users of Netlify can utilise any backend provider they like, but preferred partners are: DataStax, Fauna, Nimbella, and StepZen.

### What's the Netlify Command Line Interface (CLI)?

Netlify CLI is used to configure and deploy a website straight from the Development Server on a local machine which can be shared with others to run a local build, plugins and deploy a site. Netlify CLI runs on top of Node JS. CLI was redesigned and introduced as Netlify Dev. There are many commands available in Netlify to work with the CLI version. 

All Features of Netlify is brought to local machine. Netlify's production routing engine is installed on a local development server, which makes all redirects, proxy rules, function routes, and add-on routes available locally and environment variables are set from the site environment. Live collaboration with multiple people is also possible with the CLI version of Netlify by running netlify dev `--live` command. 


### What's static routing in Netlify?

Static Routing helps to manage the traffic on a Netlify site. There are many powerful static routing features like redirects, rewrites, proxies which can be enabled using `redirects` file or in `netlify.toml` file. Edge Nodes in the Netlify CDN analyzes the rules written in these files and points the website visitors to various different paths or routes accordingly. Paths can be based on certain conditions like language or the location of the website visitor. Proxies written in the file can redirect the incoming request to another website or can execute a serverless function. 

Custom HTTP headers can also be sent as a response to the site requests. They can be managed in `headers` file or in the `netlify.toml` configuration file.


### What are edge handlers in Netlify?

Edge handlers allow us to do programmable routing by giving a personalized experience to the website visitors. It is a redeveloped version of Netlify's Edge Network built with multiple cloud providers to handle complex tasks and reduce workload for developers. 

It can alter both incoming and outgoing traffic also it has capabilities far beyond static routing as it can filter and manipulate HTTP requests and responses.

It can intercept incoming HTTP requests and change the route of traffic depending on the request. Also,it has lower latency than Netlify functions useful for making quick routing decisions to provide features such as Localized content or personalized ads.

During deployment of the website Netlify's bot checks for the netlify/edge-handlers directory in the base directory of the repository. 

Edge handlers are configured as two files in a repository. 

    + Handler file: It is written in Javascript. Handlers should export a function named onRequest which receives a Javascript event object containing the information about the handler request.
    + Handler declaration: This is declared in In netlify.toml file by adding `[[edge_handlers]]` with the path and handler to execute the requests coming in that path.

### What are Netlify functions used for?

Netlify functions are used to perform complicated javascript functions that would be impossible to do by running javascript on the client side. The Functions tab in the web interface provides access to functions. Bundlers are used to optimise functions in order to make them smaller and faster. 

Functions are written as scripts that can be deployed on netlify directly. It is hidden from public view and works as API endpoints.updates to the function on a production branch will not affect the version deployed under a branch or in a deploy preview as it is immutable.

Fetching live data from an API, pulling dynamic graphics, sending an automatic email, and validating an input submitted by a user in the field are a few examples of Netlify functions.


### What are Netlify's background functions?

Traditional Functions are synchronous by default with an execution time of 10seconds which makes it difficult to manage long running process but it can be made Asynchronous by adding `--background` to the end of the filename with runtime longer than 10 seconds and up to 15minutes with a default memory of 1024mb. For tasks such as Batch processing, web scraping etc...which need the API to execute longer asynchronous Background functions are helpful. 


### Is Netlify good for SEO?

SEO is a secondary priority for JamStack Technology since, while it is constantly growing, it is not particularly SEO friendly. By, taking care of a few things SEO can be improved, as indicated by Netlify. 

Making Sitemaps and Maintaining a Clean URL Structure: The click through rate (CTR) and average time spent on the page have an impact on search engine ranking, which leads to a higher search engine ranking and a better user experience. Site maps are important to get higher presence in search engines by crawling pages available in a website. Also the structure of URL plays a key role in users clicking the link. Static URL is more preferred and SEO friendly.

Optimizing Assets: Netlify by default has Asset Optimization which bundles and compresses the HTML, CSS,JS files used in the project.

## Milestones

Oct  
2013

Mathias Billmann launches Bit Ballon for hosting HTML5 static website and apps with easy drag and drop feature under Makerloop Inc. 

Apr  
2015

Mathias Billmann and Christian Bach launches it as Netlify.com under the company Makerloop Inc. to host static sites and Apps with continuous deployment workflow with github support. Netlify will run the build command and deploy whenever an update is pushed to github. .

Oct  
2015

Smarter Redirects is introduced to avoid a chain of redirects. A single efficient rule for redirect is implemented. 

Jan  
2016

Netlify starts to offer Free SSL Certificate with automatic renewal and provisioning feature to the users in a single click in collaboration with Let's Encrypt. A new system is developed by netlify for transferring SSL certificates and associated keys over a secure encrypted connections to avoid storing sensitive keys on Netlify's CDN edge nodes. 

Jul  
2016

**Gitlab integration is added to deploy repositories in Netlify due to the increasing popularity and requests from users**. . Deploy previews help users to see changes in Production environment without actually deploying it.  

Mar  
2017

New system design is implemented. Changes made to the user interface and new header 'Hero Card' is designed. It is the first element for most of the pages showing a quick summary of page giving access to commonly used actions and information. 

Jun  
2017

Two New Features were introduced based on Edge Logic Requests (ELRs) in which the Netlify's CDN will handle requests that are normally done through server or client-side in Javascript to overcome traditional way of static files getting served from CDN. Branch Based Split testing feature is introduced where pull requests are deployed into a unique subdomain to see the changes even before merging. JSON Web tokens is introduced for assigning authentication and user management to any other services that can generate JSON Web Tokens to allow granular role-based permissions.  

Dec  
2017

Makerloop Inc under the brand which Netlify was running is renamed to Netlify Inc. 

Mar  
2018

**Netlify functions is launched making the deployment of serverless AWS Lambda functions easy as adding a file to a git repository**. Server side code will work as API endpoints without having to run it on dedicated server. Netlify Identity a JSON web token based user authentication feature with Netlify Forms which helps users to get all HTML form submissions in their Netlify dashboard is launched. 

Aug  
2018

Netlify drop is introduced to replace bitballon a drag and drop depolyment for hosting static sites written in HTML, CSS, and JS. Netlify hosts the site and gives us the link to access it. 

Feb  
2019

Netlify large media is launched, a service built on the top of Git LFS to remove heavy binary files from the repository. .Git LFS is an extension of Git which uses pointers on the repository to point the assets stored in a remote server. Using Netlify large media size of the repositories can be reduced and site build times can be increased. 

May  
2020

Netlify build plugins is introduced to make the development process easier by automating build tasks and customizing build process. It also has one click install to cache files, checking broken links and trigger tests etc. 

Jul  
2021

Four new database partners DataStax, Fauna, Nimbella, and StepZen is added to provide serverless database to the users. Integration with these services can help developers run their backend services more easier and faster.