3. Creating your refine project
Launch the refine CLI setupβ
The easiest way to create a new project is using the refine CLI. This tool will help you get started quickly by generating a new project with a basic configuration and a folder structure that follows best practices.
Launch your terminal and type the following command using your preferred package manager:
- npm
- pnpm
- yarn
npm create refine-app@latest -- -o refine-headless tutorial
pnpm create refine-app@latest -- -o refine-headless tutorial
yarn create refine-app -- -o refine-headless tutorial
Only supports yarn@1 version.
Confirm
y
to installation ofcreate-refine-app
The
-o refine-headless
flag in the command above tells the CLI to install the project with therefine-headless
preset. This preset selects some of the options for you in accordance with this tutorial. Outside of this tutorial, you can skip this flag and select your own options.The CLI will then ask if you agree to share your selection anonymously with the refine team. This is for measuring community preferences. You can learn more about it here: Telemetry.
Once the installation wizard is finished, you can close this terminal window and open VS Code to continue your journey.
Open your project in VS Codeβ
Open VS Code and select the directory that was generated during your setup process.
Make sure the terminal is open and ready to run commands. You can open it by pressing
Ctrl + J
(Windows) orCmd β + J
(macOS).
For the rest of this tutorial, you can use the terminal within VS Code instead of your computer's terminal.
Running the dev serverβ
Previewing your project while you work on it is important. To open it as a webpage, the project must be running in development(dev) mode.
Start the dev server
To start the dev server, run the following command in your terminal:
- npm
- pnpm
- yarn
npm run dev
pnpm run dev
yarn run dev
You should see confirmation in the terminal that the refine app is running in dev mode.
Viewing a preview of your appβ
Your project files contain all the code you need to run your app. To see a preview of your app in the browser:
Click on the localhost:3000 link in the terminal. This will open a new browser tab with your app running in dev mode.
You will be redirected to the welcome page as we have not added any pages yet. We will take care of that in the Next section
Here's what you should see: