## 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](https://cabloy.com/articles/guide-quick-start.html) ## 1\. Clone Cabloy Repository ``` bash $ mkdir cabloy-lerna $ cd cabloy-lerna $ git clone https://github.com/zhennann/cabloy.git ``` ## 2\. Install Dependencies ``` bash $ cd cabloy $ npm install ``` ## 3\. Copy config files at Front ``` bash $ cp -r src/front/_config src/front/config ``` ## 4\. Copy config files at Backend ``` bash $ 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](https://cabloy.com/articles/config-redis.html) > Take notice: Use the default configuration, and just confirm whether the `host` and `port` 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](https://cabloy.com/articles/config-mysql.html) > Take notice: Use the default configuration, and just confirm whether the `host`, `port`, `user` and `password` parameters meet the actual values ## 7\. Unit-Test ``` bash $ 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 ``` bash $ npm run dev:backend ``` Start frontend service ``` bash $ npm run dev:front ``` ## 9\. Enjoy * Website: * 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 ``` bash $ cp -r src/front/_config src/front/config $ cp -r src/backend/_config src/backend/config ``` ``` bash $ sudo docker-compose build $ sudo docker-compose up ``` * Enjoy * Website: * 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 ``` bash # install suite test-party $ npm run cli :store:sync test-party # install module test-note $ npm run cli :store:sync test-note # install module test-flow $ npm run cli :store:sync test-flow ``` ## ***Appendix 3***. Update * Update Cabloy ``` bash # pull the new codes $ git pull # reinstall dependencies $ 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 ``` bash $ npm run cli :store:sync ``` ## ***Appendix 4***. Disable login verification code for development * Please refer to: [Disable login verification code for development](https://cabloy.com/articles/faq-captcha-disabled.html) ## **💐 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 * Doc: [Tutorial: Create Module](https://cabloy.com/articles/a5adc438c4a24985baee645028baea56.html) * Video: [Bilibili Video: 新建业务表单+审批工作流](https://www.bilibili.com/video/BV1yL4y1w7dc/?vd_source=8a2b870d6d5dc83f8f4b973c95613fd8) (Translation Wanted) ### 2\. Start to flexible-customization * Doc:[Tutorial: Basic process of frontend and backend development](https://cabloy.com/articles/tutorial-advanced-front-backend.html) * Video:[Bilibili Video: 前后端开发基本流程](https://www.bilibili.com/video/BV1GU4y1D7AF/?vd_source=8a2b870d6d5dc83f8f4b973c95613fd8) (Translation Wanted)