| layout | default |
|---|---|
| title | The create-react-admin CLI |
Use create-react-admin to quickly bootstrap a react-admin project using Vite. It's the preferred way to create a new react-admin application.
npx create-react-admin@latest your-admin-nameThis will create an empty react-admin application in a directory called your-admin-name, powered by Vite.js, and install the dependencies.
You can run the app with:
cd your-admin-name
npm run devTip: You can replace npx with npm, yarn or bun:
# Using npx
npx create-react-admin@latest your-admin-name
# Using npm
npm create react-admin@latest your-admin-name
# Using yarn
yarn create react-admin your-admin-name
# Using bun
bun create react-admin@latest your-admin-nameTip: If you need to pass extra options, depending on the command you choose you may need to add -- before the arguments:
# `npx` doesn't require the `--` before the arguments
npx create-react-admin@latest your-admin-name --interactive
# `npm create` does require the `--` before the arguments
npm create react-admin@latest your-admin-name -- --interactiveThe command accepts the following options:
--interactive: Enable the CLI interactive mode--data-provider: Set the data provider to use ("data-fakerest", "data-simple-rest", "data-json-server", "supabase" or "none")--auth-provider: Set the auth provider to use ("local-auth-provider" or "none")--resource: Add a resource that will be initialized with guessers (can be used multiple times). Set to "skip" to bypass the interactive resource step.--install: Set the package manager to use for installing dependencies ("yarn", "npm", "bun" or "skip" to bypass the interactive install step)
When using this option, the terminal will ask you to choose:
- a data provider
- an auth provider
- the names of the resources to add
- the package manager to use to install the dependencies
create-react-admin currently supports five presets for the application's data provider:
fakerest: A client-side data provider that use a JSON object for data, powered by FakeRest.json-server: A data provider based on the JSON Server APIsimple-rest: A data provider for simple REST APIssupabase: A data provider for Supabase. The auth-provider and resources steps will be skipped.none(default): To configure the data provider yourself
You can set your data provider directly with the --data-provider option:
npx create-react-admin@latest your-admin-name --data-provider json-servercreate-react-admin currently supports two presets to set the application's auth provider which are:
local-auth-provider: Hard coded username/password.none(default): No authProvider.
You can set your auth provider directly with the --auth-provider option:
npx create-react-admin@latest your-admin-name --auth-provider local-auth-providercreate-react-admin creates an empty app by default. You can initialize CRUD pages for some resources with the --resource option:
npx create-react-admin@latest your-admin-name --resource posts --resource commentsWarning: the --resource flag is incompatible with a --data-provider supabase due to a specific <AdminGuesser> component from ra-supabase.
create-react-admin can install dependencies using any of the following package managers:
npm(default)yarnbunpnpmnone(if you want to install dependencies yourself)
You choose an alternative package manager with the --install option:
npx create-react-admin@latest your-admin-name --install bun