A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
Installations
npm install ra-i18n-polyglot
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
20.18.0
NPM Version
lerna/7.1.5/node@v20.18.0+x64 (linux)
Statistics
25,037 Stars
21,381 Commits
5,265 Forks
270 Watching
33 Branches
610 Contributors
Updated on 27 Nov 2024
Languages
TypeScript (98.11%)
JavaScript (1.67%)
Makefile (0.1%)
HTML (0.09%)
Shell (0.02%)
Total Downloads
Cumulative downloads
Total Downloads
11,464,040
Last day
1.5%
13,638
Compared to previous day
Last week
-0.7%
72,116
Compared to previous week
Last month
10%
306,173
Compared to previous month
Last year
10.7%
3,157,199
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
3
react-admin
A frontend Framework for building single-page applications running in the browser on top of REST/GraphQL APIs, using TypeScript, React and Material Design. Open sourced and maintained by marmelab.
Home page - Documentation - Examples - Blog - Releases - Support
Features
-
🔌 Backend Agnostic: Connects to any API (REST or GraphQL, see the list of more than 45 adapters)
-
🧩 All The Building Blocks You Need: Provides hooks and components for authentication, routing, forms & validation, datagrid, search & filter, relationships, validation, roles & permissions, rich text editor, i18n, notifications, menus, theming, caching, etc.
-
🪡 High Quality: Accessibility, responsive, secure, fast, testable
-
💻 Great Developer Experience: Complete documentation, IDE autocompletion, type safety, storybook, demo apps with source code, modular architecture, declarative API
-
👑 Great User Experience: Optimistic rendering, filter-as-you-type, undo, preferences, saved queries
-
🛠 Complete Customization: Replace any component with your own
-
☂️ Opt-In Types: Develop either in TypeScript or JavaScript
-
👨👩👧👦 Powered by Material UI, react-hook-form, react-router, react-query, TypeScript and a few more
Installation
React-admin is available from npm. You can install it (and its required dependencies) using:
1npm install react-admin 2#or 3yarn add react-admin
Documentation
- Read the Tutorial for a 30 minutes introduction
- Watch the YouTube video tutorials
- Head to the Documentation for a complete API reference
- Checkout the source code of the examples (e-commerce, CRM, blog, media player)
At a Glance
1// in app.js 2import * as React from "react"; 3import { render } from 'react-dom'; 4import { Admin, Resource } from 'react-admin'; 5import restProvider from 'ra-data-simple-rest'; 6 7import { PostList, PostEdit, PostCreate, PostIcon } from './posts'; 8 9render( 10 <Admin dataProvider={restProvider('http://localhost:3000')}> 11 <Resource name="posts" list={PostList} edit={PostEdit} create={PostCreate} icon={PostIcon} /> 12 </Admin>, 13 document.getElementById('root') 14);
The <Resource>
component is a configuration component that allows you to define sub components for each of the admin view: list
, edit
, and create
. These components use Material UI and custom components from react-admin:
1// in posts.js 2import * as React from "react"; 3import { List, Datagrid, Edit, Create, SimpleForm, DateField, TextField, EditButton, TextInput, DateInput, useRecordContext } from 'react-admin'; 4import BookIcon from '@mui/icons-material/Book'; 5export const PostIcon = BookIcon; 6 7export const PostList = () => ( 8 <List> 9 <Datagrid> 10 <TextField source="id" /> 11 <TextField source="title" /> 12 <DateField source="published_at" /> 13 <TextField source="average_note" /> 14 <TextField source="views" /> 15 <EditButton /> 16 </Datagrid> 17 </List> 18); 19 20const PostTitle = () => { 21 const record = useRecordContext(); 22 return <span>Post {record ? `"${record.title}"` : ''}</span>; 23}; 24 25export const PostEdit = () => ( 26 <Edit title={<PostTitle />}> 27 <SimpleForm> 28 <TextInput disabled source="id" /> 29 <TextInput source="title" /> 30 <TextInput source="teaser" options={{ multiline: true }} /> 31 <TextInput multiline source="body" /> 32 <DateInput label="Publication date" source="published_at" /> 33 <TextInput source="average_note" /> 34 <TextInput disabled label="Nb views" source="views" /> 35 </SimpleForm> 36 </Edit> 37); 38 39export const PostCreate = () => ( 40 <Create title="Create a Post"> 41 <SimpleForm> 42 <TextInput source="title" /> 43 <TextInput source="teaser" options={{ multiline: true }} /> 44 <TextInput multiline source="body" /> 45 <TextInput label="Publication date" source="published_at" /> 46 <TextInput source="average_note" /> 47 </SimpleForm> 48 </Create> 49);
Does It Work With My API?
Yes.
React-admin uses an adapter approach, with a concept called Data Providers. Existing providers can be used as a blueprint to design your API, or you can write your own Data Provider to query an existing API. Writing a custom Data Provider is a matter of hours.
See the Data Providers documentation for details.
Batteries Included But Removable
React-admin is designed as a library of loosely coupled React components and hooks exposing reusable controller logic. It is very easy to replace any part of react-admin with your own, e.g. using a custom datagrid, GraphQL instead of REST, or Bootstrap instead of Material Design.
Examples
There are several examples inside the examples
folder:
simple
(StackBlitz): a simple blog with posts, comments and users that we use for our e2e tests.e-commerce
: (demo, source) A fictional poster shop admin, serving as the official react-admin demo.CRM
: (demo, source) A customer relationship management applicationhelpdesk
: (demo, source) A ticketing application with realtime locks and notificationstutorial
(Stackblitz): the application built while following the tutorial.
You can run those example applications by calling:
1# At the react-admin project root 2make install 3# or 4yarn install 5 6# Run the simple application 7make run-simple 8 9# Run the tutorial application 10make build 11make run-tutorial 12 13# Run the demo application 14make build 15make run-demo
And then browse to the URL displayed in your console.
Support
- Get commercial support from Marmelab via React-Admin Enterprise Edition
- Get community support via Discord and StackOverflow.
Versions In This Repository
-
master - commits that will be included in the next patch release
-
next - commits that will be included in the next major or minor release
Bugfix PRs that don't break BC should be made against master. All other PRs (new features, BC breaking bugfixes) should be made against next.
Contributing
If you want to give a hand: Thank you! There are many things you can do to help making react-admin better.
The easiest task is bug triaging. Check that new issues on GitHub follow the issue template and give a way to reproduce the issue. If not, comment on the issue to ask precisions. Then, try and reproduce the issue following the description. If you managed to reproduce the issue, add a comment to say it. Otherwise, add a comment to say that something is missing.
The second way to contribute is to answer support questions on StackOverflow. There are many beginner questions there, so even if you're not super experienced with react-admin, there is someone you can help there.
Pull requests for bug fixes are welcome on the GitHub repository. There is always a bunch of issues labeled "Good First Issue" in the bug tracker—start with these.
If you want to add a feature, you can open a Pull request on the next
branch. We don't accept all features—we try to keep the react-admin code small and manageable. Try and see if your feature can't be built as an additional npm
package. If you're in doubt, open a "Feature Request" issue to see if the core team would accept your feature before developing it.
For all Pull requests, you must follow the coding style of the existing files (based on prettier), and include unit tests and documentation. Be prepared for a thorough code review, and be patient for the merge—this is an open-source initiative.
Tip: Most of the commands used by the react-admin developers are automated in the makefile
. Feel free to type make
without argument to see a list of the available commands.
Setup
Clone this repository and run make install
to grab the dependencies, then make build
to compile the sources from TypeScript to JS.
Testing Your Changes In The Example Apps
When developing, most of the time we use the simple example to do visual check. It's the same application that we use in Stackblitz to reproduce errors (see https://stackblitz.com/github/marmelab/react-admin/tree/master/examples/simple). The source is located under examples/simple/
. Call make run
to launch that example on port 8080 (http://localhost:8080). This command includes a watch
on the react-admin source, so any of the changes you make to the react-admin packages triggers a live update of the simple example in your browser.
However, the simple example is sometimes too limited. You can use the demo example (the source for https://marmelab.com/react-admin-demo/), which is more complete. The source is located under examples/demo/
. Call make run-demo
to launch the demo example with a REST dataProvider, or make run-graphql-demo
to run it with a GraphQL dataProvider. Unfortunately, due to the fact that we use Create React App for this demo, these commands don't watch the changes made in the packages. You'll have to rebuild the react-admin packages after a change (using make build
, or the more targeted make build-ra-core
, make build-ra-ui-materialui
, etc.) to see the effect in the demo app.
Both of these examples work without server—the API is simulated on the client-side.
Testing Your Changes In Your App
Using yarn link
, you can have your project use a local checkout of the react-admin package instead of downloading from npm. This allows you to test react-admin changes in your app.
The following instructions are targeting yarn >= v3 in the client app.
1# Go to the folder of your client app 2$ cd /code/path/to/myapp/ 3 4# Use the latest version of yarn package manager 5$ corepack enable && yarn set version stable 6 7# Replace the npm-installed version with a symlink to your local version 8$ yarn link /code/path/to/react-admin/packages/react-admin 9 10# If you modified additional internal packages in the react-admin monorepo, e.g. ra-core, also make a link 11$ yarn link /code/path/to/react-admin/packages/ra-core 12 13# Build all of the react-admin package distribution 14$ cd /code/path/to/react-admin/ && make build 15 16# Return to your app and ensure all dependencies have resolved 17$ cd /code/path/to/myapp/ && yarn install 18 19# Start your app 20$ yarn start
Tip: If you are still using yarn v1 as your package manager in your client app, we strongly recommend you to update as it is frozen and no longer maintained.
Automated Tests
Automated tests are also crucial in our development process. You can run all the tests (linting, unit and functional tests) by calling:
1make test
Unit tests use jest
, so you should be able to run a subset of tests, or run tests continuously on change, by passing options to
1yarn jest
Besides, tests related to the modified files are run automatically at commit using a git pre-commit hook. This means you won't be able to commit your changes if they break the tests.
When working on the end-to-end tests, you can leverage cypress runner by starting the simple example yourself (make run-simple
or yarn run-simple
) and starting cypress in another terminal (make test-e2e-local
or yarn test-e2e-local
).
Coding Standards
If you have coding standards problems, you can fix them automatically using prettier
by calling
1make prettier
However, these commands are run automatically at each commit so you shouldn't have to worry about them.
Documentation
If you want to contribute to the documentation, install jekyll, then call
1make doc
And then browse to http://localhost:4000/
License
React-admin is licensed under the MIT License, sponsored and supported by marmelab.
Donate
This library is free to use, even for commercial purpose. If you want to give back, please talk about it, help newcomers, or contribute code. But the best way to give back is to donate to a charity. We recommend Doctors Without Borders.
No vulnerabilities found.
Reason
30 commit(s) and 19 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
no binaries found in the repo
Reason
SAST tool is run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Info: all commits (23) are checked with a SAST tool
Reason
Found 8/15 approved changesets -- score normalized to 5
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/test.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:73: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:111: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:118: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:132: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:170: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:174: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:181: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:190: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:201: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:203: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:224: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:226: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:52: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:90: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:144: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:146: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:153: update your workflow using https://app.stepsecurity.io/secureworkflow/marmelab/react-admin/test.yml/master?enable=pin
- Info: 0 out of 29 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
Reason
12 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-36jr-mh4h-2g58
- Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-4wx3-54gh-9fr9
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-5jcr-82fh-339v
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4
Score
4.5
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to ra-i18n-polyglot
node-polyglot
Give your JavaScript the ability to speak many languages.
ra-language-english
English messages for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services
react-polyglot
Higher order React component for using Polyglot
ra-language-french
French messages for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services