Contributing to AFR
Testing
Reference: https://appwrite.io/blog/post/functions-local-development-guide
Prerequisites:
- Docker is installed and running
npm install -g appwrite-cli@latest
appwrite login
(no need to "appwrite init project" etc. it’s all setup already)
The ./functions/Test/ folder contains an Appwrite function you may run to test against the library code developped in ./src/.
The strategy is kinda brut-force: copy the library code (./src) over to ./function/Test/src/lib, then run the function with npm install && npm run build
as its setup command within the container, which will ensure the library code is globally available, thus callable by the function handler.
npm run test # copy the library code over and run the function locally with Docker
Test & debug functions locally
The testing function sits inside ./functions/Test. It’s meant to run locally in a (Appwrite) Docker container for rapid debugging, altough it can be deployed and run remotely, eg. on Appwrite Cloud or any hosted Appwrite instance.
- Install Docker.
- Clone the repository, checkout any relevant branch.
- Create an Appwrite free account & download their cli, so you can
appwrite login
(which sadly is required to work locally with Docker). - Run
npm run test
, hit localhost:3000 => check for errors in the container’s output.
With the Docker Desktop GUI, it’s quite easy browsing the server files:
Without a GUI, one must docker exec -it <containerid> sh
.
From there:
- the server code is at /usr/local/server/src/server.js (copy 2025/08/05)
- the Appwrite’s testing function code is at /usr/local/server/src/function/[dist|src]
One may live-edit the former, but not the latter (it gets replaced upon restarting the container). When editing eg. server.js to add debugging logs, simply save the file and hit Restart in the GUI, or docker container restart <containerid>
.