RAP3 is a popular open-source interface management platform. With its powerful GUI tools, it enables front-end and back-end developers to quickly agree on interface formats. It automatically generates structured interface documentation, mock services, and strongly-typed TypeScript interface definitions, thereby enhancing development efficiency and experience.
RAP3 is a new project based on RAP1 & RAP2. It has two components:
- rap3-server: back-end data API server based on Koa + MySQL link
- rap3-client: front-end static build based on React link
Domestic users can refer to https://get.daocloud.io/ for installing Docker and Docker Compose (Linux users need to install separately). It is recommended to follow the instructions in the link to configure Docker Hub's domestic mirror to improve loading speed.
Create a directory named rap anywhere you like.
Download the docker-compose.yml file from this repository and place it in the rap directory.
The default port number for the Rap frontend service is 3800, but you can customize it in the docker-compose.yml file as per the comments.
Run the following command in the rap directory:
# pull the latest images and startup
docker-compose up -d
# After starting, you need to manually initialize the MySQL database for the first run.
# ⚠Note: This step is only required the first time.
docker-compose exec rapserver node scripts/initSchema.js force
# After initialization, you can access the following URLs in your browser:
http://localhost:3800 # Front-end
http://localhost:38080 # Back-end
# If access is not possible, it might be because the database is not connected. Shut down the rap service.
docker-compose down
# Restart the service
docker-compose up -d
# If Sequelize reports an error, it might be due to changes in the database schema. Run the following command to synchronize
docker-compose exec rapserver node scripts/updateSchema
RAP is frequently updated with bug fixes and feature upgrades. Using Docker makes it easy to keep up with the main project's updates.
# Pull the latest images
docker-compose pull
# Stop the current application
docker-compose down
# Rebuild and start
docker-compose up -d --build
# Sometimes the table structure changes, execute the following command to synchronize
docker-compose exec delos node scripts/updateSchema
# Clear unused images
docker image prune -f
- Node.js 16.0+
- MySQL 5.7+
- Redis 4.0+
- pandoc 2.73 (For generating offline documentation)
Please refer to the setup guide for detailed instructions. The configurations for MySQL and Redis can be found in the config.*.ts files. Without modifying any settings, Redis can be accessed using the default port on the local machine. Just ensure that redis-server is running.
Note: After modifying the config files, you need to run npm run build again for the changes to take effect.
We use Pandoc to generate offline documentation for Rap. The most common way to install Pandoc is to download the binary file for your platform from the Pandoc release page and install it.
For the Linux version, it is best to place it in /usr/local/bin/pandoc
so that it can be found and run directly from the terminal. Then, give it execute permissions by running chmod +x /usr/local/bin/pandoc
.
You can test the installation by running the command pandoc -h
in the terminal; if there is a response, the installation is successful.
redis-server
You can use nohup
or pm2
to run processes in the background. We recommend using pm2
. The following commands will install pm2
and start the Redis cache service using pm2
npm install -g pm2
npm run start:redis
mysql -e 'CREATE DATABASE IF NOT EXISTS RAP2_DELOS_APP DEFAULT CHARSET utf8 COLLATE utf8_general_ci'
npm install
confirm configurations in /config/config.dev.js (used in development mode)
npm install -g typescript
npm run build
npm run create-db
npm run check
npm run dev
# 1. Modify the server configuration in /config/config.prod.js
# 2. Start the production server
npm start
- Owner: Bosn Ma
- Contributers: link
- Front-end (rap-client)
- React / Redux / Saga / Router
- Mock.js
- SASS / Bootstrap 4 beta
- server: nginx
- Back-end (rap-server)
- Koa
- Sequelize
- MySQL
- Node.js