Documentation
Existing DataService list

Existing DataService list

While creating a DataService is pretty easy sometimes you just wish to plug and play. Fortunately there are plenty official and 3party data services that you can use.

You can use RestDataService by importing them from our library and using directly inside of your app. Follow quick start to learn more.

import { RestDataService } from '@kickass-coderz/data-service'

3party data services

DataService as a concept took a lot of ideas from our fellow developers at Marmelab (opens in a new tab) and their react-admin library which uses data provider concept. It is a great library for creating ready made CMS application and they have a long history of maintainers and community (we are part of this community too). As DataService has a similar interface to any data provider you can actually use any of the premade data providers made for react-admin.

Using data provider as DataService

You can find the list of providers below but let's take a look of how you can use them as your DataService. We will take ra-supabase (opens in a new tab) data provider as an example. Supabase is a open source alternative to Google's firebase.

Install the data provider library

npm install @kickass-coderz/data-service # or any other data provider

Create the data provider instance

// dataProvider.js
 
import { createClient } from '@supabase/supabase-js'
 
export const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)
 
import { supabaseDataProvider } from 'ra-supabase'
import { supabase } from './supabase'
 
const resources = {
    posts: ['id', 'title', 'body', 'author_id', 'date'],
    authors: ['id', 'full_name']
}
 
const dataProvider = supabaseDataProvider(supabase, resources)
 
export default dataProvider

For other data providers you should check their Docs/README to see the necessary parameters.

Create the DataService

import { createFromDataProvider } from '@kickass-coderz/data-service'
import supabaseDataProvider from './dataProvider'
 
// this will create a DataService intance from exiting data provider
const supabaseDataService = createFromDataProvider(supabaseDataProvider)

Use the DataService

import { DataServiceProvider } from '@kickass-coderz/data-service'
import supabaseDataProvider from './dataProvider'
 
const supabaseDataService = createFromDataProvider(supabaseDataProvider)
 
const App = () => {
    return (
        <DataServiceProvider dataService={supabaseDataService}>
            <Component />
        </DataServiceProvider>
    )
}

Data provider list

Check the list below for open-source packages developed and maintained by developers from the react-admin community. You can use any of those as your DataService by using the createFromDataProvider helper.

Referenced from Link (opens in a new tab)