ra-appwrite
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

ra-appwrite

This package provides a Data Provider and Auth Provider to integrate Appwrite with react-admin.

The Data Provider supports:

  • Documents

The Auth Provider supports:

  • Login
  • Logout
  • Permissions (Teams)

Installation

yarn add ra-appwrite
# or
npm install ra-appwrite

Usage

import React from "react";
import { Appwrite } from "appwrite";
import { AppwriteDataProvider, AppwriteAuthProvider } from "ra-appwrite";
import {
  Admin,
  EditGuesser,
  ListGuesser,
  Resource,
  ShowGuesser,
} from "react-admin";

// Init your Web SDK
const appwrite = new Appwrite();

appwrite
  .setEndpoint("http://localhost/v1") // Your Appwrite Endpoint
  .setProject("455x34dfkj"); // Your project ID

// Create a mapping of resources to collection IDs
const resources = {
  movies: "6160a2ca6b6fc",
};

// Initialize the providers
const dataProvider = new AppwriteDataProvider(appwrite, resources);
const authProvider = new AppwriteAuthProvider(appwrite);

const App = (): JSX.Element => (
  <Admin dataProvider={dataProvider} authProvider={authProvider}>
    <Resource
      name="movies" // Matches resources key
      list={ListGuesser}
      edit={EditGuesser}
      show={ShowGuesser}
    />
  </Admin>
);

export default App;

Roadmap

  • Add support for fetching teams
  • Add support for fetching files

Readme

Keywords

Package Sidebar

Install

npm i ra-appwrite

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

16 kB

Total Files

8

Last publish

Collaborators

  • stnguyen90