ThinkJS is a futuristic Node.js Web framework dedicated to integrating project best practices and standardizing projects to make enterprise team development easier and more efficient. Our Github address is: github.com/thinkjs/thi… Welcome, star

When ThinkJS 2.x launched, we brought a lot of great features with us, but we were also aware of our limitations. After months of intense development to address these issues, we are pleased to announce the big new version 3.0 of ThinkJS. This version is currently available online in several projects and can be downloaded and used with a simple command:

npm install -g think-cliCopy the code

What are the updates?

As mentioned before, in order to solve the problems left over before, we developed a new version, the following is our new architecture diagram.

In addition to introducing a new architecture and highly deconstructed framework, we have added many new features and improved the usage of the old version, so let’s take a look at some of the changes.

Refactoring the framework architecture based on Koa

The biggest change in 3.0 compared to the previous use of its own integration architecture is the refactoring of the underlying architecture based on Koa. The refactored ThinkJS 3.0 is fully compatible with Koa middleware. There are several reasons for using Koa refactoring:

  • Koa is now more stable, the middleware of the Onion model can better meet the needs of multidimensional, and the middleware ecosystem has gradually matured. These are ThinkJS before do not have, based on Koa can stand on the shoulders of giants, can do better.

  • Koa 2.0 uses a more elegant async/await approach to asynchronous problems, which is exactly the same as ThinkJS. These ES Next syntax features are available in ThinkJS 2.x with Babel. With the upcoming release of Node 8.x LTS, async/await will be natively supported and can be used directly in production environments without Babel translation.

Thin core with support for extensions and adapters

ThinkJS 2.x has a lot of functionality built in, which is basically best practice for many projects, but not every project needs all of these features, which is very difficult to implement with 2.x-based architectures. So ThinkJS 3.0, based on the Koa refactoring, has been streamlined in this area, no longer providing rich functionality, but providing a basic core and then extending it to meet more needs.

Multiprocess model

ThinkJS 2.x single process is optional and the framework design is relatively simple, requiring developers to handle many functions manually. In 3.0, we developed the Think-Cluster module which directly built the multi-process model to maximize the use of multi-core CPU to improve the response speed. At the same time, it provides a set of communication methods between processes. For example, it notifies other processes to perform a task and restarts all child processes after the code is updated online.

Intelligent error message

Error handling is a headache in node.js development. It is more troublesome to check and locate errors when encountering problems, especially after using Babel translation. For this reason, we specially developed the Think-Trace module to track error problems, which can capture and display error stack information in a more friendly way.

There are!

In addition to the features we just mentioned, we have a few other updates to tell you about:

  • The think-Crontab module was added to strengthen the scheduled task function of the framework
  • The framework log system was constructed based on think-Logger3 module
  • Reconstruct the operation logic of the framework database, and add think-Model, think-Mongoose and think-Sequelize modules to improve the operation function of the framework database

Thank you

Finally, thank you to all users of the ThinkJS framework, thank you for your support over the years, it is your presence to give us further courage. I also want to thank all the contributors to the ThinkJS project, both code and documentation, for making ThinkJS great! If you don’t have time to contribute code and want to support us in other ways, you can also support us by donating. Your donation will be used to help promote ThinkJS. Thanks to all of you, let’s embrace ThinkJS and look forward to a better future!