preface

Node.js is a very new development tool. Although it has been around since 2009, it is the fastest growing development tool of all time. In just a few years, we have seen the rapid development of Node.js from nothing at the beginning to today, which shows that the demand scene behind this is huge.

Didi NodeX FT is jointly built by three front-end teams, namely Pratt & Whitney, Finance and Auto service, and is committed to creating a group-level professional, efficient and stable Node r&d system within Didi. Help developers to lower the threshold of service construction, improve the barrier and fast closed-loop enabling business. At present, ecology has covered most of the business of the Group.

background

As early as a few years ago, PrU & Hui Pan-front-end and Financial pan-front-end tried to explore the practice and landing of Node.js within the group, actively pushed the traditional front-end to the big front-end field, and tested themselves and the quality of Node.js in the production environment. Node.js plays an important role in every team, and has a large number of components and related ecosystems combined with the group’s scenarios.

In order to enable our historical experience to create greater value in the group and improve the Ecosystem of Didi Node, we set up NodeX cross-team FT to create a group-level professional, efficient and stable Node research and development system. Fortunately, in the middle of this year, the car clothing pan-front-end also joined us, I believe that under the construction of our three pan-front-end teams, we will be able to cast a perfect and sound ecology.

What is a NodeX

Maybe some students still don’t know what NodeX ecology is. Next, I will introduce our ecosystem to you. If you have any questions or want to exchange ideas, please feel free to comment or contact the author through the contact information at the bottom.

See NodeX in a picture

The diagram above gives a brief overview of what NodeX is doing and its vision. We provide component frameworks, r&d support platforms, and common service capabilities within the ecosystem, as well as didi Node guides to assist development throughout the development cycle. The goal is to enable our developers to develop Node services with lower barriers, lower costs, and higher efficiency, ultimately improving barriers and closed-loop capabilities, enabling businesses quickly and efficiently. As shown in the chart below, developers are mostly concerned with business code development.

What should I do if I still don’t have a clear understanding of NodeX after understanding the macro level thinking? Take a look at the architecture diagram below, which contains the capability points and components of each core.

Global architecture diagram

It can be seen from the above architecture diagram that we are mainly composed of several parts, namely the component framework mentioned above, research and development support platform, universal service and documentation system throughout the whole research and development cycle. Each module is complementary to each other. We will introduce each core module one by one.

component

NodeX Components provides common node.js basic component modules, and these common Components are connected with various services of the group, reducing a lot of unnecessary repetitive work at the bottom level. High-quality components often need to go through a lot of historical experience precipitation, as well as the test of flow. Components in The NodeX Component have been through the whip of a real production environment, with a history of rollovers and accidents. Most of our component solutions have been online for two or even three years, with constant potholes and maintenance to build the current stability, while we continue to optimize and iterate on the stability of existing components and expand new capabilities. At present, more than 20 components have been covered in most scenarios. For details, you can see the following figure:

Lerna is used to uniformly manage the development, single test, release life cycle of each component. At the same time, there are strict specifications for submitted code, which is managed by Commitizen and code format is verified by Eslint+Prettier, so if you are interested, you can learn about related capabilities.

The framework

On top of that, we encapsulated an enterprise-level framework for the Didi ecosystem, thanks to Egg’s flexible Lorder mechanism. The framework integrates common development plug-ins and middleware, gets through the group infrastructure and Node infrastructure, and supports the application framework for the development of personalized configuration of service group deployment environment. Easy to use, rapid deployment, robust, ecological and other features, is the best choice for building enterprise applications. It is supported by slS-CLI scaffolding that we provide, which can initialize standard projects with one click. In the project, compilation and construction scripts that conform to group specifications are provided, and offline and online environments can be deployed without changing any code, and basic code specification configurations are integrated. Developers can focus more on business development without having to worry about more basic and underlying issues. They can also modify basic configurations and capabilities if needed, greatly reducing the barriers to building services. The specific architecture can be seen in the following figure:

Research and development support

In addition to providing the basic component framework to help developers quickly build services, we also provide a series of tools and platforms for r&d support, scaffolding has been described above, the following two more commonly used.

Performance analysis platform

