Giter Club home page Giter Club logo

refinedev / refine Goto Github PK

View Code? Open in Web Editor NEW
24.7K 125.0 1.8K 3.33 GB

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.

Home Page: https://refine.dev

License: MIT License

TypeScript 97.36% JavaScript 2.31% Shell 0.01% Dockerfile 0.02% Smarty 0.03% CSS 0.15% Handlebars 0.03% HTML 0.10%
react typescript admin admin-ui ant-design react-framework frontend-framework graphql nestjs nextjs

refine's Introduction



The sweet spot between the low/no code and “starting from scratch” for CRUD-heavy applications.
Refine is as an open source, React meta-framework for enterprise. It provides a headless solution for everything from admin panels to dashboards and internal tools.

Awesome OpenSSF Best Practices npm version Contributor Covenant

Discord Twitter Follow


how-refine-works

What is Refine?

Refine is a React meta-framework for CRUD-heavy web applications. It addresses a wide range of enterprise use cases including internal tools, admin panels, dashboards and B2B apps.

Refine's core hooks and components streamline the development process by offering industry-standard solutions for crucial aspects of a project, including authentication, access control, routing, networking, state management, and i18n.

Refine's headless architecture enables the building of highly customizable applications by decoupling business logic from UI and routing. This allows integration with:

  • Any custom designs or UI frameworks like TailwindCSS, along with built-in support for Ant Design, Material UI, Mantine, and Chakra UI.

  • Various platforms, including Next.js, Remix, React Native, Electron, etc., by a simple routing interface without the need for additional setup steps.

⚡ Try Refine

Start a new project with Refine in seconds using the following command:

npm create refine-app@latest my-refine-app

Or you can create a new project on your browser:

Quick Start

Here's Refine in action, the below code is an example of a simple CRUD application using Refine + React Router + Material UI:

import React from "react";
import { Refine, useMany } from "@refinedev/core";
import { ThemedLayoutV2 } from "@refinedev/mui";
import dataProvider from "@refinedev/simple-rest";
import routerProvider from "@refinedev/react-router-v6";
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";

import CssBaseline from "@mui/material/CssBaseline";

export default function App() {
  return (
    <BrowserRouter>
      <CssBaseline />
      <Refine
        dataProvider={dataProvider("https://api.fake-rest.refine.dev")}
        routerProvider={routerProvider}
        resources={[
          {
            name: "products",
            list: "/products",
          },
        ]}
      >
        <Routes>
          <Route
            element={
              <ThemedLayoutV2>
                <Outlet />
              </ThemedLayoutV2>
            }
          >
            <Route path="/products">
              <Route index element={<ProductList />} />
            </Route>
          </Route>
        </Routes>
      </Refine>
    </BrowserRouter>
  );
}

// src/pages/products/list.tsx

import { List, useDataGrid, DateField } from "@refinedev/mui";
import { DataGrid, GridColDef } from "@mui/x-data-grid";

export const ProductList = () => {
  const { dataGridProps } = useDataGrid();

  const { data: categories, isLoading } = useMany({
    resource: "categories",
    ids:
      dataGridProps?.rows?.map((item) => item?.category?.id).filter(Boolean) ??
      [],
    queryOptions: {
      enabled: !!dataGridProps?.rows,
    },
  });

  const columns = React.useMemo<GridColDef[]>(
    () => [
      { field: "id", headerName: "ID", type: "number" },
      { field: "name", flex: 1, headerName: "Name" },
      {
        field: "category",
        flex: 1,
        headerName: "Category",
        renderCell: ({ value }) =>
          isLoading
            ? "Loading..."
            : categories?.data?.find((item) => item.id === value?.id)?.title,
      },
      {
        field: "createdAt",
        flex: 1,
        headerName: "Created at",
        renderCell: ({ value }) => <DateField value={value} />,
      },
    ],
    [categories?.data, isLoading],
  );

  return (
    <List>
      <DataGrid {...dataGridProps} columns={columns} autoHeight />
    </List>
  );
};

The result will look like this:

Refine + Material UI Example

Use cases

Refine shines on data-intensive⚡ enterprise B2B applications like admin panels, dashboards and internal tools. Thanks to the built-in SSR support, it can also power customer-facing applications like storefronts.

You can take a look at some live examples that can be built using Refine from scratch:

Key Features

  • Refine Devtools - dive deeper into your app and provide useful insights
  • Connectors for 15+ backend services including REST API, GraphQL, NestJs CRUD, Airtable, Strapi, Strapi v4, Supabase, Hasura, Appwrite, Nestjs-Query, Firebase, Sanity, and Directus.
  • SSR support with Next.js & Remix and Advanced routing with any router library of your choice
  • Auto-generation of CRUD UIs based on your API data structure
  • Perfect state management & mutations with React Query
  • Providers for seamless authentication and access control flows
  • Out-of-the-box support for live / real-time applications
  • Easy audit logs & document versioning

