create-fe-boilerplate 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/package.json +1 -1
  2. package/templates/react/js/scss/axios/README.md +73 -0
  3. package/templates/react/js/scss/axios/eslint.config.js +23 -0
  4. package/templates/react/js/scss/axios/index.html +13 -0
  5. package/templates/react/js/scss/axios/package-lock.json +4517 -0
  6. package/templates/react/js/scss/axios/package.json +35 -0
  7. package/templates/react/js/scss/axios/public/vite.svg +1 -0
  8. package/templates/react/js/scss/axios/react-ts-tailwind-axios/.env.example +1 -0
  9. package/templates/react/js/scss/axios/src/App.css +0 -0
  10. package/templates/react/js/scss/axios/src/App.jsx +14 -0
  11. package/templates/react/js/scss/axios/src/api/axios.js +201 -0
  12. package/templates/react/js/scss/axios/src/component/auth/VerifyOtpModal.jsx +60 -0
  13. package/templates/react/js/scss/axios/src/component/common/ui/Toast/Toast.js +58 -0
  14. package/templates/react/js/scss/axios/src/contants/constants.js +45 -0
  15. package/templates/react/js/scss/axios/src/index.css +4 -0
  16. package/templates/react/js/scss/axios/src/main.jsx +12 -0
  17. package/templates/react/js/scss/axios/src/pages/Auth.scss +203 -0
  18. package/templates/react/js/scss/axios/src/pages/Dashboard.jsx +10 -0
  19. package/templates/react/js/scss/axios/src/pages/Login.jsx +69 -0
  20. package/templates/react/js/scss/axios/src/pages/Signup.jsx +74 -0
  21. package/templates/react/js/scss/axios/src/router/AppRoutes.jsx +19 -0
  22. package/templates/react/js/scss/axios/src/styles/global.scss +5 -0
  23. package/templates/react/js/scss/axios/src/utils/utils.js +58 -0
  24. package/templates/react/js/scss/axios/tsconfig.app.json +28 -0
  25. package/templates/react/js/scss/axios/vite.config.js +7 -0
  26. package/templates/react/js/scss/rtk/README.md +73 -0
  27. package/templates/react/js/scss/rtk/eslint.config.js +23 -0
  28. package/templates/react/js/scss/rtk/index.html +13 -0
  29. package/templates/react/js/scss/rtk/package-lock.json +4208 -0
  30. package/templates/react/js/scss/rtk/package.json +35 -0
  31. package/templates/react/js/scss/rtk/public/vite.svg +1 -0
  32. package/templates/react/js/scss/rtk/react-ts-tailwind-axios/.env.example +1 -0
  33. package/templates/react/js/scss/rtk/src/App.css +0 -0
  34. package/templates/react/js/scss/rtk/src/App.jsx +14 -0
  35. package/templates/react/js/scss/rtk/src/api/axios.js +201 -0
  36. package/templates/react/js/scss/rtk/src/component/auth/VerifyOtpModal.jsx +61 -0
  37. package/templates/react/js/scss/rtk/src/component/auth/VerifyOtpModal.scss +62 -0
  38. package/templates/react/js/scss/rtk/src/component/common/ui/Toast/Toast.js +58 -0
  39. package/templates/react/js/scss/rtk/src/contants/constants.js +45 -0
  40. package/templates/react/js/scss/rtk/src/main.jsx +16 -0
  41. package/templates/react/js/scss/rtk/src/pages/Dashboard.jsx +12 -0
  42. package/templates/react/js/scss/rtk/src/pages/Dashboard.scss +13 -0
  43. package/templates/react/js/scss/rtk/src/pages/Login.jsx +75 -0
  44. package/templates/react/js/scss/rtk/src/pages/Login.scss +67 -0
  45. package/templates/react/js/scss/rtk/src/pages/Signup.jsx +73 -0
  46. package/templates/react/js/scss/rtk/src/pages/Signup.scss +66 -0
  47. package/templates/react/js/scss/rtk/src/router/AppRoutes.jsx +19 -0
  48. package/templates/react/js/scss/rtk/src/store/index.js +10 -0
  49. package/templates/react/js/scss/rtk/src/store/services/api.js +34 -0
  50. package/templates/react/js/scss/rtk/src/styles/global.scss +10 -0
  51. package/templates/react/js/scss/rtk/src/utils/utils.js +59 -0
  52. package/templates/react/js/scss/rtk/tsconfig.app.json +28 -0
  53. package/templates/react/js/scss/rtk/vite.config.js +7 -0
  54. package/templates/react/ts/scss/axios/README.md +73 -0
  55. package/templates/react/ts/scss/axios/eslint.config.js +23 -0
  56. package/templates/react/ts/scss/axios/index.html +13 -0
  57. package/templates/react/ts/scss/axios/package-lock.json +4868 -0
  58. package/templates/react/ts/scss/axios/package.json +39 -0
  59. package/templates/react/ts/scss/axios/public/vite.svg +1 -0
  60. package/templates/react/ts/scss/axios/react-ts-tailwind-axios/.env.example +1 -0
  61. package/templates/react/ts/scss/axios/src/App.css +0 -0
  62. package/templates/react/ts/scss/axios/src/App.tsx +14 -0
  63. package/templates/react/ts/scss/axios/src/api/axios.ts +236 -0
  64. package/templates/react/ts/scss/axios/src/component/auth/VerifyOtpModal.tsx +70 -0
  65. package/templates/react/ts/scss/axios/src/component/common/ui/Toast/Toast.ts +58 -0
  66. package/templates/react/ts/scss/axios/src/contants/constants.ts +45 -0
  67. package/templates/react/ts/scss/axios/src/index.css +4 -0
  68. package/templates/react/ts/scss/axios/src/main.tsx +10 -0
  69. package/templates/react/ts/scss/axios/src/pages/Auth.scss +203 -0
  70. package/templates/react/ts/scss/axios/src/pages/Dashboard.tsx +10 -0
  71. package/templates/react/ts/scss/axios/src/pages/Login.tsx +69 -0
  72. package/templates/react/ts/scss/axios/src/pages/Signup.tsx +74 -0
  73. package/templates/react/ts/scss/axios/src/router/AppRoutes.tsx +19 -0
  74. package/templates/react/ts/scss/axios/src/styles/global.scss +5 -0
  75. package/templates/react/ts/scss/axios/src/utils/utils.ts +59 -0
  76. package/templates/react/ts/scss/axios/tsconfig.app.json +28 -0
  77. package/templates/react/ts/scss/axios/tsconfig.json +12 -0
  78. package/templates/react/ts/scss/axios/tsconfig.node.json +26 -0
  79. package/templates/react/ts/scss/axios/vite.config.ts +7 -0
  80. package/templates/react/ts/scss/rtk/README.md +73 -0
  81. package/templates/react/ts/scss/rtk/eslint.config.js +23 -0
  82. package/templates/react/ts/scss/rtk/index.html +13 -0
  83. package/templates/react/ts/scss/rtk/package-lock.json +4218 -0
  84. package/templates/react/ts/scss/rtk/package.json +38 -0
  85. package/templates/react/ts/scss/rtk/public/vite.svg +1 -0
  86. package/templates/react/ts/scss/rtk/react-ts-tailwind-axios/.env.example +1 -0
  87. package/templates/react/ts/scss/rtk/src/App.css +0 -0
  88. package/templates/react/ts/scss/rtk/src/App.tsx +14 -0
  89. package/templates/react/ts/scss/rtk/src/api/axios.ts +236 -0
  90. package/templates/react/ts/scss/rtk/src/component/auth/VerifyOtpModal.scss +62 -0
  91. package/templates/react/ts/scss/rtk/src/component/auth/VerifyOtpModal.tsx +71 -0
  92. package/templates/react/ts/scss/rtk/src/component/common/ui/Toast/Toast.ts +58 -0
  93. package/templates/react/ts/scss/rtk/src/contants/constants.ts +45 -0
  94. package/templates/react/ts/scss/rtk/src/main.tsx +14 -0
  95. package/templates/react/ts/scss/rtk/src/pages/Dashboard.scss +13 -0
  96. package/templates/react/ts/scss/rtk/src/pages/Dashboard.tsx +12 -0
  97. package/templates/react/ts/scss/rtk/src/pages/Login.scss +67 -0
  98. package/templates/react/ts/scss/rtk/src/pages/Login.tsx +75 -0
  99. package/templates/react/ts/scss/rtk/src/pages/Signup.scss +66 -0
  100. package/templates/react/ts/scss/rtk/src/pages/Signup.tsx +73 -0
  101. package/templates/react/ts/scss/rtk/src/router/AppRoutes.tsx +19 -0
  102. package/templates/react/ts/scss/rtk/src/store/index.ts +13 -0
  103. package/templates/react/ts/scss/rtk/src/store/services/api.ts +37 -0
  104. package/templates/react/ts/scss/rtk/src/styles/global.scss +10 -0
  105. package/templates/react/ts/scss/rtk/src/utils/utils.ts +59 -0
  106. package/templates/react/ts/scss/rtk/tsconfig.app.json +28 -0
  107. package/templates/react/ts/scss/rtk/tsconfig.json +12 -0
  108. package/templates/react/ts/scss/rtk/tsconfig.node.json +26 -0
  109. package/templates/react/ts/scss/rtk/vite.config.ts +7 -0
