- Implementation Owner: @eldadfux
- Start Date: 30-12-2020
- Target Date: Unknown
- Appwrite Issue: appwrite/appwrite#540
Build an Appwrite CLI that will include all standard backend SDKs functionality and allow Appwriters to interact with the Appwrite HTTP API directly from their terminals.
The CLI should rely on common Appwrite CLI FW for consistency and easy maintenance. We should package the CLI as a Docker image for ease of use across different platforms or operating systems.
What problem are you trying to solve?
There is no easy way to interact with Appwrite directly from the operating system terminal.
What is the context or background in which this problem exists?
Using Appwrite directly from the terminal can be extremely useful for integrating with CI and automation in general. With the introduction of Cloud Functions, a CLI integration would allow reducing crucial steps required to package cloud functions and upload them to the Appwrite server directly from the developer workspace.
Once the proposal is implemented, how will the system change?
No changes are expected to the Appwrite server or API. The new CLI will perform exactly the same as every other Appwrite SDK.
Build a working prototype of the SDK using the team common tools-stack. Once ready, integrate the mock into the Appwrite SDK generator for easy syncing with any future API changes and an automated release cycle. The new CLI tool should comply with all the Appwrite SDK generator requirements for consistency with other Appwrite SDKs.
Dockerfile composer.json app/ client.php services/ users.php storage.php ...
To start, we can skip any input validation in the CLI layer and rely on the HTTP validations and status codes. All user input for the HTTP client settings (API Keys, Project ID, Endpoint URL) should be saved locally on the container for persistency and ease of use.
Usage Examples:
docker run appwrite/cli:1.0.0 client setProject --value=5e63e0a61d9c2
docker run appwrite/cli:1.0.0 users createUser --email=test@appwrite.io --password=secret --name=Demo User
References:
- PHP-SDK: https://github.com/appwrite/sdk-for-php/blob/master/src/Appwrite/Client.php
- Node-SDK: https://github.com/appwrite/sdk-for-node
- Utopia CLI: https://github.com/utopia-php/cli
List the new Appwrite CLI in our /docs/sdks
page. Add code examples for using the new CLI SDK in the Appwrite server API docs alongside existing server languages.
Create a short tutorial that explains how to use the new SDK in a specific common use case.
It would be nice to find a way to use the CLI without the Docker prefix. For example:
Usage Examples:
appwrite client setProject --value=5e63e0a61d9c2
appwrite users createUser --email=test@appwrite.io --password=secret --name=Demo User
Not crucial for the first release
We could use the new Appwrite CLI as a legit SDK, just like any other official Appwrite SDK. The CLI would also make integration with other upcoming features much easier.