Developer Quick Start

This guide helps you get started developing APITable.

Dependencies

Language Independent Dependencies

Some native libraries and build tools are required to build APITable. These libraries and tools often need to be installed with different package managers on different operating systems. The following subsections describe commands for installing these libraries & tools on mainstream OSs.

Some notable required tools:

  • git

  • pnpm

  • make

  • docker

  • docker-compose v2

  • Python 3.7 or above (APITable doesn’t have Python code, however, it’s required by other build tools, so we list it here instead of in the Programming Languages section.)

  • A proper C/C++ compiler toolchain, e.g. GCC 4.8 or above, Clang 3.5 or above.

On MacOS and Linux, Python is usually pre-installed, but its version may not meet the requirement. You can run python --version to check out the version of the built-in Python, if it is below 3.7, you need to install a suitable version. We have shown the commands for installing Python 3 individually in the following subsections for reference.

MacOS

We recommend using Homebrew for installing any missing dependencies:

brew install git make gcc
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman zip

# Install docker and docker-compose
brew install --cask docker

# Install Python 3.x
brew install python3

# (optional) npm use python3
npm config set python $(which python3)

Linux

On CentOS or other RHEL-based Linux distributions, use yum:

# This will install GCC toolchain and Make
sudo yum groupinstall 'Development Tools' cairo-devel pango-devel libjpeg-turbo-devel giflib-devel
sudo yum install zip git

# Install Python 3.x
sudo yum install python3

On Ubuntu or other Debian-based Linux distributions, use apt:

sudo apt update
# This will install GCC toolchain and Make
sudo apt install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
sudo apt install zip git

# Install Python 3.x
sudo apt install python3

On ArchLinux or Arch-based Linux distributions, use pacman:

sudo pacman -Syyu git base-devel zip cairo pango pkg-config

# Install Python 3.x
sudo pacman -Syyu python3

To install docker and docker-compose on Linux, see https://docs.docker.com/engine/install/ .

Windows

If you want to develop APITable on Windows 10/11, we recommend installing Docker Desktop on Windows, Ubuntu on WSL and Windows Terminal, You can learn more about Windows Subsystem for Linux (WSL) on the official site.

After activating WSL, you can follow the instructions in the above Linux section to install dependencies.

Programming Languages

To build APITable, the following programming languages are required:

  • Nodejs 16.15

  • Java 17

We recommend sdkman and nvm for managing the versions of Java and Node.js respectively. To install sdkman and nvm, run the following commands. If you want to manage versions of Java and Node.js manually, you can skip them.

# quick install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash

# quick install sdkman
curl -s "https://get.sdkman.io" | bash

# quick install pnpm@8
curl -fsSL https://get.pnpm.io/install.sh | sh -

APITable repository contains configuration files for specifying required versions of Java and Node.js. Simple commands can be used to switch to specified versions when you start to develop APITable, and they are only active in the shell where you run those commands, you are still free to use other versions of Java and Node.js in other projects at the same time. You need to go into the root directory of APITable repository, then run

# Switch to the specified Node.js version, installing it first if necessary.
nvm use

# Switch to the specified Java version, installing it first if necessary.
sdk env install

Also, you can install shell plugins to automatically switch Node.js versions for you. For example, for zsh, you can install zsh-auto-nvm-use to run nvm use automatically.

sdkman supports automatically switching versions, you just need to enable it. Run sdk config, and change sdkman_auto_env=false to sdkman_auto_env=true.

If you’d like to install the required Java and Node.js versions manually with sdkman and nvm, you can run:

nvm install 16.15.0 && nvm use 16.15.0

sdk install java 17.0.9-amzn

Package registry mirrors in Mainland China (中国大陆软件源加速)

  1. NPM registry mirror, modify the file .npmrc:

//.npmrc taobao npm mirror
registry=https://registry.npmmirror.com

Start the development server

We use make as our centric build tool entry that drives other build tools like gradle / npm / pnpm.

So you can just enter make command and see all build commands:

APITable consists of 3 processes:

  1. backend-server

  2. room-server

  3. web-server

To start the development environment locally, Simply follow the steps below:

  1. Start local database and middleware:

make dataenv 

Including the following docker containers:

  • minio

  • mysql

  • rabbitmq

  • redis

  • init-db (exit after successful completion)

  • init-appdata (exit after successful completion)

  1. run these commands:

# install dependencies

make install 

#start backend-server

make run # enter 1  

# and then switch to a new terminal
# start room-server

make run # enter 2

# and then switch to a new terminal
# start web-server

make run # enter 3

# and then switch to a new terminal
# start databus-server

make run # enter 4