@@ -0,0 +1,69 @@
1
+ import { useState } from "react";
2
+ import { Link, useNavigate } from "react-router-dom";
3
+ import VerifyOtpModal from "../component/auth/VerifyOtpModal";
4
+ import "./Auth.scss";
5
+
6
+ const Login = () => {
7
+ const navigate = useNavigate();
8
+ const [showOtp, setShowOtp] = useState(false);
9
+
10
+ const [form, setForm] = useState({
11
+ email: "",
12
+ password: "",
13
+ });
14
+
15
+ const handleLogin = async () => {
16
+ // const res = await apiCallPost("/auth/login", form, {}, true);
17
+
18
+ // if (res?.success) {
19
+ setShowOtp(true);
20
+ // }
21
+ };
22
+
23
+ const handleOtpSuccess = () => {
24
+ localStorage.setItem("token", "dummy-token");
25
+ navigate("/dashboard");
26
+ };
27
+
28
+ return (
29
+ <div className="login-wrapper">
30
+ <div className="login-card">
31
+ <h2 className="login-title">Login</h2>
32
+
33
+ <input
34
+ className="login-input"
35
+ placeholder="Email"
36
+ value={form.email}
37
+ onChange={(e) => setForm({ ...form, email: e.target.value })}
38
+ />
39
+
40
+ <input
41
+ type="password"
42
+ className="login-input"
43
+ placeholder="Password"
44
+ value={form.password}
45
+ onChange={(e) => setForm({ ...form, password: e.target.value })}
46
+ />
47
+
48
+ <button onClick={handleLogin} className="login-button">
49
+ Login
50
+ </button>
51
+
52
+ <div className="login-footer">
53
+ Dont have an account?{" "}
54
+ <Link to="/signup" className="signup-link">
55
+ Signup
56
+ </Link>
57
+ </div>
58
+ </div>
59
+
60
+ <VerifyOtpModal
61
+ isOpen={showOtp}
62
+ onClose={() => setShowOtp(false)}
63
+ onVerifySuccess={handleOtpSuccess}
64
+ />
65
+ </div>
66
+ );
67
+ };
68
+
69
+ export default Login;
@@ -0,0 +1,74 @@
1
+ import { useState } from "react";
2
+ import { Link, useNavigate } from "react-router-dom";
3
+ import VerifyOtpModal from "../component/auth/VerifyOtpModal";
4
+ import "./Auth.scss";
5
+
6
+ const Signup = () => {
7
+ const navigate = useNavigate();
8
+ const [showOtp, setShowOtp] = useState(false);
9
+
10
+ const [form, setForm] = useState({
11
+ email: "",
12
+ password: "",
13
+ });
14
+
15
+ const handleSignup = async () => {
16
+ // const res = await apiCallPost(
17
+ // "/auth/signup",
18
+ // form,
19
+ // {},
20
+ // true
21
+ // );
22
+
23
+ // if (res?.success) {
24
+ // setRefId(res?.data?.refId || "");
25
+ setShowOtp(true);
26
+ // }
27
+ };
28
+
29
+ const handleOtpSuccess = () => {
30
+ navigate("/login");
31
+ };
32
+
33
+ return (
34
+ <div className="login-wrapper">
35
+ <div className="login-card">
36
+ <h2 className="login-title">Signup</h2>
37
+
38
+ <input
39
+ className="login-input"
40
+ placeholder="Email"
41
+ value={form.email}
42
+ onChange={(e) => setForm({ ...form, email: e.target.value })}
43
+ />
44
+
45
+ <input
46
+ type="password"
47
+ className="login-input"
48
+ placeholder="Password"
49
+ value={form.password}
50
+ onChange={(e) => setForm({ ...form, password: e.target.value })}
51
+ />
52
+
53
+ <button onClick={handleSignup} className="login-button">
54
+ Create Account
55
+ </button>
56
+
57
+ <div className="login-footer">
58
+ Already have an account?{" "}
59
+ <Link to="/login" className="signup-link">
60
+ Login
61
+ </Link>
62
+ </div>
63
+ </div>
64
+
65
+ <VerifyOtpModal
66
+ isOpen={showOtp}
67
+ onClose={() => setShowOtp(false)}
68
+ onVerifySuccess={handleOtpSuccess}
69
+ />
70
+ </div>
71
+ );
72
+ };
73
+
74
+ export default Signup;
@@ -0,0 +1,19 @@
1
+ import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
2
+ import Login from "../pages/Login";
3
+ import Signup from "../pages/Signup";
4
+ import Dashboard from "../pages/Dashboard";
5
+
6
+ const AppRouter = () => {
7
+ return (
8
+ <BrowserRouter>
9
+ <Routes>
10
+ <Route path="/" element={<Navigate to="/login" />} />
11
+ <Route path="/login" element={<Login />} />
12
+ <Route path="/signup" element={<Signup />} />
13
+ <Route path="/dashboard" element={<Dashboard />} />
14
+ </Routes>
15
+ </BrowserRouter>
16
+ );
17
+ };
18
+
19
+ export default AppRouter;
@@ -0,0 +1,5 @@
1
+ body {
2
+ margin: 0;
3
+ font-family: system-ui, sans-serif;
4
+ background: #f5f6fa;
5
+ }
@@ -0,0 +1,59 @@
1
+ import * as CryptoJS from "crypto-js";
2
+ import ENVIRONMENT from "../contants/constants";
3
+
4
+ /**
5
+ * Function to get prime numbers in range (start, end)
6
+ */
7
+ function getPrimeNumbersInRange(start: number, end: number): number[] {
8
+ const isPrime = (num: number) => {
9
+ for (let i = 2, s = Math.sqrt(num); i <= s; i++) {
10
+ if (num % i === 0) return false;
11
+ }
12
+ return num > 1;
13
+ };
14
+
15
+ const primes = [];
16
+ for (let i = start; i <= end; i++) {
17
+ if (isPrime(i)) primes.push(i);
18
+ }
19
+ return primes;
20
+ }
21
+
22
+ export function getKey(value: number): string {
23
+ const key = ENVIRONMENT.STRING || "asdfasdfasd";
24
+
25
+ // Function to get prime numbers in range (1, value)
26
+ const primeNumbers = getPrimeNumbersInRange(1, value);
27
+
28
+ // Get the string according to the prime numbers
29
+ const resultString = primeNumbers
30
+ .map((num) => key[num % key.length])
31
+ .join("");
32
+
33
+ return resultString;
34
+ }
35
+
36
+ const key = getKey(50);
37
+
38
+ const encryptData = (data: any) => {
39
+ if (data) {
40
+ const stringData = JSON.stringify(data);
41
+ const encrypted = CryptoJS.AES.encrypt(stringData, key).toString();
42
+ return encrypted;
43
+ }
44
+ };
45
+
46
+ const decryptData = (data: any) => {
47
+ if (data) {
48
+ const decrypted = CryptoJS.AES.decrypt(data, key);
49
+ const stringData = decrypted.toString(CryptoJS.enc.Utf8);
50
+ try {
51
+ return JSON.parse(stringData);
52
+ } catch (e) {
53
+ console.error("Failed to parse decrypted data", e);
54
+ return null;
55
+ }
56
+ }
57
+ };
58
+
59
+ export { encryptData, decryptData };
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2022",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "types": ["vite/client"],
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+
19
+ /* Linting */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "erasableSyntaxOnly": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "noUncheckedSideEffectImports": true
26
+ },
27
+ "include": ["src"]
28
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ],
7
+ "compilerOptions": {
8
+ "strict": true,
9
+ "moduleResolution": "bundler",
10
+ "types": ["vite/client"]
11
+ }
12
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true
24
+ },
25
+ "include": ["vite.config.ts"]
26
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+
4
+ // https://vite.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ })
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ ecmaVersion: 2020,
20
+ globals: globals.browser,
21
+ },
22
+ },
23
+ ])
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>react-ts-tailwind-axios</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>