For most developers, JS Runtime is in a black box state, so developers can’t perceive its running state, and there is no good toolchain for further support when some performance or memory problems occur. Therefore, we set up the performance analysis platform to solve this problem, to help people solve Node performance problems more conveniently, improve service performance bottlenecks, and provide process-level alarm monitoring capabilities to predict problems in advance.

We can start by looking at the performance platform’s business architecture diagram to understand its basic capabilities:

From business architecture diagram on the inside as you can see, the main performance platform provides a process level fine-grained file collection and analysis of monitoring, alarm and performance ability, can help developers real-time monitoring process performance, timely finding and early warning, allows developers to pre-processing performance issues, and have a very good question of gripper point.

The performance platform has gone through three versions within our group: the first version is the acquisition and monitoring version based on PM2 and V8 profiles, and the platform only supports flame map analysis; Since the PM2 version is too limited to support various Node projects, we reconstructed the V1 version this year, and changed the bottom layer to XProfile (based on V8 capability, a C++ addon) to collect data, so that we can support PM2, egg-cluster and other process management projects. Any version based on Node8 or above is compatible.

At present, it is the third edition, based on the version of community EZM construction, from the good work of A Kingami (XProfile is also from his hand), and the following will mainly be through the depth of building feedback to the community and customized ability to improve the way of duplex iteration.

Markdown documentation platform

At the beginning, the document platform was born to solve the complex document architecture of NodeX system, and was generalized in the construction process. In order to solve the problems of difficult document deployment and synchronization for more teams, improve the efficiency of document construction, reduce the communication cost between teams, and at the same time, it can become a good habit of depositing documents.

The document platform provides online real-time preview saving and local editing markdown capabilities, one-click online synchronization without compilation, and supports rich document configuration capabilities, which can meet both lightweight document editing and publishing capabilities and complex mixed document capabilities. The overall document publishing flow chart is as follows:

The overall real-time rendering capability is based on the open source docsify capability. Based on it, we have made authentication, style upgrade, burying point and other capabilities. The specific document viewing process is as follows:

The universal service

Besides basic abilities, we in the ecological also provides a series of universal service, the universal service is done with NodeX system structure, the most common scenario pulled out universal, developers can through interfaces directly calls the general service ability, greatly reducing the unnecessary redundant construction, concrete architecture diagram is not in detail here, If you’re interested, you can turn me in.

Didi Node Guide

In addition to the essential basic ecology, in terms of improving cognition and systematization ability, we have built didi Node guide, combining the historical precipitation of FT teams for many years and some internal and external best practices, forming a set of core knowledge system covering the development before, during and after. The purpose is to let developers can more easily from 0 to 1 builds a service, and system sex knowledge of every life cycle of a service should do, how to learn the Node, how to set up service, how to compile the deployment of the service, how to operational service, various categories best practices and how to guarantee the performance and stability of the service, Thus providing robust service capabilities for business. The guidelines are currently being refined.

The ground is

Under the continuous construction and promotion of our NodeX ecosystem, it is exciting that more and more teams in the group are using Node to make various attempts to improve efficiency, reduce cost and empower business, among which there is no lack of C-side business such as short domain name service, dynamic configuration service, buried point service and a series of background services. In the future, we will also deposit the basic capabilities to Serverless to provide solid basic capabilities, as well as various types of use scenario solutions, such as BFF, SSR, micro front end, to help developers quickly solve problems.

At present, the number of NodeX ecosystem installations within the Group has exceeded 10W+, and the number of service access is close to 200, covering most departments and many business scenarios within the group, such as short domain name, buried point system, configuration service, Serverless basic capacity, etc. Of course, the above statistics are only components and framework data, there are also universal services and research and development support platform access volume is also very considerable. The whole ecosystem greatly improves r&d efficiency and self-closed loop capability, helping increasingly complex businesses to grow rapidly.

The last

We set up NodeX system in the hope of bringing together more front-end teams in the group to learn, deposit, explore, build and share our historical precipitation solutions. At the same time, the output of our historical experience, sink into each business and project, can provide more teams with excellent solutions and common ecology, together with the construction of Didi Node ecology.

If you want to communicate with me about the above ecology, welcome to contact me. Pratt & Huatt pan-front-end also has a variety of cross-terminal (Hummer, Chamelon, etc.), Serverless and other technology construction (Dokit, etc.), welcome interested people to join us, please hit [email protected] resume.