Learning Refine

  • Navigate to the Tutorial on building comprehensive CRUD application guides you through each step of the process.
  • Visit the Guides & Concepts to get informed about the fundamental concepts.
  • Read more on Advanced Tutorials for different usage scenarios.

Contribution

Refer to the contribution docs for more information.

If you have any doubts related to the project or want to discuss something, then join our Discord server.

Contributors ♥️ Thanks

We extend our gratitude to all our numerous contributors who create plugins, assist with issues and pull requests, and respond to questions on Discord and GitHub Discussions.

Refine is a community-driven project, and your contributions continually improve it.


License

Licensed under the MIT License, Copyright © 2021-present Refinedev

refine's People

Contributors

alicanerdurmaz avatar aliemir avatar anewman15 avatar bastian avatar batuhanw avatar biskuvit avatar burcukaragozzz avatar conqxeror avatar dependabot[bot] avatar dipbazz avatar doguhanozgurakca avatar drcivan avatar github-actions[bot] avatar mahirmahdi avatar mhrrmk avatar mlhekinci avatar necatiozmen avatar nrikiji avatar omeraplak avatar ozkalai avatar rasitcolakel avatar rassie avatar refine-bot avatar s-vamshi avatar salihozdemir avatar sevkioruc avatar snyk-bot avatar umutzd avatar weisisheng avatar yildirayunlu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

refine's Issues

Rename Inputs/Fields components.

Form Inputs
Input -> TextInput
Textarea -> TextAreaInput
...otherInputs

Table Fields
Text -> TextField
Boolean -> BooleanField
...otherFields

CSV Import

ImportButton -> Prop'ları
{
resourceName?: string;
mapData?(value: BaseRecord, index: number, array: BaseRecord[]): BaseRecord;
csvProps?: CSVReaderProps; ????
}

mapData -> Gender, 1 : 2 => gender === 1 ? "female" : "male"

Custom Page

useList hook'unu kullanarak custom şekilde page yaratabilmeliyiz.

Admin logo

Admin'e logo isminde optional prop ekleyip header kısımında göstermeliyiz. Eğer gelmez ise default olarak Readmin yazabiliriz.

image

List empty prop

Optional olarak list componentine eklemeliyiz. Eğer gösterilen resource'da hiç kayıt yoksa bu prop render edilmeli. Default olarak gösterilecek bir ui ihtiyacımız var.

Redux

Actions

Register Resource
Resource'leri analiz ederek yeni bir resource objesi hazırlar ve admin.resources altına key users olarak pushlar.

{
  "props": {
    "name": "users",
    "options": {},
    "hasList": true,
    "hasEdit": true,
    "hasShow": true,
    "hasCreate": false
  },
  "data": [],
  "list": {
    "params": {
      "sort": null,
      "order": null,
      "page": 1,
      "perPage": null,
      "filter": {}
    },
    "selectedIds": [],
    "total": null
  },
}

Fetch Start
Global loading objesini (admin.loading) true setler.

Fetch End
Global loading objesini (admin.loading) false setler.

CRUD Get List (Request | Success | Failed )
Crud List için request başlatır ve sonlandırır.

CRUD Get One (Request | Success | Failed )
Crud One için request başlatır ve sonlandırır.

Inital State

{
  admin: {
    resources: {},
    loading: 0,
    notifications: [],
    ui: {
      sidebarOpen: false,
    }
  },
}

Notification

antd notification kullanarak istediğimiz yerde notification gösterebilmeliyiz. useNotification hook'u oluşturup hem içerde hemde export etmeliyiz.

Admin ready props

Eğer hiç resource tanımlanmadıysa bu propu render etmeliyiz. Eğer gelmezse default olarak gösterebileceğimiz bir component'e ihtiyacımız var.

useSelect, useCheckbox, useRadio data fetch size

ReferenceInput düzenleme ekranında düzenleme yapılan element ve ilk 25 kayıtın getirilmesi.

Ör: Post datası bu şekilde:

{
  "id": "1",
  "title": "test",
  "categoryId": "50"
}

Edit ekranında ReferenceInput category resource'den 25 kayıt çekiyor bunlar içinde 50 id'li kayıt yoksa select'de 50 seçili hale geliyor.

Çözüm olarak ilk 25 kaydı çekip ve edit yaptığımız kaydı ayrıca in yapmamak gerekiyor.

Geçiçi olarak pageSize: 999 yaparak çözdüm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.