Skip to main content

A CLI tool to automate the creation and synchronization of Appwrite database collections from a JSON schema

Project description

Here is the updated full README.md with all relevant sections, including installation from PyPI and TestPyPI, publishing instructions, developer mode, and licensing.


📄 Final README.md for appwrite-sync

# appwrite-sync

**`appwrite-sync`** is a CLI tool to automate the creation and synchronization of Appwrite database collections from a JSON schema. It's designed for developers who want to version and manage their Appwrite collections in a clean and repeatable way—ideal for CI/CD, team collaboration, and structured schema design.

---

## 🚀 Features

- 🔁 Sync collections, attributes, relationships, and indexes
- 📁 Reads from a single `schema.json` definition
- ⚙️ Supports all common attribute types including `string`, `enum`, `relationship`
- ✅ Idempotent: avoids duplication and handles existing resources gracefully
- 🛠 CLI-first: easily scriptable and automatable
- 📦 Packaged and installable from PyPI

---

## 📦 Installation

### From PyPI

```bash
pip install appwrite-sync

From TestPyPI (optional testing)

pip install --index-url https://test.pypi.org/simple/ appwrite-sync

🧰 Usage

1. Initialize a Folder

Generate a sample .env file and schema.json template in your current directory:

appwrite-sync init

2. Configure .env

ENDPOINT=http://localhost/v1
PROJECT_ID=your-project-id
DB_ID=your-database-id
API_KEY=your-appwrite-api-key

3. Define Your Schema

Edit schema.json to define collections, attributes, and indexes. Example:

{
  "users": {
    "name": "Users",
    "attributes": {
      "email": {
        "type": "email",
        "required": true
      },
      "role": {
        "type": "enum",
        "required": true,
        "elements": ["admin", "user"]
      }
    },
    "indexes": [
      {
        "key": "unique_email",
        "type": "unique",
        "attributes": ["email"]
      }
    ]
  }
}

4. Sync to Appwrite

Make sure your .env is sourced:

source .env

Then run:

appwrite-sync sync

Or pass DB ID directly:

appwrite-sync sync --db-id your-db-id

✅ Supported Attribute Types

  • string, email, url, integer, boolean, datetime
  • enum with elements
  • relationship with relatedCollection, relationType, and twoWay

🧪 Development (Editable Install)

git clone https://github.com/aboidrees/appwrite-sync.git
cd appwrite-sync
pip install -e . --config-settings editable_mode=compat

📤 How to Publish to PyPI

Step 1: Build the package

python -m build

Step 2: Upload to PyPI

twine upload dist/*

To upload to TestPyPI instead:

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Step 3: Install from PyPI

pip install appwrite-sync

🧾 License

This project is licensed under the MIT License. See the LICENSE file for full details.


👨‍💻 Author

Developed by [Muhammad Yousif]

GitHub: https://github.com/aboidrees


---

Would you like me to also generate a matching `LICENSE` file now? If so, let me know what name you want to appear in the copyright.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appwrite_sync-0.4.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appwrite_sync-0.4.5-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file appwrite_sync-0.4.5.tar.gz.

File metadata

  • Download URL: appwrite_sync-0.4.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for appwrite_sync-0.4.5.tar.gz
Algorithm Hash digest
SHA256 52c0bf8fc88f5a5b0289f90f41e8fa567cd79f4341951a031f32c67c3100a488
MD5 1fcc7fde00f31a362d259f4c4fc612d9
BLAKE2b-256 7bc97ac6accc3efcf8d4e4fb788bd7a3aa79c889726afa32da00d61fde1ed5da

See more details on using hashes here.

File details

Details for the file appwrite_sync-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: appwrite_sync-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for appwrite_sync-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9ef5baa81ad0d419fb3f8c07156dcf1f50e5d9da1fd52ae177aa4ca921575edc
MD5 fabad7ccc3b4df8816f803ed435c9491
BLAKE2b-256 ab287d8c98e2af953b74b1aca278df5137e419716bb5d01a98b1b0bfae1a63f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page