Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

ContactSign Up
Community Plugin
View plugin on GitHub

gatsby-source-appwrite

Gatsby source plugin for building websites using Appwrite as a data source

How to install

npm install gatsby-source-appwrite node-appwrite

Available options

  • appwriteEndpoint - the url of your endpoint
  • appwriteProject - appwrite project id
  • appwriteApiKey - api key of your appwrite project, with correct access rights

Examples of usage

Queries

// gatsby-config.js

module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-appwrite`,
      options: {
        appwriteEndpoint: "http://localhost/v1",
        appwriteProject: "my-project",
        appwriteApiKey: "my-api-key",
        types: [
          {
            type: "Todo",
            query: (databases) => databases.listDocuments("my-database-id", "my-collection-id"),
          },
        ],
        types: [
          {
            type: "Movies",
            query: (databases) =>
              databases.listDocuments("my-database-id", "my-collection-id", [
                Query.equal("title", "Avatar"),
              ]),
          },
        ],
      },
    },
  ],
};

How to query for data

query MyQuery {
  appwriteTodo {
    id
    databaseId
    name
  }
}

Will result with:

{
  "data": {
    "appwriteTodo": {
      "id": "4fb16cb4-916f-5bca-baee-e7763936d272",
      "databaseId": "6359a5cdc905610fb81e",
      "name": "Hey Hey"
    }
  },
  "extensions": {}
}
© 2024 Gatsby, Inc.