rare-sapphire
rare-sapphire4w ago

Refine projects

Hi, i just discover Refine, and i really want to use it to make my dashboard, but i already a "vanilla" dashboard with only a different route in my client(front) vite app. If i start a Refine dashboard, how can i plug it to my client in order to only have 2 node server running instead of 3 (backend, dashboard and front)
2 Replies
kapa.ai
kapa.ai4w ago
Hi @Hugo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To integrate a Refine dashboard into your existing Vite client application and ensure you only have two Node servers running (one for the backend and one for the combined front-end and dashboard), you can follow these steps: 1. Create a Refine Application: First, create a new Refine application using the create refine-app command. This will generate the necessary boilerplate for your Refine dashboard.
npm create refine-app@latest -- -o refine-antd refine-react-admin-dashboard

npm create refine-app@latest -- -o refine-antd refine-react-admin-dashboard

This command sets up a Refine project using Ant Design. You can choose other UI frameworks if needed. 2. Merge Refine into Your Existing Vite Project: After creating the Refine application, you need to merge it into your existing Vite project. This involves copying the relevant parts of the Refine project into your existing project. - Copy Components and Pages: Move the components and pages from the Refine project to your existing Vite project. - Update Routes: Integrate the Refine routes into your existing routing setup. You can add a new route for the dashboard in your existing App.tsx or index.tsx file. Here is an example of how you might integrate the Refine routes:
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { Refine, WelcomePage } from "@refinedev/core";
import { dataProvider, liveProvider } from "@refinedev/supabase";
import { supabaseClient } from "./utility";
import authProvider from "./authProvider";
import { ColorModeContextProvider } from "./contexts/color-mode";
import { useNotificationProvider } from "@refinedev/antd";
import "@refinedev/antd/dist/reset.css";
function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<YourExistingHomePage />} />
<Route path="/dashboard/*" element={
<Refine
dataProvider={dataProvider(supabaseClient)}
liveProvider={liveProvider(supabaseClient)}
authProvider={authProvider}
notificationProvider={useNotificationProvider}
options={{
syncWithLocation: true,
warnWhenUnsavedChanges: true,
}}
>
<Routes>
<Route index element={<WelcomePage />} />
{/* Add other Refine routes here */}
</Routes>
</Refine>
} />
</Routes>
</BrowserRouter>
);
}

export default App;

import { BrowserRouter, Route, Routes } from "react-router-dom";
import { Refine, WelcomePage } from "@refinedev/core";
import { dataProvider, liveProvider } from "@refinedev/supabase";
import { supabaseClient } from "./utility";
import authProvider from "./authProvider";
import { ColorModeContextProvider } from "./contexts/color-mode";
import { useNotificationProvider } from "@refinedev/antd";
import "@refinedev/antd/dist/reset.css";
function App() {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<YourExistingHomePage />} />
<Route path="/dashboard/*" element={
<Refine
dataProvider={dataProvider(supabaseClient)}
liveProvider={liveProvider(supabaseClient)}
authProvider={authProvider}
notificationProvider={useNotificationProvider}
options={{
syncWithLocation: true,
warnWhenUnsavedChanges: true,
}}
>
<Routes>
<Route index element={<WelcomePage />} />
{/* Add other Refine routes here */}
</Routes>
</Refine>
} />
</Routes>
</BrowserRouter>
);
}

export default App;

3. Run the Combined Application: With the Refine routes integrated into your existing Vite project, you can now run your combined application using a single Vite development server.
npm run dev

npm run dev

This will start your Vite server, and you should be able to access both your existing application and the Refine dashboard through different routes. By following these steps, you can integrate a Refine dashboard into your existing Vite project, ensuring you only need to run two Node servers: one for your backend and one for your combined front-end and dashboard. For more detailed information, you can refer to the Refine documentation (https://refine.dev/docs) and the Refine blog (https://refine.dev/blog) for additional guidance and examples. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4w ago
<@122807566475591680> kapa.ai is still learning and improving, please let us know how it did by reacting below