Hey fellow appwriters! I am trying to make a script to initialize my Flutter/Appwrite project and I have a few questions (I am quite junior in development so pardon me if some are obviously wrong or impossible):
- Is it possible to write a JSON file (a bit like appwrite.json) containing raw informations like database id/name, collection attributes, teams, etc., but also some initial data, like an admin user, documents, memberships, etc. and execute it to create some kind of project starter? Or do I have to manually create a project and insert my initial data in Appwrite's console?
- If the first assumption is impossible, is it possible to write a sequence of commands that can automatize every step from project creation to initial data insertion without needing to use Appwrite's console or write Dart code? (nothing's wrong with Appwrite's console of course, I'm just trying to automatize my project initialization! π )
- So now you have understood where I'm going, so if both first methods are impossible, do you have any tips on how I could do what I intend?
Thanks in advance,
LaurentLP
Since you already know about appwrite.json
, you're already aware of appwrite cli. The appwrite cli should be able to help you with your first approach. Unfortunately, I don't have any examples though but appwrite <command> --help
should get you far.
Thanks for your response! Indeed I know about appwrite CLI and I will dive more into it. At first glance it seems to be satisfying
@Ernest Thanks to you (through this topic and others) I have been able to write my full script, so thank you again!
As feedback from this experience, I can say that the help and error messages are not so clear about the syntaxe in the command. Scopes of API keys, JSON values (like user or team prefs) and permissions for collections should maybe be explained a bit more. Also it seems that the CLI shows an error when adding a required collection attribute because the default value is not set : "β Error Cannot convert undefined or null to object", but it is not possible to set a default value to a required attribute. It's not critical because attributes can be created even if the error message appears but it raises doubt.
Great, you got it working. I suggest you create issues for some of the bugs you noticed on the appwrite sdk-for-cli
repo. Also, you can contribute examples to the docs. As Steven pointed out, there are some examples in the README of the repo just not on the website.
Please rename this post title as solved
[SOLVED] Making a script to initialize project
Recommended threads
- Current User is Not authorized
recreating same Thread
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...