Starting at zero yuan, how to run the application for free?

The full text has a total of 2058 words and the estimated length of study is 6 minutes

 

Source: Pexels

 

What is the experience of using a free infrastructure stack? Xiaoxin couldn't help feeling a little curious.

 

The free infrastructure stack is undoubtedly very beneficial for personal hobby projects or start-up businesses. So, how to build it?

 

This article will share services and technologies that keep infrastructure costs to a minimum.

 

As an example application, Xiaoxin came up with an easy-to-operate platform that required a static website, some server-side business logic, and a database.

 

Of course, this stack is not always completely free. If the usage increases, the cost will increase. The key is whether you can assemble a stack almost free of charge at the beginning.

 

 

Web hosting

 

There are several good options when considering using web hosting.

 

Xiaoxin's favorite is Zeit and Netlify. Their functions are very similar: continuous deployment, about 100GB of bandwidth per month, and a built-in CDN (Content Delivery Network). Another benefit is that they all provide serverless function options (see the next section for details). It reduces the number of services required for integration of the entire stack.

 

Static website generators like Gatsby are great for vendors. It can also be adapted to a headless CMS (content management system). In this way, people who do not understand the technical operation can also edit the website.

 

 

rear end

 

Source: Pexels

 

To keep most business logic away from the front end, a back end is needed. The backend usage scenario is to verify or register new users.

 

Since the goal is to keep hosting costs to a minimum, hosting traditional back-end services is not feasible.

 

The solution is to use serverless functions. This means that it will not completely occupy the server, but will only use the server capacity when the function needs to run. An example function can provide a login endpoint to check whether the user has entered the correct credentials. Most vendors have royalty-free layers when using these functions.

 

Here are the functions that provide the above functions:

 

Netlify function

 

Netlify provides a wide range of free layers. At this free tier, there can be up to 125,000 requests and 100 hours of runtime each month.

 

When using Netlify as the website host, it has excellent integration. These functions can be placed in the root project and selected by Netlify.

 

Zeit function

 

Zeit also provides serverless functions. In the free tier, when using 1GB of memory, there is no limit to the number of requests, but the monthly running time is 100 hours.

 

Zeit has additional restrictions on execution time. The function can only run for 10 seconds.

 

For most use cases, this should be sufficient, but it also needs to be considered.

 

AWS (Amazon Web Services) functions

 

Amazon contains the most royalty-free level of all suppliers. It allows one million free requests per month.

 

It should be noted that a credit card is required to sign up for AWS. Other vendors or services in this article are not required.

 

 

database

 

The platform needs to store data. For example, dealing with user management.

 

There are not many hosted databases with free tiers, they are all NoSQL (non-relational databases). The following are the most interesting hosting databases that Xiaoxin finds.

 

FaunaDB

 

This is an interesting new database player. As seen on the website, it marks itself as a "relational NoSQL database" with a fairly extensive free tier:

 

· 5GB storage space

· 3M reading operation per month

· 1.5 million write operations per month

· 1.5 GB of data transfer per month

 

FaunaDB provides a GraphQL API to interact with the database. In addition, it is worth mentioning that it enables easy integration with Netlify and Zeit.

 

MongoDB Atlas cloud database

 

MongoDB's official hosting platform has a free tier. At this level, users will get 512MB of instances. Note that this example is not available in every region, so you must check whether it is available in the region.

 

Firebase

 

Firebase is Google's real-time database. The free layer is very similar to FaunaDB:

 

· 5GB storage per month

· 10GB download limit per month

 

Source: Pexels

 

 

CMS (Content Management System)

 

For the platform solution, people hope that CMS will bring convenient experience of creating, editing and managing web page information.

 

The headless CMS can be well integrated into the existing stack. According to Xiaoxin, there are several free options.

 

Sanity.io

 

It is a flexible CMS in which the data model is defined in code. The interface for interacting with data is also customizable. It has very wide restrictions on the free layer:

 

· 10K API requests per month

· 10GB broadband

· 2 data sets

· 3 users

 

Prismic

 

Prismic is similar to Sanity.io, but there is one difference in the free layer:

 

· Only one user

· "Fair use" usage policy

 

The problem is Prismic's understanding of fair use, but if the user is just starting to use it, it should be able to meet the demand.

 

 

Overview

 

Simplified architecture overview

 

How do these parts fit together? The above picture is a simplified architecture overview of different technologies and vendors.

 

· The static site generator will extract data for its public pages from the content management system.

 

· The static site generator can also call serverless functions for business logic, such as user authentication.

 

· Only serverless functions can access the database. In this way, there is no need to save the credentials in the static site generator.

 

Source: Pexels

 

I hope this article can help you "create a near-free architecture stack".

 

Starting at zero yuan, the project will continue as usual ~

 

Leave a comment

Let's share the dry goods of AI learning and development together.
Welcome to the full platform AI vertical self-media "reading core technique"

(Add editor WeChat: dxsxbb, join the reader circle and discuss the newest artificial intelligence technology together ~)

1031 original articles published · Like 3012 · Visits 680,000+

Guess you like

Origin blog.csdn.net/duxinshuxiaobian/article/details/105607681