
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
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
- Hola equipo de soporte,
Hola equipo de soporte, Estoy desarrollando una Function en Appwrite Cloud con Node.js 22 y el siguiente package.json: { "name": "upload-whitelist", "type"...
- Sites 30MB limit from GitHub
I’m deploying a site from github as Other type on the Hobby plan. It is actually a Flutter web app but it’s in a subdirectory with the root being an html landin...
