create-reactivite 1.1.0 → 1.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.
- package/README.md +235 -197
- package/index.js +48 -1
- package/package.json +7 -4
- package/template/_gitignore +24 -0
- package/template/src/App.tsx +7 -2
- package/template/src/components/author-credit.tsx +25 -0
- package/template2/.env.example +8 -0
- package/template2/.husky/pre-commit +4 -0
- package/template2/.prettierrc +5 -0
- package/template2/README.md +73 -0
- package/template2/__tests__/example.test.ts +20 -0
- package/template2/_gitignore +37 -0
- package/template2/app/[locale]/(private)/dashboard/page.tsx +52 -0
- package/template2/app/[locale]/(public)/login/page.tsx +83 -0
- package/template2/app/[locale]/layout.tsx +58 -0
- package/template2/app/[locale]/locales.ts +10 -0
- package/template2/app/[locale]/page.tsx +38 -0
- package/template2/app/api/clear-session/route.ts +10 -0
- package/template2/app/globals.css +127 -0
- package/template2/app/layout.tsx +7 -0
- package/template2/app/page.tsx +6 -0
- package/template2/components/AuthEventListener.tsx +22 -0
- package/template2/components/author-credit.tsx +25 -0
- package/template2/components/theme-provider.tsx +78 -0
- package/template2/components/ui/button.tsx +60 -0
- package/template2/components/ui/card.tsx +92 -0
- package/template2/components/ui/input.tsx +21 -0
- package/template2/components/ui/label.tsx +24 -0
- package/template2/components/ui/sonner.tsx +40 -0
- package/template2/components.json +22 -0
- package/template2/config/constants.ts +7 -0
- package/template2/config/env.ts +5 -0
- package/template2/contexts/translation-context.tsx +70 -0
- package/template2/eslint.config.mjs +18 -0
- package/template2/hoc/provider.tsx +27 -0
- package/template2/lib/paramsSerializer.ts +40 -0
- package/template2/lib/utils.ts +6 -0
- package/template2/locales/az.json +20 -0
- package/template2/locales/en.json +20 -0
- package/template2/next-env.d.ts +6 -0
- package/template2/next.config.ts +17 -0
- package/template2/orval.config.ts +66 -0
- package/template2/package.json +62 -0
- package/template2/postcss.config.mjs +7 -0
- package/template2/public/.gitkeep +0 -0
- package/template2/scripts/fix-generated-types.mjs +13 -0
- package/template2/services/generated/.gitkeep +2 -0
- package/template2/services/httpClient/httpClient.ts +70 -0
- package/template2/services/httpClient/orvalMutator.ts +10 -0
- package/template2/store/example-store.tsx +16 -0
- package/template2/store/user-store.tsx +29 -0
- package/template2/testing/msw/handlers/index.ts +6 -0
- package/template2/testing/msw/server.ts +4 -0
- package/template2/tsconfig.json +34 -0
- package/template2/tsconfig.tsbuildinfo +1 -0
- package/template2/vitest.config.ts +17 -0
- package/template2/vitest.setup.ts +7 -0
- package/template3/README.md +34 -0
- package/template3/_gitignore +16 -0
- package/template3/index.html +11 -0
- package/template3/package.json +22 -0
- package/template3/rspack.config.mjs +51 -0
- package/template3/src/App.tsx +16 -0
- package/template3/src/components/author-credit.tsx +42 -0
- package/template3/src/index.css +46 -0
- package/template3/src/main.tsx +10 -0
- package/template3/tsconfig.json +20 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
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,
|
|
42
|
+
size,
|
|
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
|
+
className={cn(buttonVariants({ variant, size, className }))}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { Button, buttonVariants }
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
|
6
|
+
return (
|
|
7
|
+
<div
|
|
8
|
+
data-slot="card"
|
|
9
|
+
className={cn(
|
|
10
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
11
|
+
className
|
|
12
|
+
)}
|
|
13
|
+
{...props}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
data-slot="card-header"
|
|
22
|
+
className={cn(
|
|
23
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="card-title"
|
|
35
|
+
className={cn("leading-none font-semibold", className)}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-slot="card-description"
|
|
45
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
data-slot="card-action"
|
|
55
|
+
className={cn(
|
|
56
|
+
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="card-content"
|
|
68
|
+
className={cn("px-6", className)}
|
|
69
|
+
{...props}
|
|
70
|
+
/>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
data-slot="card-footer"
|
|
78
|
+
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
Card,
|
|
86
|
+
CardHeader,
|
|
87
|
+
CardFooter,
|
|
88
|
+
CardTitle,
|
|
89
|
+
CardAction,
|
|
90
|
+
CardDescription,
|
|
91
|
+
CardContent,
|
|
92
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
|
|
6
|
+
return (
|
|
7
|
+
<input
|
|
8
|
+
type={type}
|
|
9
|
+
data-slot="input"
|
|
10
|
+
className={cn(
|
|
11
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
12
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
13
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { Input }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as LabelPrimitive from "@radix-ui/react-label"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
|
|
8
|
+
function Label({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
12
|
+
return (
|
|
13
|
+
<LabelPrimitive.Root
|
|
14
|
+
data-slot="label"
|
|
15
|
+
className={cn(
|
|
16
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { Label }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
CircleCheckIcon,
|
|
5
|
+
InfoIcon,
|
|
6
|
+
Loader2Icon,
|
|
7
|
+
OctagonXIcon,
|
|
8
|
+
TriangleAlertIcon,
|
|
9
|
+
} from "lucide-react"
|
|
10
|
+
import { useTheme } from "next-themes"
|
|
11
|
+
import { Toaster as Sonner, type ToasterProps } from "sonner"
|
|
12
|
+
|
|
13
|
+
const Toaster = ({ ...props }: ToasterProps) => {
|
|
14
|
+
const { theme = "system" } = useTheme()
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Sonner
|
|
18
|
+
theme={theme as ToasterProps["theme"]}
|
|
19
|
+
className="toaster group"
|
|
20
|
+
icons={{
|
|
21
|
+
success: <CircleCheckIcon className="size-4" />,
|
|
22
|
+
info: <InfoIcon className="size-4" />,
|
|
23
|
+
warning: <TriangleAlertIcon className="size-4" />,
|
|
24
|
+
error: <OctagonXIcon className="size-4" />,
|
|
25
|
+
loading: <Loader2Icon className="size-4 animate-spin" />,
|
|
26
|
+
}}
|
|
27
|
+
style={
|
|
28
|
+
{
|
|
29
|
+
"--normal-bg": "var(--popover)",
|
|
30
|
+
"--normal-text": "var(--popover-foreground)",
|
|
31
|
+
"--normal-border": "var(--border)",
|
|
32
|
+
"--border-radius": "var(--radius)",
|
|
33
|
+
} as React.CSSProperties
|
|
34
|
+
}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { Toaster }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "app/globals.css",
|
|
9
|
+
"baseColor": "slate",
|
|
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": "@/lib/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const LOCALES = ['az', 'en'] as const;
|
|
2
|
+
export type Locale = (typeof LOCALES)[number];
|
|
3
|
+
export const DEFAULT_LOCALE: Locale = 'az';
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_PAGE_SIZE = 9;
|
|
6
|
+
export const QUERY_STALE_TIME_TAGS = 5 * 60 * 1000;
|
|
7
|
+
export const AXIOS_TIMEOUT_MS = 15000;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext, ReactNode, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
type MessageValue = string | Record<string, string>;
|
|
6
|
+
type Messages = Record<string, MessageValue>;
|
|
7
|
+
|
|
8
|
+
interface TranslationContextType {
|
|
9
|
+
locale: string;
|
|
10
|
+
messages: Messages;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const TranslationContext = createContext<TranslationContextType | undefined>(
|
|
14
|
+
undefined,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
interface TranslationProviderProps {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
locale: string;
|
|
20
|
+
messages: Messages;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function TranslationProvider({
|
|
24
|
+
children,
|
|
25
|
+
locale,
|
|
26
|
+
messages,
|
|
27
|
+
}: Readonly<TranslationProviderProps>) {
|
|
28
|
+
const value = useMemo(() => ({ locale, messages }), [locale, messages]);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<TranslationContext.Provider value={value}>
|
|
32
|
+
{children}
|
|
33
|
+
</TranslationContext.Provider>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useTranslations(namespace?: string) {
|
|
38
|
+
const context = useContext(TranslationContext);
|
|
39
|
+
|
|
40
|
+
if (!context) {
|
|
41
|
+
throw new Error('useTranslations must be used within TranslationProvider');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (key: string): string => {
|
|
45
|
+
const { messages } = context;
|
|
46
|
+
|
|
47
|
+
if (!namespace) {
|
|
48
|
+
const value = messages[key];
|
|
49
|
+
return typeof value === 'string' ? value : key;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const ns = messages[namespace];
|
|
53
|
+
|
|
54
|
+
if (!ns || typeof ns !== 'object') {
|
|
55
|
+
return key;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return ns[key] ?? key;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function useLocale(): string {
|
|
63
|
+
const context = useContext(TranslationContext);
|
|
64
|
+
|
|
65
|
+
if (!context) {
|
|
66
|
+
throw new Error('useLocale must be used within TranslationProvider');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return context.locale;
|
|
70
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
+
import nextVitals from "eslint-config-next/core-web-vitals";
|
|
3
|
+
import nextTs from "eslint-config-next/typescript";
|
|
4
|
+
|
|
5
|
+
const eslintConfig = defineConfig([
|
|
6
|
+
...nextVitals,
|
|
7
|
+
...nextTs,
|
|
8
|
+
globalIgnores([
|
|
9
|
+
".next/**",
|
|
10
|
+
"out/**",
|
|
11
|
+
"build/**",
|
|
12
|
+
"next-env.d.ts",
|
|
13
|
+
// Auto-generated by orval — do not lint
|
|
14
|
+
"services/generated/**",
|
|
15
|
+
]),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
export default eslintConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
|
+
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
|
|
7
|
+
export function QueryProvider({
|
|
8
|
+
children,
|
|
9
|
+
}: Readonly<{ children: React.ReactNode }>) {
|
|
10
|
+
const [queryClient] = useState(
|
|
11
|
+
() =>
|
|
12
|
+
new QueryClient({
|
|
13
|
+
defaultOptions: {
|
|
14
|
+
queries: {
|
|
15
|
+
staleTime: 0,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<QueryClientProvider client={queryClient}>
|
|
23
|
+
{children}
|
|
24
|
+
<ReactQueryDevtools initialIsOpen={false} />
|
|
25
|
+
</QueryClientProvider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flattens one level of nested objects before serializing to a query string.
|
|
3
|
+
* Useful when a backend (e.g. Spring Boot Pageable / @ModelAttribute) expects
|
|
4
|
+
* flat params (page=0&size=10) instead of Axios's default bracket notation
|
|
5
|
+
* (pageable[page]=0&pageable[size]=10).
|
|
6
|
+
*
|
|
7
|
+
* Arrays at any level are repeated: sort=name,asc&sort=id,desc
|
|
8
|
+
* null/undefined values are omitted.
|
|
9
|
+
*/
|
|
10
|
+
export const paramsSerializer = (params: Record<string, unknown>): string => {
|
|
11
|
+
const parts: string[] = [];
|
|
12
|
+
for (const [key, value] of Object.entries(params)) {
|
|
13
|
+
if (value === undefined || value === null) continue;
|
|
14
|
+
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
15
|
+
for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
|
|
16
|
+
if (v === undefined || v === null) continue;
|
|
17
|
+
if (Array.isArray(v)) {
|
|
18
|
+
for (const item of v)
|
|
19
|
+
parts.push(
|
|
20
|
+
`${encodeURIComponent(k)}=${encodeURIComponent(String(item))}`,
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
parts.push(
|
|
24
|
+
`${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} else if (Array.isArray(value)) {
|
|
29
|
+
for (const item of value)
|
|
30
|
+
parts.push(
|
|
31
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`,
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
parts.push(
|
|
35
|
+
`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return parts.join('&');
|
|
40
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"home": {
|
|
3
|
+
"title": "Nextivite-ə xoş gəlmisən",
|
|
4
|
+
"subtitle": "Next.js 16, Tailwind v4, TanStack Query, Zustand, orval və husky ilə hazır boilerplate.",
|
|
5
|
+
"login": "Daxil ol",
|
|
6
|
+
"dashboard": "Panelə keç"
|
|
7
|
+
},
|
|
8
|
+
"login": {
|
|
9
|
+
"title": "Daxil ol",
|
|
10
|
+
"email": "E-poçt",
|
|
11
|
+
"password": "Şifrə",
|
|
12
|
+
"submit": "Daxil ol",
|
|
13
|
+
"success": "Uğurla daxil oldun"
|
|
14
|
+
},
|
|
15
|
+
"dashboard": {
|
|
16
|
+
"title": "Panel",
|
|
17
|
+
"welcome": "Xoş gəldin",
|
|
18
|
+
"logout": "Çıxış"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"home": {
|
|
3
|
+
"title": "Welcome to Nextivite",
|
|
4
|
+
"subtitle": "A ready-to-go boilerplate with Next.js 16, Tailwind v4, TanStack Query, Zustand, orval and husky.",
|
|
5
|
+
"login": "Sign in",
|
|
6
|
+
"dashboard": "Go to dashboard"
|
|
7
|
+
},
|
|
8
|
+
"login": {
|
|
9
|
+
"title": "Sign in",
|
|
10
|
+
"email": "Email",
|
|
11
|
+
"password": "Password",
|
|
12
|
+
"submit": "Sign in",
|
|
13
|
+
"success": "Signed in successfully"
|
|
14
|
+
},
|
|
15
|
+
"dashboard": {
|
|
16
|
+
"title": "Dashboard",
|
|
17
|
+
"welcome": "Welcome",
|
|
18
|
+
"logout": "Log out"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
const nextConfig: NextConfig = {
|
|
4
|
+
async rewrites() {
|
|
5
|
+
const backendUrl = process.env.API_BASE_URL;
|
|
6
|
+
if (!backendUrl) return [];
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
source: "/api/backend/:path*",
|
|
10
|
+
destination: `${backendUrl}/:path*`,
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
},
|
|
14
|
+
output: "standalone",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default nextConfig;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineConfig } from 'orval';
|
|
2
|
+
|
|
3
|
+
const SKIP = new Set(['public', 'api', 'v1', 'v2', 'v3']);
|
|
4
|
+
const VERB_PREFIX: Record<string, string> = {
|
|
5
|
+
get: 'get',
|
|
6
|
+
post: 'create',
|
|
7
|
+
put: 'update',
|
|
8
|
+
patch: 'patch',
|
|
9
|
+
delete: 'delete',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Converts path + HTTP verb → semantic camelCase name.
|
|
13
|
+
// GET /users/public/{id}/posts → getUsersByIdPosts
|
|
14
|
+
// POST /public/auth/login → createAuthLogin
|
|
15
|
+
export function buildOperationName(
|
|
16
|
+
_operation: unknown,
|
|
17
|
+
route: string,
|
|
18
|
+
verb: string,
|
|
19
|
+
): string {
|
|
20
|
+
const prefix = VERB_PREFIX[verb] ?? verb;
|
|
21
|
+
const parts = route
|
|
22
|
+
.replace(/\{([^}]+)\}/g, (_, p) =>
|
|
23
|
+
'By' + p.charAt(0).toUpperCase() + p.slice(1),
|
|
24
|
+
)
|
|
25
|
+
.split('/')
|
|
26
|
+
.filter((s) => s && !SKIP.has(s))
|
|
27
|
+
.map((s) =>
|
|
28
|
+
s
|
|
29
|
+
.charAt(0)
|
|
30
|
+
.toUpperCase()
|
|
31
|
+
.concat(s.slice(1))
|
|
32
|
+
.replace(/-([a-z])/g, (_, c) => c.toUpperCase()),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const deduped = parts.filter((p, i) => p !== parts[i - 1]);
|
|
36
|
+
return prefix + deduped.join('');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
api: {
|
|
41
|
+
input: {
|
|
42
|
+
// Replace with your OpenAPI/Swagger schema URL or local file path.
|
|
43
|
+
target: process.env.OPENAPI_TARGET ?? 'http://localhost:8080/v3/api-docs',
|
|
44
|
+
},
|
|
45
|
+
output: {
|
|
46
|
+
mode: 'tags-split',
|
|
47
|
+
target: 'services/generated',
|
|
48
|
+
schemas: 'services/generated/model',
|
|
49
|
+
client: 'react-query',
|
|
50
|
+
httpClient: 'axios',
|
|
51
|
+
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL,
|
|
52
|
+
override: {
|
|
53
|
+
operationName: buildOperationName,
|
|
54
|
+
mutator: {
|
|
55
|
+
path: 'services/httpClient/orvalMutator.ts',
|
|
56
|
+
name: 'customMutator',
|
|
57
|
+
},
|
|
58
|
+
query: {
|
|
59
|
+
useQuery: true,
|
|
60
|
+
useMutation: true,
|
|
61
|
+
signal: true,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nextivite-plate",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "next dev",
|
|
7
|
+
"dev:4000": "next dev -p 4000",
|
|
8
|
+
"build": "next build",
|
|
9
|
+
"start": "next start",
|
|
10
|
+
"lint": "eslint",
|
|
11
|
+
"prepare": "husky",
|
|
12
|
+
"format": "prettier --write \"app/**/*.{js,ts,tsx}\"",
|
|
13
|
+
"format:services": "prettier --write \"services/**/*.{js,ts,tsx}\"",
|
|
14
|
+
"generate": "orval --config orval.config.ts",
|
|
15
|
+
"generate:api": "npm run generate && npm run format:services && node scripts/fix-generated-types.mjs",
|
|
16
|
+
"dev:full": "npm run generate:api && npm run dev",
|
|
17
|
+
"test": "vitest",
|
|
18
|
+
"test:run": "vitest run"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@hookform/resolvers": "^5.2.2",
|
|
22
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
23
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
24
|
+
"@tanstack/react-query": "^5.90.8",
|
|
25
|
+
"@tanstack/react-query-devtools": "^5.90.2",
|
|
26
|
+
"axios": "^1.13.2",
|
|
27
|
+
"class-variance-authority": "^0.7.1",
|
|
28
|
+
"clsx": "^2.1.1",
|
|
29
|
+
"lucide-react": "^0.548.0",
|
|
30
|
+
"next": "^16.2.2",
|
|
31
|
+
"next-themes": "^0.4.6",
|
|
32
|
+
"react": "19.2.0",
|
|
33
|
+
"react-dom": "19.2.0",
|
|
34
|
+
"react-hook-form": "^7.66.0",
|
|
35
|
+
"sonner": "^2.0.7",
|
|
36
|
+
"tailwind-merge": "^3.3.1",
|
|
37
|
+
"zod": "^4.1.12",
|
|
38
|
+
"zustand": "^5.0.8"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@tailwindcss/postcss": "^4",
|
|
42
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
43
|
+
"@testing-library/react": "^16.3.2",
|
|
44
|
+
"@types/node": "^20",
|
|
45
|
+
"@types/react": "^19",
|
|
46
|
+
"@types/react-dom": "^19",
|
|
47
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
48
|
+
"eslint": "^9",
|
|
49
|
+
"eslint-config-next": "^16.2.2",
|
|
50
|
+
"eslint-config-prettier": "^10.1.8",
|
|
51
|
+
"figlet": "^1.9.3",
|
|
52
|
+
"husky": "^9.1.7",
|
|
53
|
+
"jsdom": "^29.1.1",
|
|
54
|
+
"msw": "^2.14.6",
|
|
55
|
+
"orval": "^8.12.3",
|
|
56
|
+
"prettier": "^3.6.2",
|
|
57
|
+
"tailwindcss": "^4",
|
|
58
|
+
"tw-animate-css": "^1.4.0",
|
|
59
|
+
"typescript": "5.9.3",
|
|
60
|
+
"vitest": "^4.1.7"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Post-processing hook for orval output.
|
|
2
|
+
// Runs after `npm run generate`. Add codemods here if your backend schema needs
|
|
3
|
+
// tweaks the generator can't express. No-op when nothing is generated yet.
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
|
|
6
|
+
const GENERATED_DIR = new URL('../services/generated/', import.meta.url);
|
|
7
|
+
|
|
8
|
+
if (!existsSync(GENERATED_DIR)) {
|
|
9
|
+
console.log('fix-generated-types: services/generated yox, keçildi.');
|
|
10
|
+
process.exit(0);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
console.log('fix-generated-types: generated tipləri yoxlandı (no-op).');
|