create-fe-boilerplate 0.2.0 → 0.3.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 (51) hide show
  1. package/bin/index.js +52 -12
  2. package/package.json +11 -3
  3. package/templates/next/ts/tailwind/axios/README.md +36 -0
  4. package/templates/next/ts/tailwind/axios/eslint.config.mjs +18 -0
  5. package/templates/next/ts/tailwind/axios/next.config.ts +7 -0
  6. package/templates/next/ts/tailwind/axios/package-lock.json +6626 -0
  7. package/templates/next/ts/tailwind/axios/package.json +27 -0
  8. package/templates/next/ts/tailwind/axios/postcss.config.mjs +7 -0
  9. package/templates/next/ts/tailwind/axios/public/file.svg +1 -0
  10. package/templates/next/ts/tailwind/axios/public/globe.svg +1 -0
  11. package/templates/next/ts/tailwind/axios/public/next.svg +1 -0
  12. package/templates/next/ts/tailwind/axios/public/vercel.svg +1 -0
  13. package/templates/next/ts/tailwind/axios/public/window.svg +1 -0
  14. package/templates/next/ts/tailwind/axios/src/api/auth.ts +10 -0
  15. package/templates/next/ts/tailwind/axios/src/api/axios.ts +17 -0
  16. package/templates/next/ts/tailwind/axios/src/app/dashboard/page.tsx +32 -0
  17. package/templates/next/ts/tailwind/axios/src/app/favicon.ico +0 -0
  18. package/templates/next/ts/tailwind/axios/src/app/globals.css +26 -0
  19. package/templates/next/ts/tailwind/axios/src/app/layout.tsx +34 -0
  20. package/templates/next/ts/tailwind/axios/src/app/login/page.tsx +71 -0
  21. package/templates/next/ts/tailwind/axios/src/app/page.tsx +5 -0
  22. package/templates/next/ts/tailwind/axios/src/app/signup/page.tsx +56 -0
  23. package/templates/next/ts/tailwind/axios/src/components/AuthGuard.tsx +35 -0
  24. package/templates/next/ts/tailwind/axios/src/components/VerifyOtpModal.tsx +58 -0
  25. package/templates/next/ts/tailwind/axios/tsconfig.json +36 -0
  26. package/templates/react/js/tailwind/axios/vite.config.js +1 -1
  27. package/templates/react/js/tailwind/rtk/README.md +73 -0
  28. package/templates/react/js/tailwind/rtk/eslint.config.js +23 -0
  29. package/templates/react/js/tailwind/rtk/index.html +13 -0
  30. package/templates/react/js/tailwind/rtk/package-lock.json +4597 -0
  31. package/templates/react/js/tailwind/rtk/package.json +37 -0
  32. package/templates/react/js/tailwind/rtk/postcss.config.js +6 -0
  33. package/templates/react/js/tailwind/rtk/public/vite.svg +1 -0
  34. package/templates/react/js/tailwind/rtk/react-ts-tailwind-axios/.env.example +1 -0
  35. package/templates/react/js/tailwind/rtk/src/App.css +0 -0
  36. package/templates/react/js/tailwind/rtk/src/App.jsx +14 -0
  37. package/templates/react/js/tailwind/rtk/src/api/axios.ts +236 -0
  38. package/templates/react/js/tailwind/rtk/src/component/auth/VerifyOtpModal.jsx +60 -0
  39. package/templates/react/js/tailwind/rtk/src/component/common/ui/Toast/Toast.js +59 -0
  40. package/templates/react/js/tailwind/rtk/src/contants/constants.js +45 -0
  41. package/templates/react/js/tailwind/rtk/src/index.css +4 -0
  42. package/templates/react/js/tailwind/rtk/src/main.jsx +14 -0
  43. package/templates/react/js/tailwind/rtk/src/pages/Dashboard.jsx +10 -0
  44. package/templates/react/js/tailwind/rtk/src/pages/Login.jsx +69 -0
  45. package/templates/react/js/tailwind/rtk/src/pages/Signup.jsx +75 -0
  46. package/templates/react/js/tailwind/rtk/src/router/AppRoutes.jsx +19 -0
  47. package/templates/react/js/tailwind/rtk/src/store/index.js +10 -0
  48. package/templates/react/js/tailwind/rtk/src/store/services/api.js +34 -0
  49. package/templates/react/js/tailwind/rtk/src/utils/utils.ts +59 -0
  50. package/templates/react/js/tailwind/rtk/tailwind.config.js +8 -0
  51. package/templates/react/js/tailwind/rtk/vite.config.js +7 -0
@@ -0,0 +1,34 @@
1
+ import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
2
+
3
+ export const api = createApi({
4
+ reducerPath: "api",
5
+ baseQuery: fetchBaseQuery({
6
+ baseUrl: import.meta.env.VITE_API_HOST,
7
+ }),
8
+ endpoints: (builder) => ({
9
+ login: builder.mutation({
10
+ query: (body) => ({
11
+ url: "/auth/login",
12
+ method: "POST",
13
+ body,
14
+ }),
15
+ }),
16
+ signup: builder.mutation({
17
+ query: (body) => ({
18
+ url: "/auth/signup",
19
+ method: "POST",
20
+ body,
21
+ }),
22
+ }),
23
+ verifyOtp: builder.mutation({
24
+ query: (body) => ({
25
+ url: "/auth/verify-otp",
26
+ method: "POST",
27
+ body,
28
+ }),
29
+ }),
30
+ }),
31
+ });
32
+
33
+ export const { useLoginMutation, useSignupMutation, useVerifyOtpMutation } =
34
+ api;
@@ -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,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
4
+ theme: {
5
+ extend: {}
6
+ },
7
+ plugins: []
8
+ };
@@ -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
+ })