├── .npmrc
├── src
├── vite-env.d.ts
├── pages
│ ├── register
│ │ └── index.tsx
│ ├── forgotPassword
│ │ └── index.tsx
│ └── login
│ │ └── index.tsx
├── index.tsx
├── providers
│ └── data
│ │ ├── index.tsx
│ │ └── fetch-wrapper.ts
└── App.tsx
├── public
└── favicon.ico
├── vite.config.ts
├── tsconfig.node.json
├── .gitignore
├── .eslintrc.cjs
├── tsconfig.json
├── Dockerfile
├── index.html
├── package.json
└── README.MD
/.npmrc:
--------------------------------------------------------------------------------
1 | legacy-peer-deps=true
2 | strict-peer-dependencies=false
--------------------------------------------------------------------------------
/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vishalparmarr/Master-Admin-Dashboard/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/pages/register/index.tsx:
--------------------------------------------------------------------------------
1 | import { AuthPage } from "@refinedev/antd";
2 |
3 | export const Register = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import react from "@vitejs/plugin-react";
2 | import { defineConfig } from "vite";
3 |
4 | export default defineConfig({
5 | plugins: [react()],
6 | });
7 |
--------------------------------------------------------------------------------
/src/pages/forgotPassword/index.tsx:
--------------------------------------------------------------------------------
1 | import { AuthPage } from "@refinedev/antd";
2 |
3 | export const ForgotPassword = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "module": "ESNext",
5 | "moduleResolution": "node"
6 | },
7 | "include": ["vite.config.ts"]
8 | }
9 |
--------------------------------------------------------------------------------
/src/pages/login/index.tsx:
--------------------------------------------------------------------------------
1 | import { AuthPage } from "@refinedev/antd";
2 |
3 | export const Login = () => {
4 | return (
5 |
11 | );
12 | };
13 |
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { createRoot } from "react-dom/client";
3 |
4 | import App from "./App";
5 |
6 | const container = document.getElementById("root") as HTMLElement;
7 | const root = createRoot(container);
8 |
9 | root.render(
10 |
11 |
12 |
13 | );
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
--------------------------------------------------------------------------------
/src/providers/data/index.tsx:
--------------------------------------------------------------------------------
1 | import { GraphQLClient } from "@refinedev/nestjs-query";
2 | export const API_URL = "https://api.crm.refine.dev";
3 |
4 | export const client = new GraphQLClient(API_URL, {
5 | fetch: (url: string, options: RequestInit) => {
6 | try {
7 | return fetchWrapper(url, options);
8 | }
9 | catch (error) {
10 | return Promise.reject(error as Error);
11 | }
12 | }
13 | })
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 |
3 | module.exports = {
4 | env: { browser: true, es2020: true },
5 | extends: [
6 | "eslint:recommended",
7 | "plugin:@typescript-eslint/recommended",
8 | "plugin:react-hooks/recommended",
9 | ],
10 | parser: "@typescript-eslint/parser",
11 | parserOptions: { ecmaVersion: "latest", sourceType: "module" },
12 | plugins: ["react-refresh"],
13 | rules: {
14 | "react-refresh/only-export-components": "warn",
15 | },
16 | };
17 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "lib": ["DOM", "DOM.Iterable", "ESNext"],
6 | "allowJs": false,
7 | "skipLibCheck": true,
8 | "esModuleInterop": false,
9 | "allowSyntheticDefaultImports": true,
10 | "strict": true,
11 | "forceConsistentCasingInFileNames": true,
12 | "module": "ESNext",
13 | "moduleResolution": "Node",
14 | "resolveJsonModule": true,
15 | "isolatedModules": true,
16 | "noEmit": true,
17 | "jsx": "react-jsx"
18 | },
19 | "include": ["src", "vite.config.ts"],
20 | "references": [
21 | {
22 | "path": "./tsconfig.node.json"
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # This Dockerfile uses `serve` npm package to serve the static files with node process.
2 | # You can find the Dockerfile for nginx in the following link:
3 | # https://github.com/refinedev/dockerfiles/blob/main/vite/Dockerfile.nginx
4 | FROM refinedev/node:18 AS base
5 |
6 | FROM base as deps
7 |
8 | COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
9 |
10 | RUN \
11 | if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
12 | elif [ -f package-lock.json ]; then npm ci; \
13 | elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
14 | else echo "Lockfile not found." && exit 1; \
15 | fi
16 |
17 | FROM base as builder
18 |
19 | ENV NODE_ENV production
20 |
21 | COPY --from=deps /app/refine/node_modules ./node_modules
22 |
23 | COPY . .
24 |
25 | RUN npm run build
26 |
27 | FROM base as runner
28 |
29 | ENV NODE_ENV production
30 |
31 | RUN npm install -g serve
32 |
33 | COPY --from=builder /app/refine/dist ./
34 |
35 | USER refine
36 |
37 | CMD ["serve"]
38 |
--------------------------------------------------------------------------------
/src/providers/data/fetch-wrapper.ts:
--------------------------------------------------------------------------------
1 | import { GraphQLFormattedError } from "graphql";
2 |
3 | type Error = {
4 | message: string;
5 | statusCode: string;
6 | }
7 |
8 | const customFetch = async (url: string, options: RequestInit) => {
9 | const accessToken = localStorage.getItem('access_token');
10 |
11 | const headers = options.headers as Record;
12 |
13 | return await fetch(url, {
14 | ...options,
15 | headers: {
16 | ...headers,
17 | Authorization: headers?.Authorization || `Bearer ${accessToken}`,
18 | "Content-Type": "application/json",
19 | "Appolo-Require-Preflight": "true",
20 | }
21 | })
22 | }
23 |
24 | const getGraphqlErrors = (body: Record<"errors", GraphQLFormattedError[] | undefined>): Error | null => {
25 |
26 | if(!body) {
27 | return {
28 | message: 'Unknown error',
29 | statusCode: "INTERNAL_SERVER_ERROR"
30 | }
31 | }
32 |
33 | if("errors" in body) {
34 | const errors = body?.errors;
35 |
36 | const messages = errors?.map((error) => error?.message)?.join("");
37 | const code = errors?.[0]?.extensions?.code;
38 |
39 | return {
40 | message: messages || JSON.stringify(errors),
41 | statusCode: code || 500
42 | }
43 | }
44 | return null;
45 | }
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
17 |
22 |
23 | refine - Build your React-based CRUD applications, without constraints.
24 |
25 |
26 |
27 |
28 |
29 |
30 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Master-Admin-Dashboard",
3 | "version": "0.1.0",
4 | "private": true,
5 | "type": "module",
6 | "dependencies": {
7 | "@refinedev/cli": "^2.16.21",
8 | "@refinedev/core": "^4.46.1",
9 | "@refinedev/devtools": "^1.1.29",
10 | "@refinedev/inferencer": "^4.5.16",
11 | "@refinedev/kbar": "^1.3.5",
12 | "react": "^18.0.0",
13 | "react-dom": "^18.0.0",
14 | "react-router-dom": "^6.8.1",
15 | "@refinedev/nestjs-query": "^1.1.1",
16 | "@refinedev/antd": "^5.37.1",
17 | "antd": "^5.0.5",
18 | "@ant-design/icons": "^5.0.1",
19 | "@refinedev/react-router-v6": "^4.5.5"
20 | },
21 | "devDependencies": {
22 | "@types/node": "^18.16.2",
23 | "@types/react": "^18.0.0",
24 | "@types/react-dom": "^18.0.0",
25 | "@typescript-eslint/eslint-plugin": "^5.57.1",
26 | "@typescript-eslint/parser": "^5.57.1",
27 | "@vitejs/plugin-react": "^4.0.0",
28 | "eslint": "^8.38.0",
29 | "eslint-plugin-react-hooks": "^4.6.0",
30 | "eslint-plugin-react-refresh": "^0.3.4",
31 | "typescript": "^4.7.4",
32 | "vite": "^4.3.1"
33 | },
34 | "scripts": {
35 | "dev": "refine dev --host --port 5173",
36 | "build": "tsc && refine build",
37 | "preview": "refine start",
38 | "refine": "refine"
39 | },
40 | "browserslist": {
41 | "production": [
42 | ">0.2%",
43 | "not dead",
44 | "not op_mini all"
45 | ],
46 | "development": [
47 | "last 1 chrome version",
48 | "last 1 firefox version",
49 | "last 1 safari version"
50 | ]
51 | },
52 | "refine": {
53 | "projectId": "7Ll3vD-qj821C-glgt4v"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/App.tsx:
--------------------------------------------------------------------------------
1 | import { GitHubBanner, Refine, WelcomePage } from "@refinedev/core";
2 | import { DevtoolsPanel, DevtoolsProvider } from "@refinedev/devtools";
3 | import { RefineKbar, RefineKbarProvider } from "@refinedev/kbar";
4 |
5 | import { useNotificationProvider } from "@refinedev/antd";
6 | import "@refinedev/antd/dist/reset.css";
7 |
8 | import dataProvider, {
9 | GraphQLClient,
10 | liveProvider,
11 | } from "@refinedev/nestjs-query";
12 | import routerBindings, {
13 | DocumentTitleHandler,
14 | UnsavedChangesNotifier,
15 | } from "@refinedev/react-router-v6";
16 | import { App as AntdApp } from "antd";
17 | import { BrowserRouter, Route, Routes } from "react-router-dom";
18 |
19 | function App() {
20 | return (
21 |
22 |
23 |
24 |
25 |
39 |
40 | } />
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | );
51 | }
52 | export default App;
53 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | # Master Admin Dashboard
2 |
3 |
8 |
9 | This [Refine](https://github.com/refinedev/refine) project was generated with [create refine-app](https://github.com/refinedev/refine/tree/master/packages/create-refine-app).
10 |
11 | ## Getting Started
12 |
13 | A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility ✨
14 |
15 | Refine's hooks and components simplifies the development process and eliminates the repetitive tasks by providing industry-standard solutions for crucial aspects of a project, including authentication, access control, routing, networking, state management, and i18n.
16 |
17 | ## Available Scripts
18 |
19 | ### Running the development server
20 |
21 | ```bash
22 | npm run dev
23 | ```
24 |
25 | ### Building for production
26 |
27 | ```bash
28 | npm run build
29 | ```
30 |
31 | ### Running the production server
32 |
33 | ```bash
34 | npm run start
35 | ```
36 |
37 | ## Learn More
38 |
39 | To learn more about **Refine**, please check out the [Documentation](https://refine.dev/docs)
40 |
41 | - **Vite** (Project Template) [Docs](https://vitejs.dev)
42 | - **NestJS Query Data Provider** (Backend Service) [Docs](https://refine.dev/docs/core/providers/data-provider/#overview)
43 | - **Ant Design** (UI Framework) [Docs](https://refine.dev/docs/ui-frameworks/antd/tutorial/)
44 | - **React Router** [Docs](https://refine.dev/docs/core/providers/router-provider/)
45 | - **Custom Auth Provider** (Authentication Logic) [Docs](https://refine.dev/docs/core/providers/auth-provider/)
46 |
47 | ## License
48 |
49 | MIT
50 |
51 | ## Commands used in this projects :-
52 |
53 | ### Create Application using Refine
54 |
55 | ``` bash
56 | npm create refine-app@latest
57 | ```
58 |
59 | ### Install dependencies
60 |
61 | ``` bash
62 | npm install
63 | ```
64 |
--------------------------------------------------------------------------------