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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support š I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...