In December 2018, the accumulated users of Tencent album exceeded 100 million, with 12 million monthly users, ranking Top 30 in Aladdin Index, and becoming a heavyweight player of mini program ecology.

Over the past three months, Tencent Album has quickly optimized and added a series of social functions around the core scene of “sharing album photos on wechat”. With proper operation, the total number of users has exceeded 100 million, much more than expected.

(Tencent photo album has more than 100 million users)

Backstage manpower shortage, how to do?

When I first met David (not his real name), the developer of Tencent’s album mini program, he was worried.

“The goal by the end of the year is to reach tens of millions of users, but right now there are only a few front-end and back-end developers. What’s more, our backstage development is not 100% able to be invested in this project, and most of the time has to be withdrawn to support other projects, so human resources are very scarce. In addition, the original background system has a lot of historical burden, it is not realistic to do new social function development on the original architecture. How to do?

“Don’t try ‘small program · cloud development’, only need the front end can make small program, just solve the problem that we lack background.”

Therefore, David, as the backbone of the front-end development team of Tencent photo album, took on the responsibility of realizing the social function of Tencent photo album mini program by using mini program · cloud development.

“When I first came into contact with ‘applets · cloud development’, I thought the concept of this thing (applets · cloud development) was quite new — applets without service development model. In the general small program development, there are three functions of small program can not bypass the help of the background, it is the door respectively data reading, file management and sensitive logic processing (such as permissions). Therefore, the traditional development mode, in the small program side must send requests to the background for authentication, and processing related files or data. Even if you use Node to build back-end services, you need to spend a lot of infrastructure and later operation and maintenance work.”

“While small procedures, cloud development released a small developers, gives developers, upload file read data security, stability and the ability to control permissions, other load, disaster, monitoring and so on, we only need to focus on business logic, small developers focus to write business logic can, other things can completely don’t have to worry about! Originally I was still at a loss, after understanding the product principle of ‘small program · cloud development’, I instantly had a spectrum.”

I can’t scan the QR code

The road is always not smooth, in Tencent photo album small program leading to users break 100 million on the road, numerous difficulties.

Because Tencent’s QR code needs to bring too much information, so its QR code appears dense. The dense QR code on some Android devices can cause problems with small programs.

This seriously restricted Tencent album small program to share the ability to get visitors.

(Need to store name, ownerID, page, etc.)

This thing is not difficult to solve, as long as the background development of the data stored in the database, and then put the data ID on the sharing link, so that the link can be converted into 32 character short links, so that the TWO-DIMENSIONAL code looks not so dense.

However, due to the lack of manpower in the background, David, the front-end developer, made use of the database storage capacity developed by small programs · cloud to quickly realize data storage in the database by calling the interface db.collection(‘ QR ‘).add.

(Cloud development database, similar to MongoDB format)

(Cloud development database index, which can speed up data reading)

In addition, Tencent album also takes advantage of the cloud function capability developed by small program · cloud to generate more recognizable small program code (small program code document) for spreading and sharing in the circle of friends.

(Cloud function logic to generate small program code)

(Optimized sharing picture and small program code)

2 Skyline comments like function

(Comments and likes)

The core application scenario of Tencent photo album in wechat terminal is “sharing photo album in wechat”. In order to enhance the interaction of Tencent photo album users in wechat, improve user stickness and retention, Tencent photo album decided to add the function of comment and like, and the chat comment is directly realized in the wechat chat window.

Here, David of Tencent Photo Album is faced with two choices. One is to do this function according to the original development mode (foreground development – background development – front and background combination). The problem is long development cycle, lack of background and slow iteration speed. The other is to roll up your sleeves and take advantage of the power of cloud development.

In order to speed up product iteration, David decided to adopt cloud development. Comments, likes Database insertion and query interfaces developed through the cloud, such as db.collection(‘comment’).add, were soon implemented.

However, the tricky problem is that for some sensitive operations such as deleting and editing comments, like sensitive operations, also need to go to the user’s authentication operation, and these authentication information, are in the original background. At this point, the routing function of the cloud function comes into play.

(Comment like logic)

When a user makes a comment and likes, it will initiate a request in the small program side to call the cloud function and bring OpenID. The cloud function will use OpenID to query the original background service and see whether the user has the permission to operate. If the user has the permission, the data of comments and likes will be written into the database developed by the cloud.

In this way, by virtue of the ability of small program · cloud development, Tencent Album only took 2 days to complete the development work that needed more than a week under the traditional development mode.

Original development mode Cloud development full stack development
The workload Background 1 week (wechat login status verification + business logic Server development)+ front and background joint adjustment 1 day 1-2 days, no need for joint investigation

What is applets · cloud development?

Small program · Cloud development is a new Cloud development service developed by Tencent Cloud development Tencent Cloud Base (REFERRED to as TCB). The birth of this Cloud development service promoted by Tencent Cloud and wechat is timely to help Tencent album get out of the bottleneck of development efficiency.

(Cloud development based on Tencent Cloud)

Small Program cloud currently provides three basic capabilities:

  • Cloud function: As the role of the background, developers can use Node (will support PHP, Python, etc.) to write the background logic, natural authentication with wechat private protocol, can directly obtain appID, OpenID, UnionID and other important authentication information in the cloud function. Greatly simplified the small program background development workload.

  • Database: A document database that can be operated in front of applets or read and write in cloud functions, providing console visual management

  • File storage: you can upload/download cloud files directly in the front end of the small program and in the cloud function, providing visual management of the console

    If you are a newly developed applet, the architecture is very lightweight and simple, as shown below.

    If you are an existing small program, some of which need to interact with the original background, you can completely use the cloud function as a route to save the logic of obtaining user information such as OpenID, as shown below:

The relevant data

  1. Small program · Cloud development solutions
  2. Applets · Cloud development documentation