0. Preface
If you want to learn and study CabloyJS or contribute PR, you can directly clone the CabloyJS source codes from GitHub
0. Prerequisites
Before cloning and running the CabloyJS source codes, make sure you have some prerequisites ready
- Please refer to: Quick Start: prerequisites
1. Clone Cabloy Repository
- 1$ mkdir cabloy-lerna
- 2$ cd cabloy-lerna
- 3$ git clone https://github.com/zhennann/cabloy.git
2. Install Dependencies
- 1$ cd cabloy
- 2$ npm install
3. Copy config files at Front
- 1$ cp -r src/front/_config src/front/config
4. Copy config files at Backend
- 1$ cp -r src/backend/_config src/backend/config
5. Configure Redis
Cluster
now becomes the first class citizen of CabloyJS
. In other words, the CabloyJS project is ready to be deployed in a clustered environment
The cluster feature of CabloyJS is designed based on Redis
. Therefore, the connection configuration information of Redis
needs to be set
- Please refer to: Redis Config
Take notice: Use the default configuration, and just confirm whether the
host
andport
parameters meet the actual values
6. Configure MySQL
CabloyJS
provides three runtime environments. Therefore, it is necessary to set up the database connection configuration of the three runtime environments separately
- Please refer to: MySQL Config
Take notice: Use the default configuration, and just confirm whether the
host
,port
,user
andpassword
parameters meet the actual values
7. Unit-Test
- 1$ npm run test:backend
CabloyJS recommends a test-driven
development mode. By test-driven
, you can lock in the results of development, and when there are code changes, you can find problems as soon as possible, so as to solve problems
In addition, the database architecture changes frequently during the development stage, when only one unit test command is needed to take effect, which means that the old test database is always deleted and a new test database is created automatically
8. Run
Start backend service
- 1$ npm run dev:backend
Start frontend service
- 1$ npm run dev:front
9. Enjoy
- Website:http://localhost:9192
- User:root
- Password:123456
Appendix 1. Docker Compose
There is a docker-compose.yml
configuration file in the root directory of the project. If you have installed the docker compose
environment, you can start all services of CabloyJS with only one command, including Redis, MySQL, Nginx and CabloyJS backend service
- 1$ cp -r src/front/_config src/front/config
- 2$ cp -r src/backend/_config src/backend/config
- 1$ sudo docker-compose build
- 2$ sudo docker-compose up
- Enjoy
- Website:http://localhost/
- User:root
- Password:123456
Appendix 2. Test Suites/Modules
Test suites/modules
Contains a large number of test-cases
and kitchen-sink
, and continues to add more content. It is not only convenient to quickly learn all aspects of knowledge points of CabloyJS
, but also convenient to quickly start the actual business development
- 1# install suite test-party
- 2$ npm run cli :store:sync test-party
- 3# install module test-note
- 4$ npm run cli :store:sync test-note
- 5# install module test-flow
- 6$ npm run cli :store:sync test-flow
Appendix 3. Update
- Update Cabloy
- 1# pull the new codes
- 2$ git pull
- 3# reinstall dependencies
- 4$ npm install
- Update Test Suites/Modules
Since third-party suites/modules are located in the source code directory {project}/src/suite-vendor
and {project}/src/module-vendor
, separate commands are required to update them
- 1$ npm run cli :store:sync
Appendix 4. Disable login verification code for development
- Please refer to: Disable login verification code for development
💐 Further Reading
When you have created the first CabloyJS project, you can refer to the following tutorials to have a preliminary understanding of the out-of-the-box
effect and flexible-customization
mechanism:
1. Start to out-of-the-box
-
Video: Bilibili Video: 新建业务表单+审批工作流 (Translation Wanted)
2. Start to flexible-customization
-
Doc:Tutorial: Basic process of frontend and backend development
-
Video:Bilibili Video: 前后端开发基本流程 (Translation Wanted)
Comments: