After several years of work, we found that there was a problem that had plagued us all the time: as projects become more and more complete and functions become richer, a single application could no longer support the needs of developers. Therefore, we need to split up several independent applications based on the business to meet the needs of multiple development teams. However, this also causes some problems. The maintenance of the common basic code for multiple applications becomes more and more complex, resulting in various problems. There are also many ways to solve this problem, such as placing public code in a separate place, which brings difficulties in automatic deployment. Here, I propose a solution, that is, the concept of a uniform multi-application development platform. The following uses the rails application as an example.
The standard rails application structure is as follows:
Gemfile
Gemfile. Lock
Readme. rdoc
Rakefile
App
Bin
Config
Config.ru
DB
Lib
Log
Public
Test
TMP
Vendor
Obviously, this organizational structure only supports one application. If you place multiple relatively independent functions in this application, two problems may occur: 1. due to the large amount of code, the development environment will become very slow, seriously affecting the efficiency. 2. Because it is still an application, it is difficult to decouple modules.
The multi-application unified development platform I imagined is organized in this way.
Application
| ------ App1
| ------ App2
Biz
| ------ Biz1
| ------ Biz2
Core
| ----- User_mgmt
| ------ Sso_mgmt
| ------ Permission_mgmt
Doc
Bin
The implementation of this organizational structure based on the rails engine technology is not very complicated. Core contains all the public code, such as user management and permission management.
Below biz is a module that implements specific business logic. Each module is a rails engine application. Applications are applications organized by various modules. For example, if app1 requires biz1 and user_mgmt, you only need to reference the biz1 and user_mgmt modules in app1 through the configuration file. In this way, the application starts quickly. The application difference is divided into modules to facilitate modular applications.
The following describes how to organize the structure into an application template. Just like a rails application, you can quickly develop projects with this structure by using commands and parameters. A GitHub project has been created.
Address:
Please wait.