To deploy this repo, you'll need the [AppWrite CLI](https://appwrite.io/docs/command-line#installation).
## Connect to your Appwrite instance
Log into your Appwrite instance's UI and create a new project. Call it whatever you want. Once it's created, navigate to Settings within the new project.
From the root of this repo, run `appwrite client --endpoint [YOUR_APPWRITE_API_ENDPOINT] --projectId [PROJECT_ID]`.
Next, run `appwrite login` to authenticate.
Now, link the repo to the project - `appwrite init project`. Select yes when ask if you want to override the currently associated project. Select "List this directory to an existing Appwrite project", then select the new project you've just created.
## Deploy to AppWrite
Run `appwrite deploy collection` to deploy the database. Press `<a>` to select all, then `<enter>` to proceed.
Once that's done, run `appwrite deploy function` to deploy the backend functions, and proceed as above.
## Generate API key
Navigate to Overview and select "API Key" under "Integrate With Your Server". Give the key a name, "Select All" for scopes, and click "Create". Scroll down to Integrations > API Keys, click the new key you just created, and copy it (under "API Key Secret").
## Set enviroment vars
This currently has to be done manually for each function. There's an [issue](https://github.com/appwrite/appwrite/issues/3530) open at Appwrite to make this possible on a project level.
Navigate to the first function > Settings. Scroll down to Update Function Variables. Set the following vars:
*`APPWRITE_DATABASE_ID`: This is the database ID of the database created above. Get it at Databases > click "Project ID" on the database created above.
*`BASE_URI`: This is the URL of the frontend
*`API_KEY`: The Appwrite API key you created above
You'll need to create these vars for each of the three functions.