create-base-stack 1.0.1

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 (49) hide show
  1. package/README.md +15 -0
  2. package/bin/index.ts +26 -0
  3. package/package.json +12 -0
  4. package/template/.bun-version +1 -0
  5. package/template/README.md +15 -0
  6. package/template/apps/api/README.md +11 -0
  7. package/template/apps/api/package.json +25 -0
  8. package/template/apps/api/src/index.ts +19 -0
  9. package/template/apps/api/src/lib/rpc.ts +8 -0
  10. package/template/apps/api/src/lib/utils.ts +44 -0
  11. package/template/apps/api/src/middleware/cors.ts +7 -0
  12. package/template/apps/api/src/middleware/error.ts +28 -0
  13. package/template/apps/api/tsconfig.json +28 -0
  14. package/template/apps/api/tsdown.config.ts +6 -0
  15. package/template/apps/app/README.md +73 -0
  16. package/template/apps/app/components.json +22 -0
  17. package/template/apps/app/eslint.config.js +23 -0
  18. package/template/apps/app/index.html +13 -0
  19. package/template/apps/app/package.json +45 -0
  20. package/template/apps/app/public/vite.svg +1 -0
  21. package/template/apps/app/src/assets/react.svg +1 -0
  22. package/template/apps/app/src/components/provider/query-provider.tsx +26 -0
  23. package/template/apps/app/src/components/provider/theme-provider.tsx +73 -0
  24. package/template/apps/app/src/components/ui/button.tsx +62 -0
  25. package/template/apps/app/src/components/ui/card.tsx +92 -0
  26. package/template/apps/app/src/index.css +123 -0
  27. package/template/apps/app/src/lib/api-client.ts +7 -0
  28. package/template/apps/app/src/lib/utils.ts +6 -0
  29. package/template/apps/app/src/main.tsx +37 -0
  30. package/template/apps/app/src/routeTree.gen.ts +59 -0
  31. package/template/apps/app/src/routes/__root.tsx +16 -0
  32. package/template/apps/app/src/routes/index.tsx +69 -0
  33. package/template/apps/app/tsconfig.app.json +30 -0
  34. package/template/apps/app/tsconfig.json +17 -0
  35. package/template/apps/app/tsconfig.node.json +26 -0
  36. package/template/apps/app/vite.config.ts +23 -0
  37. package/template/biome.json +44 -0
  38. package/template/bun.lock +930 -0
  39. package/template/bunfig.toml +2 -0
  40. package/template/lefthook.yml +13 -0
  41. package/template/package.json +29 -0
  42. package/template/packages/shared/README.md +15 -0
  43. package/template/packages/shared/package.json +25 -0
  44. package/template/packages/shared/src/index.ts +2 -0
  45. package/template/packages/shared/src/lib/errors.ts +43 -0
  46. package/template/packages/shared/src/lib/types.ts +24 -0
  47. package/template/packages/shared/tsconfig.json +28 -0
  48. package/template/packages/shared/tsdown.config.ts +5 -0
  49. package/template/turbo.json +77 -0
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # base
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.4. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
package/bin/index.ts ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bun
2
+ import { mkdir, copyFile, readdir } from "node:fs/promises";
3
+ import path from "node:path";
4
+
5
+ const projectName = process.argv[2] || "base-stack";
6
+ const templateDir = path.join(import.meta.dir, "../template");
7
+ const targetDir = path.join(process.cwd(), projectName);
8
+
9
+ console.log(`🚀 Creating ${projectName}...`);
10
+
11
+ // Simple recursive copy function
12
+ async function copy(src: string, dest: string) {
13
+ await mkdir(dest, { recursive: true });
14
+ const entries = await readdir(src, { withFileTypes: true });
15
+ for (const entry of entries) {
16
+ const srcPath = path.join(src, entry.name);
17
+ const destPath = path.join(dest, entry.name);
18
+ entry.isDirectory()
19
+ ? await copy(srcPath, destPath)
20
+ : await copyFile(srcPath, destPath);
21
+ }
22
+ }
23
+
24
+ await copy(templateDir, targetDir);
25
+ console.log("✅ Project ready! Now run: bun install");
26
+
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "create-base-stack",
3
+ "version": "1.0.1",
4
+ "type": "module",
5
+ "bin": {
6
+ "create-base-stack": "./bin/index.ts"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "template"
11
+ ]
12
+ }
@@ -0,0 +1 @@
1
+ 1.3.4
@@ -0,0 +1,15 @@
1
+ # @base
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.4. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,11 @@
1
+ To install dependencies:
2
+ ```sh
3
+ bun install
4
+ ```
5
+
6
+ To run:
7
+ ```sh
8
+ bun run dev
9
+ ```
10
+
11
+ open http://localhost:3000
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@base/api",
3
+ "private": true,
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/lib/rpc.d.mts",
8
+ "default": "./dist/lib/rpc.mjs"
9
+ }
10
+ },
11
+ "scripts": {
12
+ "dev": "bun run --hot src/index.ts",
13
+ "build": "tsdown"
14
+ },
15
+ "dependencies": {
16
+ "@base/shared": "workspace:*",
17
+ "hono": "^4.11.3",
18
+ "http-status-codes": "^2.3.0",
19
+ "zod": "^4.3.4"
20
+ },
21
+ "devDependencies": {
22
+ "@types/bun": "latest",
23
+ "tsdown": "^0.19.0-beta.1"
24
+ }
25
+ }
@@ -0,0 +1,19 @@
1
+ import { Hono } from "hono";
2
+ import { successResponse } from "./lib/utils";
3
+ import { corsMiddleware } from "./middleware/cors";
4
+ import { errorHandler } from "./middleware/error";
5
+
6
+ const app = new Hono({ strict: false })
7
+ .basePath("/api/v1")
8
+ .use("*", corsMiddleware)
9
+ .onError(errorHandler)
10
+ .get("/", (c) => {
11
+ return successResponse(
12
+ c,
13
+ { message: "Hello, World!" },
14
+ "Welcome to the Base Stack.",
15
+ 200,
16
+ );
17
+ });
18
+
19
+ export default app;
@@ -0,0 +1,8 @@
1
+ import { hc } from "hono/client";
2
+ import type app from "..";
3
+
4
+ export type AppType = typeof app;
5
+ export type Client = ReturnType<typeof hc<AppType>>;
6
+
7
+ export const hcWithType = (...args: Parameters<typeof hc>): Client =>
8
+ hc<AppType>(...args);
@@ -0,0 +1,44 @@
1
+ import type {
2
+ ApiResponseMetadata,
3
+ ErrorResponse,
4
+ StatusCode,
5
+ SuccessResponse,
6
+ } from "@base/shared";
7
+ import type { Context } from "hono";
8
+ import { StatusCodes } from "http-status-codes";
9
+
10
+ export function successResponse<T>(
11
+ c: Context,
12
+ data: T,
13
+ message: string = "Request successful.",
14
+ code: StatusCode = StatusCodes.OK,
15
+ metadata?: ApiResponseMetadata,
16
+ ) {
17
+ const response: SuccessResponse<T> = {
18
+ status: "success",
19
+ code: code,
20
+ message: message,
21
+ data: data,
22
+ ...(metadata && { metadata }),
23
+ };
24
+
25
+ return c.json(response, code as any);
26
+ }
27
+
28
+ export function errorResponse<T>(
29
+ c: Context,
30
+ errors: T,
31
+ message: string = "An error occurred.",
32
+ code: StatusCode = StatusCodes.BAD_REQUEST,
33
+ metadata?: ApiResponseMetadata,
34
+ ) {
35
+ const response: ErrorResponse<T> = {
36
+ status: "error",
37
+ code: code,
38
+ message: message,
39
+ errors: errors,
40
+ ...(metadata && { metadata }),
41
+ };
42
+
43
+ return c.json(response, code as any);
44
+ }
@@ -0,0 +1,7 @@
1
+ import { cors } from "hono/cors";
2
+
3
+ export const corsMiddleware = cors({
4
+ origin: ["http://localhost:5173"],
5
+ credentials: true,
6
+ allowMethods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
7
+ });
@@ -0,0 +1,28 @@
1
+ import type { Context } from "hono";
2
+ import { HTTPException } from "hono/http-exception";
3
+ import { StatusCodes } from "http-status-codes";
4
+ import { errorResponse } from "../lib/utils";
5
+
6
+ export const errorHandler = (err: Error, c: Context) => {
7
+ if (err instanceof HTTPException) {
8
+ return errorResponse(c, err.cause || null, err.message, err.status as any);
9
+ }
10
+
11
+ if ("status" in err && typeof err.status === "number") {
12
+ const errorDetails = "cause" in err ? err.cause : null;
13
+ return errorResponse(c, errorDetails, err.message, err.status as any);
14
+ }
15
+
16
+ if (err.name === "ZodError") {
17
+ return errorResponse(c, err, "Validation failed", StatusCodes.BAD_REQUEST);
18
+ }
19
+
20
+ console.error(`[Unhandled Error]: ${err.message}`, err);
21
+
22
+ return errorResponse(
23
+ c,
24
+ process.env.NODE_ENV === "development" ? err.stack : null,
25
+ "Internal Server Error",
26
+ StatusCodes.INTERNAL_SERVER_ERROR,
27
+ );
28
+ };
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["ESNext"],
4
+ "target": "ESNext",
5
+ "module": "Preserve",
6
+ "moduleDetection": "force",
7
+ "allowJs": true,
8
+ "moduleResolution": "bundler",
9
+ "allowImportingTsExtensions": true,
10
+ "verbatimModuleSyntax": true,
11
+ "noEmit": true,
12
+ "strict": true,
13
+ "skipLibCheck": true,
14
+ "noFallthroughCasesInSwitch": true,
15
+ "noUncheckedIndexedAccess": true,
16
+ "noImplicitOverride": true,
17
+ "noUnusedLocals": false,
18
+ "noUnusedParameters": false,
19
+ "noPropertyAccessFromIndexSignature": false,
20
+ "baseUrl": "src",
21
+ "rootDir": "src",
22
+ "paths": {
23
+ "@/*": ["*"]
24
+ }
25
+ },
26
+ "include": ["src/**/*"],
27
+ "exclude": ["node_modules", "dist"]
28
+ }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ dts: true,
5
+ entry: ["./src/index.ts", "./src/lib/rpc.ts"],
6
+ });
@@ -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,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "",
8
+ "css": "src/index.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "aliases": {
15
+ "components": "@/components",
16
+ "utils": "@/lib/utils",
17
+ "ui": "@/components/ui",
18
+ "lib": "@/lib",
19
+ "hooks": "@/hooks"
20
+ },
21
+ "registries": {}
22
+ }
@@ -0,0 +1,23 @@
1
+ import js from "@eslint/js";
2
+ import { defineConfig, globalIgnores } from "eslint/config";
3
+ import reactHooks from "eslint-plugin-react-hooks";
4
+ import reactRefresh from "eslint-plugin-react-refresh";
5
+ import globals from "globals";
6
+ import tseslint from "typescript-eslint";
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>Base Stack</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@base/app",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "tsc -b && vite build",
8
+ "lint": "eslint .",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "@base/api": "workspace:*",
13
+ "@base/shared": "workspace:*",
14
+ "@radix-ui/react-slot": "^1.2.4",
15
+ "@tailwindcss/vite": "^4.1.18",
16
+ "@tanstack/react-query": "^5.90.16",
17
+ "@tanstack/react-query-devtools": "^5.91.2",
18
+ "@tanstack/react-router": "^1.144.0",
19
+ "@tanstack/react-router-devtools": "^1.144.0",
20
+ "class-variance-authority": "^0.7.1",
21
+ "clsx": "^2.1.1",
22
+ "lucide-react": "^0.562.0",
23
+ "react": "^19.2.0",
24
+ "react-dom": "^19.2.0",
25
+ "tailwind-merge": "^3.4.0",
26
+ "tailwindcss": "^4.1.18"
27
+ },
28
+ "devDependencies": {
29
+ "@eslint/js": "^9.39.1",
30
+ "@tanstack/eslint-plugin-query": "^5.91.2",
31
+ "@tanstack/router-plugin": "^1.145.2",
32
+ "@types/node": "^25.0.3",
33
+ "@types/react": "^19.2.5",
34
+ "@types/react-dom": "^19.2.3",
35
+ "@vitejs/plugin-react": "^5.1.1",
36
+ "eslint": "^9.39.1",
37
+ "eslint-plugin-react-hooks": "^7.0.1",
38
+ "eslint-plugin-react-refresh": "^0.4.24",
39
+ "globals": "^16.5.0",
40
+ "tw-animate-css": "^1.4.0",
41
+ "typescript": "~5.9.3",
42
+ "typescript-eslint": "^8.46.4",
43
+ "vite": "^7.2.4"
44
+ }
45
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,26 @@
1
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2
+ import React from "react";
3
+
4
+ export default function QueryProvider({
5
+ children,
6
+ }: {
7
+ children: React.ReactNode;
8
+ }) {
9
+ const [queryClient] = React.useState(
10
+ () =>
11
+ new QueryClient({
12
+ defaultOptions: {
13
+ queries: {
14
+ staleTime: 5 * 60 * 1000,
15
+ gcTime: 10 * 60 * 1000,
16
+ retry: 1,
17
+ refetchOnWindowFocus: false,
18
+ },
19
+ },
20
+ }),
21
+ );
22
+
23
+ return (
24
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
25
+ );
26
+ }
@@ -0,0 +1,73 @@
1
+ import { createContext, useContext, useEffect, useState } from "react";
2
+
3
+ type Theme = "dark" | "light" | "system";
4
+
5
+ type ThemeProviderProps = {
6
+ children: React.ReactNode;
7
+ defaultTheme?: Theme;
8
+ storageKey?: string;
9
+ };
10
+
11
+ type ThemeProviderState = {
12
+ theme: Theme;
13
+ setTheme: (theme: Theme) => void;
14
+ };
15
+
16
+ const initialState: ThemeProviderState = {
17
+ theme: "system",
18
+ setTheme: () => null,
19
+ };
20
+
21
+ const ThemeProviderContext = createContext<ThemeProviderState>(initialState);
22
+
23
+ export default function ThemeProvider({
24
+ children,
25
+ defaultTheme = "system",
26
+ storageKey = "vite-ui-theme",
27
+ ...props
28
+ }: ThemeProviderProps) {
29
+ const [theme, setTheme] = useState<Theme>(
30
+ () => (localStorage.getItem(storageKey) as Theme) || defaultTheme,
31
+ );
32
+
33
+ useEffect(() => {
34
+ const root = window.document.documentElement;
35
+
36
+ root.classList.remove("light", "dark");
37
+
38
+ if (theme === "system") {
39
+ const systemTheme = window.matchMedia("(prefers-color-scheme: dark)")
40
+ .matches
41
+ ? "dark"
42
+ : "light";
43
+
44
+ root.classList.add(systemTheme);
45
+ return;
46
+ }
47
+
48
+ root.classList.add(theme);
49
+ }, [theme]);
50
+
51
+ const value = {
52
+ theme,
53
+ setTheme: (theme: Theme) => {
54
+ localStorage.setItem(storageKey, theme);
55
+ setTheme(theme);
56
+ },
57
+ };
58
+
59
+ return (
60
+ <ThemeProviderContext.Provider {...props} value={value}>
61
+ {children}
62
+ </ThemeProviderContext.Provider>
63
+ );
64
+ }
65
+
66
+ export const useTheme = () => {
67
+ const context = useContext(ThemeProviderContext);
68
+
69
+ if (context === undefined)
70
+ throw new Error("useTheme must be used within a ThemeProvider");
71
+
72
+ return context;
73
+ };
@@ -0,0 +1,62 @@
1
+ import { Slot } from "@radix-ui/react-slot";
2
+ import { cva, type VariantProps } from "class-variance-authority";
3
+ import type * as React from "react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
+ destructive:
14
+ "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
15
+ outline:
16
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
17
+ secondary:
18
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
19
+ ghost:
20
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
21
+ link: "text-primary underline-offset-4 hover:underline",
22
+ },
23
+ size: {
24
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
25
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
26
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
27
+ icon: "size-9",
28
+ "icon-sm": "size-8",
29
+ "icon-lg": "size-10",
30
+ },
31
+ },
32
+ defaultVariants: {
33
+ variant: "default",
34
+ size: "default",
35
+ },
36
+ },
37
+ );
38
+
39
+ function Button({
40
+ className,
41
+ variant = "default",
42
+ size = "default",
43
+ asChild = false,
44
+ ...props
45
+ }: React.ComponentProps<"button"> &
46
+ VariantProps<typeof buttonVariants> & {
47
+ asChild?: boolean;
48
+ }) {
49
+ const Comp = asChild ? Slot : "button";
50
+
51
+ return (
52
+ <Comp
53
+ data-slot="button"
54
+ data-variant={variant}
55
+ data-size={size}
56
+ className={cn(buttonVariants({ variant, size, className }))}
57
+ {...props}
58
+ />
59
+ );
60
+ }
61
+
62
+ export { Button, buttonVariants };