contributions/ClientSetup.md
Appsmith's client (UI/frontend) uses the ReactJS library and Typescript. The application also uses libraries like react-redux and redux-saga for workflows. We use VS Code Editor as our primary editor.
On your development machine, please ensure that:
docker installed in your system. If not, please visit: https://docs.docker.com/get-docker/mkcert installed. Please visit: https://github.com/FiloSottile/mkcert#installation for details.mkcert to work with Firefox, you may need to install the nss utility. Details are in the link above.mkcert using the following command
curl -s https://api.github.com/repos/FiloSottile/mkcert/releases/latest \
| grep "browser_download_url.*linux-amd64" \
| cut -d : -f 2,3 | tr -d \" \
| wget -i - -O mkcert
chmod +x mkcert
sudo mv mkcert /usr/local/bin
envsubst installed. Use brew install gettext on MacOS. Linux machines usually have this installed.npm install -g yarn.bash cd app/client/docker && mkcert -install && mkcert "*.appsmith.com" && cd ../../..
This command will create 2 files in the docker/ directory:
- _wildcard.appsmith.com-key.pem
- _wildcard.appsmith.com.pemdev.appsmith.com to /etc/hosts.
bash echo "127.0.0.1 dev.appsmith.com" | sudo tee -a /etc/hosts
Note:
- Please be careful when copying the above string as space between the IP and the string goes missing sometimes.
- Please check that the string is copied properly
cat /etc/hosts | grep appsmith
cp .env.example .envhttps://release.app.appsmith.com for development purposes. (Recommended)start-https.sh to start the nginx container that will proxy the frontend requests to the backend server.cd app/client
./start-https.sh https://release.app.appsmith.com // uses Appsmith's staging backend server as backend for your local frontend code
start-https.sh.app/client: yarn install.
Note:echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
app/client: yarn start.app/client: nvm use 20.11.1 or fnm use 20.11.1.cypress.config.ts file based on the configuration you used for running the codebase locally. By default, itβs https://dev.appsmith.com .APPSMITH_GIT_ROOT=./container-volumes/git-storage to the folder app/server/.env and run the server locally instead of via Docker container.To setup the configurations for running integration tests via Cypress, use these commands below (run from repo root):
cd app/client/cypress/scripts
yarn install
yarn run setup
Prompt:
Do you wish to continue without setting up the local server with docker? (yes/no):
Options:
appsmith-ce:release image.Prompt:
https://dev.appsmith.com is not accessible. Do you wish to continue without setting it up? (yes/no):
Options:
Prompt:
TED (TestEventDriver) is not running. Do you want to pull & run the latest Docker container for TED (TestEventDriver)? (yes/no):
Options:
To run a specific test file in headless fashion, use the following command (run from repo root):
cd app/client/
yarn install
npx cypress run --spec <spec path> --browser chrome
To open Cypress in the browser and run the tests visually (run from repo root):
cd app/client/
yarn install
npx cypress open
<b><a name="running-backend-locally">Running appsmith backend server locally</a></b>
There are two configurations available for running the backend server locally.
Running the server from source code.
Running the server from a docker image. There are two ways to get a backend docker image
Pull latest release branch docker image from Appsmith's public docker hub account.
docker rm appsmith;
cd ~/appsmith;
rm -rf stacks;
docker pull appsmith/appsmith-ce
docker run -d --name appsmith -p 8000:80 appsmith/appsmith-ce:latest;
docker logs -f appsmith;
./start-https.sh http://localhost:8000 // if nginx is installed locally
./start-https.sh http://host.docker.internal:8000 // if nginx is running on docker
Create docker image from local source code
cd ~/appsmith
./scripts/local_testing.sh -l # This builds a fat docker image of local backend and frontend
# The docker image created above will show up in your docker desktop application
docker run -d --name appsmith -p 8000:80 appsmith/appsmith-ce:local-testing;
./start-https.sh http://localhost:8000 // if nginx is installed locally
./start-https.sh http://host.docker.internal:8000 // if nginx is running on docker
Please check out our Testing Contribution guide for more details on setting up & troubleshooting Cypress runs on your machine.
cd app/client
yarn run test:unit
cd app/client
# Run either command below to run a test
npx jest <file_path/file_name>
# or
yarn jest src/widgets/<filepath>/<filename>.test.ts --silent=false
app/client:
npx jest --watch <file_path/file_name>
Before you follow the instructions above, make sure to check the following steps:
In the above Docker Desktop Setup instructions, make sure to:
Make sure to Clone the Repo in the WSL file system instead of the Windows file system.
And finally, you can open the folder in VSCode with WSL by following the instructions in Docker Desktop Setup, or by,
After this, you can continue Setting up from here.
You will need to add dev.appsmith.com to Windows' C:\Windows\System32\drivers\etc\hosts instead of /etc/hosts. Alternately, you can install a desktop environment in WSL to open dev.appsmith.com from a browser in WSL.
127.0.0.1 dev.appsmith.com
WSL network with windows can be brittle; make sure you can reach http://127.0.0.1:3000 from windows. If not, restarting wsl usually resolves the issue.
docker logs wildcard-nginx.Address already in use errors, look for the service running on port 80 and 443 with lsof -i tcp:80,443 | grep LISTEN and stop the process.
Example: Some Linux distros have apache2 listening on 80. Stop them with sudo systemctl stop apache2app/client/docker/templates/nginx-app.conf.template over to your nginx sites directory.sub_filter. None of those properties are required.proxy_pass value for client from __APPSMITH_CLIENT_PROXY_PASS__ to http://localhost:3000__APPSMITH_SERVER_PROXY_PASS__ with http://localhost:8080 (or the server you want to point to)mkcert.ssl_certificate & ssl_certificate_key to the place where these certificates were generated.Please open a Github issue or join our discord server.