You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CreateReactAdmin.md
+40-71Lines changed: 40 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,45 +5,38 @@ title: "The create-react-admin CLI"
5
5
6
6
# `create-react-admin`
7
7
8
-
`create-react-admin`is a package that generates a react-admin app scaffolding using [Vite](https://vitejs.dev/). It is designed to work on most setups and produces predictable and consistent results. It's the preferred way to create a new react-admin application.
8
+
Use `create-react-admin`to quickly bootstrap a react-admin project using [Vite](https://vitejs.dev/). It's the preferred way to create a new react-admin application.
This will create an empty react-admin application in a directory called `your-admin-name`.
23
19
24
-
```sh
25
-
npx create-react-admin@latest your-admin-name
26
-
```
20
+
**Tip**: You can replace `npx` with `npm`, `yarn`, or `bun`
27
21
28
-
<div><i>With Yarn</i></div>
22
+
## Options
29
23
30
-
```sh
31
-
yarn create react-admin your-admin-name
32
-
```
24
+
The command accepts the following options:
33
25
34
-
<div><i>With Bun</i></div>
26
+
*`--interactive`: Enable the CLI interactive mode
27
+
*`--data-provider`: Set the data provider to use ("data-fakerest", "data-simple-rest", "data-json-server", "supabase" or "none")
28
+
*`--auth-provider`: Set the auth provider to use ("local-auth-provider" or "none")
29
+
*`--resource`: Add a resource that will be initialized with guessers (can be used multiple times). Set to "skip" to bypass the interactive resource step.
30
+
*`--install`: Set the package manager to use for installing dependencies ("yarn", "npm", "bun" or "skip" to bypass the interactive install step)
35
31
36
-
```sh
37
-
bun create react-admin your-admin-name
38
-
```
32
+
## `--interactive`
39
33
40
-
It will choose every option for you and create your new React-Admin application.
41
-
To select them, you can use the `--interactive` flag and the terminal will then ask you to choose:
34
+
When using this option, the terminal will ask you to choose:
42
35
43
-
- a [data provider](#data-provider)
44
-
- an [auth provider](#auth-provider)
45
-
- the names of the [resources](#resources) to add
46
-
- the [package manager](#package-manager) to use to install the dependencies
36
+
* a [data provider](#data-provider)
37
+
* an [auth provider](#auth-provider)
38
+
* the names of the [resources](#resources) to add
39
+
* the [package manager](#package-manager) to use to install the dependencies
`create-react-admin` currently supports five templates presets to set the application's data provider which are:
61
+
`create-react-admin` currently supports five presets for the application's data provider:
69
62
70
-
-**Fakerest:** A client-side, in-memory data provider that use a JSON object as its initial data.
71
-
-**JSON Server:** A data provider based on the JSON Server API (<https://github.com/typicode/json-server>)
72
-
-**Simple REST:** A Simple REST data provider (<https://github.com/marmelab/react-admin/tree/master/packages/ra-data-simple-rest>)
73
-
-**Supabase:** Generate an application using ra-supabase. The auth-provider and resources steps will be skipped.
74
-
-**None:** You'll configure the data provider myself.
63
+
*`fakerest`: A client-sidedata provider that use a JSON object for data, powered by [FakeRest](https://github.com/marmelab/FakeRest).
64
+
*`json-server`: A data provider based on the [JSON Server](https://github.com/typicode/json-server) API
65
+
*`simple-rest`: A data provider for [simple REST APIs](https://github.com/marmelab/react-admin/tree/master/packages/ra-data-simple-rest)
66
+
*`supabase`: A data provider for [Supabase](https://github.com/marmelab/ra-supabase/tree/main/packages/ra-supabase). The auth-provider and resources steps will be skipped.
67
+
*`none` (default): You'll configure the data provider myself.
75
68
76
69
You can set your data provider directly with the `--data-provider` option:
`create-react-admin`doesn't provide any resource by default. You can add some on `--interactive` mode or you can set your resources with the `--resource` option:
90
+
`create-react-admin`creates an empty app by default. You can initialize CRUD pages for some resources with the `--resource` option:
bun create react-admin your-admin-name --resource posts --resource comments
119
94
```
120
95
121
96
**Warning:** the `--resource` flag is incompatible with a `--data-provider supabase` due to a specific [`<AdminGuesser>` component](https://github.com/marmelab/ra-supabase/tree/main/packages/ra-supabase#usage) from `ra-supabase`.
122
97
123
-
## Package Manager
98
+
## `--install`
124
99
125
-
`create-react-admin`currently supports the following options for package managers:
100
+
`create-react-admin`can install dependencies using any of the following package managers:
126
101
127
-
-**npm**
128
-
-**yarn**
129
-
-**bun**
130
-
-**Don't install dependencies**, you'll do it myself.
102
+
*`npm` (default)
103
+
*`yarn`
104
+
*`bun`
105
+
*`none` (if you want to install dependencies yourself)
131
106
132
-
You can set your package manager with the `--install` option:
107
+
You choose an alternative package manager with the `--install` option:
0 commit comments