@asynx/create-asynx-next-app 1.0.3 → 1.0.6
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/CONTRIBUTING.md +16 -15
- package/README.md +3 -3
- package/create-asynx-next-app-wrapper/index.js +3 -0
- package/create-asynx-next-app-wrapper/package.json +12 -0
- package/dist/cli.js +6 -6
- package/dist/constants/template.js +5 -5
- package/package.json +2 -2
- package/src/cli.ts +6 -6
- package/src/constants/template.ts +6 -6
- package/templates/advanced/.env.example +23 -0
- package/templates/advanced/README.md +148 -0
- package/templates/advanced/next.config.mjs +14 -0
- package/templates/{simple → advanced}/package.json +4 -0
- package/templates/advanced/postcss.config.mjs +6 -0
- package/templates/advanced/src/app/app/billing/page.tsx +57 -0
- package/templates/advanced/src/app/app/layout.tsx +25 -0
- package/templates/advanced/src/app/app/page.tsx +36 -0
- package/templates/advanced/src/app/app/settings/page.tsx +50 -0
- package/templates/advanced/src/app/auth/login/page.tsx +41 -0
- package/templates/advanced/src/app/auth/signup/page.tsx +45 -0
- package/templates/advanced/src/app/globals.css +151 -0
- package/templates/advanced/src/app/layout.tsx +19 -0
- package/templates/advanced/src/app/page.tsx +25 -0
- package/templates/advanced/src/lib/api/client.ts +67 -0
- package/templates/advanced/src/lib/api/config/app.ts +19 -0
- package/templates/advanced/src/lib/api/config/constants.ts +38 -0
- package/templates/advanced/src/lib/api/features/analytics/lib/analytics-service.ts +26 -0
- package/templates/advanced/src/lib/api/features/app-shell/components/app-header.tsx +18 -0
- package/templates/advanced/src/lib/api/features/app-shell/components/app-sidebar.tsx +38 -0
- package/templates/advanced/src/lib/api/features/auth/lib/auth-service.ts +36 -0
- package/templates/advanced/src/lib/api/features/billing/lib/billing-service.ts +38 -0
- package/templates/advanced/src/types/index.ts +21 -0
- package/templates/advanced/tsconfig.json +29 -0
- package/templates/standard/README.md +53 -0
- package/templates/{moderate → standard}/package.json +4 -0
- package/templates/standard/postcss.config.mjs +6 -0
- package/templates/standard/src/app/(dashboard)/dashboard/page.tsx +45 -0
- package/templates/standard/src/app/(dashboard)/layout.tsx +30 -0
- package/templates/standard/src/app/(public)/layout.tsx +16 -0
- package/templates/standard/src/app/(public)/login/page.tsx +33 -0
- package/templates/standard/src/app/globals.css +158 -0
- package/templates/standard/src/app/layout.tsx +38 -0
- package/templates/standard/src/app/page.tsx +27 -0
- package/templates/standard/src/lib/api.ts +37 -0
- package/templates/standard/src/lib/constants.ts +14 -0
- package/templates/{simple → standard}/tsconfig.json +12 -5
- package/templates/{saas → starter}/package.json +4 -0
- package/templates/{saas → starter}/src/app/globals.css +1 -0
- package/templates/{moderate → starter}/tsconfig.json +10 -4
- package/templates/moderate/src/app/globals.css +0 -8
- package/templates/saas/src/app/layout.tsx +0 -18
- package/templates/saas/src/app/page.tsx +0 -8
- package/templates/saas/tsconfig.json +0 -20
- package/templates/simple/next-env.d.ts +0 -4
- package/templates/simple/src/app/globals.css +0 -8
- package/templates/simple/src/app/layout.tsx +0 -18
- package/templates/simple/src/app/page.tsx +0 -8
- /package/templates/{moderate → advanced}/utils/async.ts +0 -0
- /package/templates/{moderate → advanced}/utils/date.ts +0 -0
- /package/templates/{moderate → advanced}/utils/index.ts +0 -0
- /package/templates/{moderate → advanced}/utils/number.ts +0 -0
- /package/templates/{moderate → advanced}/utils/string.ts +0 -0
- /package/templates/{moderate → standard}/next-env.d.ts +0 -0
- /package/templates/{saas → standard}/utils/async.ts +0 -0
- /package/templates/{saas → standard}/utils/date.ts +0 -0
- /package/templates/{saas → standard}/utils/index.ts +0 -0
- /package/templates/{saas → standard}/utils/number.ts +0 -0
- /package/templates/{saas → standard}/utils/string.ts +0 -0
- /package/templates/{saas → starter}/next-env.d.ts +0 -0
- /package/templates/{moderate → starter}/src/app/layout.tsx +0 -0
- /package/templates/{moderate → starter}/src/app/page.tsx +0 -0
- /package/templates/{simple → starter}/utils/async.ts +0 -0
- /package/templates/{simple → starter}/utils/date.ts +0 -0
- /package/templates/{simple → starter}/utils/index.ts +0 -0
- /package/templates/{simple → starter}/utils/number.ts +0 -0
- /package/templates/{simple → starter}/utils/string.ts +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
|
|
2
|
+
|
|
3
|
+
export default function DashboardPage() {
|
|
4
|
+
return (
|
|
5
|
+
<main className="container mx-auto p-6">
|
|
6
|
+
<h1 className="text-3xl font-bold mb-6">Dashboard</h1>
|
|
7
|
+
|
|
8
|
+
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
|
9
|
+
<Card>
|
|
10
|
+
<CardHeader>
|
|
11
|
+
<CardTitle>Total Users</CardTitle>
|
|
12
|
+
</CardHeader>
|
|
13
|
+
<CardContent>
|
|
14
|
+
<p className="text-3xl font-bold">1,234</p>
|
|
15
|
+
<p className="text-sm text-muted-foreground mt-2">
|
|
16
|
+
+12% from last month
|
|
17
|
+
</p>
|
|
18
|
+
</CardContent>
|
|
19
|
+
</Card>
|
|
20
|
+
|
|
21
|
+
<Card>
|
|
22
|
+
<CardHeader>
|
|
23
|
+
<CardTitle>Revenue</CardTitle>
|
|
24
|
+
</CardHeader>
|
|
25
|
+
<CardContent>
|
|
26
|
+
<p className="text-3xl font-bold">$45,231</p>
|
|
27
|
+
<p className="text-sm text-muted-foreground mt-2">
|
|
28
|
+
+8% from last month
|
|
29
|
+
</p>
|
|
30
|
+
</CardContent>
|
|
31
|
+
</Card>
|
|
32
|
+
|
|
33
|
+
<Card>
|
|
34
|
+
<CardHeader>
|
|
35
|
+
<CardTitle>Active Sessions</CardTitle>
|
|
36
|
+
</CardHeader>
|
|
37
|
+
<CardContent>
|
|
38
|
+
<p className="text-3xl font-bold">573</p>
|
|
39
|
+
<p className="text-sm text-muted-foreground mt-2">Live now</p>
|
|
40
|
+
</CardContent>
|
|
41
|
+
</Card>
|
|
42
|
+
</div>
|
|
43
|
+
</main>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export default function DashboardLayout({
|
|
4
|
+
children,
|
|
5
|
+
}: {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}) {
|
|
8
|
+
return (
|
|
9
|
+
<div className="min-h-screen flex">
|
|
10
|
+
{/* Sidebar placeholder */}
|
|
11
|
+
<aside className="w-64 border-r p-6">
|
|
12
|
+
<h2 className="text-lg font-bold mb-6">Menu</h2>
|
|
13
|
+
<nav className="space-y-2">
|
|
14
|
+
<a href="/dashboard" className="block py-2 hover:underline">
|
|
15
|
+
Dashboard
|
|
16
|
+
</a>
|
|
17
|
+
<a href="/dashboard/users" className="block py-2 hover:underline">
|
|
18
|
+
Users
|
|
19
|
+
</a>
|
|
20
|
+
<a href="/dashboard/settings" className="block py-2 hover:underline">
|
|
21
|
+
Settings
|
|
22
|
+
</a>
|
|
23
|
+
</nav>
|
|
24
|
+
</aside>
|
|
25
|
+
|
|
26
|
+
{/* Main content */}
|
|
27
|
+
<div className="flex-1">{children}</div>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
// Public layout - for unauthenticated pages like landing, login, signup
|
|
3
|
+
// Nested layouts allow different shells for different route groups
|
|
4
|
+
|
|
5
|
+
export default function PublicLayout({
|
|
6
|
+
children,
|
|
7
|
+
}: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}) {
|
|
10
|
+
return (
|
|
11
|
+
<div className="min-h-screen">
|
|
12
|
+
{/* Public pages don't need the full header/footer */}
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default function LoginPage() {
|
|
2
|
+
return (
|
|
3
|
+
<main className="min-h-screen flex items-center justify-center p-6">
|
|
4
|
+
<div className="w-full max-w-md border rounded-lg p-6">
|
|
5
|
+
<h1 className="text-2xl font-bold mb-6">Sign In</h1>
|
|
6
|
+
<form className="space-y-4">
|
|
7
|
+
<div>
|
|
8
|
+
<label className="block text-sm font-medium mb-2">Email</label>
|
|
9
|
+
<input
|
|
10
|
+
type="email"
|
|
11
|
+
className="w-full px-3 py-2 border rounded-md"
|
|
12
|
+
placeholder="you@example.com"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<div>
|
|
16
|
+
<label className="block text-sm font-medium mb-2">Password</label>
|
|
17
|
+
<input
|
|
18
|
+
type="password"
|
|
19
|
+
className="w-full px-3 py-2 border rounded-md"
|
|
20
|
+
placeholder="••••••••"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
<button
|
|
24
|
+
type="submit"
|
|
25
|
+
className="w-full bg-foreground text-background py-2 rounded-md hover:opacity-90"
|
|
26
|
+
>
|
|
27
|
+
Sign In
|
|
28
|
+
</button>
|
|
29
|
+
</form>
|
|
30
|
+
</div>
|
|
31
|
+
</main>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
@import 'tw-animate-css';
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--background: 0 0% 100%;
|
|
8
|
+
--foreground: 0 0% 3.9%;
|
|
9
|
+
--muted: 0 0% 96.1%;
|
|
10
|
+
--muted-foreground: 0 0% 45.1%;
|
|
11
|
+
--border: 0 0% 89.8%;
|
|
12
|
+
--radius: 0.5rem;
|
|
13
|
+
--card: oklch(1 0 0);
|
|
14
|
+
--card-foreground: oklch(0.145 0 0);
|
|
15
|
+
--popover: oklch(1 0 0);
|
|
16
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
17
|
+
--primary: oklch(0.205 0 0);
|
|
18
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
19
|
+
--secondary: oklch(0.97 0 0);
|
|
20
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
21
|
+
--accent: oklch(0.97 0 0);
|
|
22
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
23
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
24
|
+
--destructive-foreground: oklch(0.577 0.245 27.325);
|
|
25
|
+
--input: oklch(0.922 0 0);
|
|
26
|
+
--ring: oklch(0.708 0 0);
|
|
27
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
28
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
29
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
30
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
31
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
32
|
+
--sidebar: oklch(0.985 0 0);
|
|
33
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
34
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
35
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
36
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
37
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
38
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
39
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark {
|
|
43
|
+
--background: 0 0% 3.9%;
|
|
44
|
+
--foreground: 0 0% 98%;
|
|
45
|
+
--muted: 0 0% 14.9%;
|
|
46
|
+
--muted-foreground: 0 0% 63.9%;
|
|
47
|
+
--border: 0 0% 14.9%;
|
|
48
|
+
--card: oklch(0.145 0 0);
|
|
49
|
+
--card-foreground: oklch(0.985 0 0);
|
|
50
|
+
--popover: oklch(0.145 0 0);
|
|
51
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
52
|
+
--primary: oklch(0.985 0 0);
|
|
53
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
54
|
+
--secondary: oklch(0.269 0 0);
|
|
55
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
56
|
+
--muted: oklch(0.269 0 0);
|
|
57
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
58
|
+
--accent: oklch(0.269 0 0);
|
|
59
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
60
|
+
--destructive: oklch(0.396 0.141 25.723);
|
|
61
|
+
--destructive-foreground: oklch(0.637 0.237 25.331);
|
|
62
|
+
--input: oklch(0.269 0 0);
|
|
63
|
+
--ring: oklch(0.439 0 0);
|
|
64
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
65
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
66
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
67
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
68
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
69
|
+
--sidebar: oklch(0.205 0 0);
|
|
70
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
71
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
72
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
73
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
74
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
75
|
+
--sidebar-border: oklch(0.269 0 0);
|
|
76
|
+
--sidebar-ring: oklch(0.439 0 0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@theme inline {
|
|
80
|
+
/* optional: --font-sans, --font-serif, --font-mono if they are applied in the layout.tsx */
|
|
81
|
+
--color-background: var(--background);
|
|
82
|
+
--color-foreground: var(--foreground);
|
|
83
|
+
--color-card: var(--card);
|
|
84
|
+
--color-card-foreground: var(--card-foreground);
|
|
85
|
+
--color-popover: var(--popover);
|
|
86
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
87
|
+
--color-primary: var(--primary);
|
|
88
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
89
|
+
--color-secondary: var(--secondary);
|
|
90
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
91
|
+
--color-muted: var(--muted);
|
|
92
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
93
|
+
--color-accent: var(--accent);
|
|
94
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
95
|
+
--color-destructive: var(--destructive);
|
|
96
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
97
|
+
--color-border: var(--border);
|
|
98
|
+
--color-input: var(--input);
|
|
99
|
+
--color-ring: var(--ring);
|
|
100
|
+
--color-chart-1: var(--chart-1);
|
|
101
|
+
--color-chart-2: var(--chart-2);
|
|
102
|
+
--color-chart-3: var(--chart-3);
|
|
103
|
+
--color-chart-4: var(--chart-4);
|
|
104
|
+
--color-chart-5: var(--chart-5);
|
|
105
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
106
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
107
|
+
--radius-lg: var(--radius);
|
|
108
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
109
|
+
--color-sidebar: var(--sidebar);
|
|
110
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
111
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
112
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
113
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
114
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
115
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
116
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@layer base {
|
|
120
|
+
* {
|
|
121
|
+
@apply border-border outline-ring/50;
|
|
122
|
+
}
|
|
123
|
+
body {
|
|
124
|
+
@apply bg-background text-foreground;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
* {
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
body {
|
|
133
|
+
margin: 0;
|
|
134
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
135
|
+
background: hsl(var(--background));
|
|
136
|
+
color: hsl(var(--foreground));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.container {
|
|
140
|
+
width: 100%;
|
|
141
|
+
max-width: 1280px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.text-muted-foreground {
|
|
145
|
+
color: hsl(var(--muted-foreground));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.border {
|
|
149
|
+
border: 1px solid hsl(var(--border));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.border-b {
|
|
153
|
+
border-bottom: 1px solid hsl(var(--border));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.border-t {
|
|
157
|
+
border-top: 1px solid hsl(var(--border));
|
|
158
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import './globals.css';
|
|
3
|
+
|
|
4
|
+
export const metadata = {
|
|
5
|
+
title: 'Asynx App',
|
|
6
|
+
description: 'Generated by create-asynx-next-app',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default function RootLayout({
|
|
10
|
+
children,
|
|
11
|
+
}: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}) {
|
|
14
|
+
return (
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<body>
|
|
17
|
+
<div className="min-h-screen flex flex-col">
|
|
18
|
+
{/* Header placeholder - add navigation here */}
|
|
19
|
+
<header className="border-b">
|
|
20
|
+
<div className="container mx-auto px-6 py-4">
|
|
21
|
+
<h1 className="text-xl font-bold">Your App</h1>
|
|
22
|
+
</div>
|
|
23
|
+
</header>
|
|
24
|
+
|
|
25
|
+
{/* Main content area */}
|
|
26
|
+
<div className="flex-1">{children}</div>
|
|
27
|
+
|
|
28
|
+
{/* Footer placeholder */}
|
|
29
|
+
<footer className="border-t py-4">
|
|
30
|
+
<div className="container mx-auto px-6 text-center text-sm text-muted-foreground">
|
|
31
|
+
© {new Date().getFullYear()} Your Company
|
|
32
|
+
</div>
|
|
33
|
+
</footer>
|
|
34
|
+
</div>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function HomePage() {
|
|
2
|
+
return (
|
|
3
|
+
<main className="container mx-auto p-6">
|
|
4
|
+
<h1 className="text-3xl font-bold mb-2">Dashboard</h1>
|
|
5
|
+
<p className="text-muted-foreground mb-6">
|
|
6
|
+
Welcome to your Standard App template
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
10
|
+
<div className="border rounded-lg p-4">
|
|
11
|
+
<h2 className="font-semibold mb-2">Quick Stats</h2>
|
|
12
|
+
<p className="text-sm text-muted-foreground">
|
|
13
|
+
Your metrics at a glance
|
|
14
|
+
</p>
|
|
15
|
+
</div>
|
|
16
|
+
<div className="border rounded-lg p-4">
|
|
17
|
+
<h2 className="font-semibold mb-2">Recent Activity</h2>
|
|
18
|
+
<p className="text-sm text-muted-foreground">Latest updates</p>
|
|
19
|
+
</div>
|
|
20
|
+
<div className="border rounded-lg p-4">
|
|
21
|
+
<h2 className="font-semibold mb-2">Actions</h2>
|
|
22
|
+
<p className="text-sm text-muted-foreground">Get started quickly</p>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</main>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export async function fetcher<T>(url: string): Promise<T> {
|
|
2
|
+
const response = await fetch(url);
|
|
3
|
+
|
|
4
|
+
if (!response.ok) {
|
|
5
|
+
throw new Error(`API error: ${response.status}`);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return response.json();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ApiClient {
|
|
12
|
+
private baseUrl: string;
|
|
13
|
+
|
|
14
|
+
constructor(baseUrl = '/api') {
|
|
15
|
+
this.baseUrl = baseUrl;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async get<T>(endpoint: string): Promise<T> {
|
|
19
|
+
return fetcher<T>(`${this.baseUrl}${endpoint}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async post<T>(endpoint: string, data: unknown): Promise<T> {
|
|
23
|
+
const response = await fetch(`${this.baseUrl}${endpoint}`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: { 'Content-Type': 'application/json' },
|
|
26
|
+
body: JSON.stringify(data),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`API error: ${response.status}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return response.json();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const api = new ApiClient();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const APP_NAME = 'Your App';
|
|
2
|
+
export const APP_DESCRIPTION = 'Built with Asynx Next.js';
|
|
3
|
+
|
|
4
|
+
export const ROUTES = {
|
|
5
|
+
HOME: '/',
|
|
6
|
+
LOGIN: '/login',
|
|
7
|
+
DASHBOARD: '/dashboard',
|
|
8
|
+
SETTINGS: '/settings',
|
|
9
|
+
} as const;
|
|
10
|
+
|
|
11
|
+
export const API_ENDPOINTS = {
|
|
12
|
+
USERS: '/api/users',
|
|
13
|
+
AUTH: '/api/auth',
|
|
14
|
+
} as const;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
3
|
+
"target": "ES2020",
|
|
4
4
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs":
|
|
5
|
+
"allowJs": true,
|
|
6
6
|
"skipLibCheck": true,
|
|
7
7
|
"strict": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
8
|
"noEmit": true,
|
|
10
9
|
"esModuleInterop": true,
|
|
11
10
|
"module": "esnext",
|
|
@@ -13,8 +12,16 @@
|
|
|
13
12
|
"resolveJsonModule": true,
|
|
14
13
|
"isolatedModules": true,
|
|
15
14
|
"jsx": "preserve",
|
|
16
|
-
"incremental": true
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"]
|
|
23
|
+
}
|
|
17
24
|
},
|
|
18
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
25
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
19
26
|
"exclude": ["node_modules"]
|
|
20
27
|
}
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"react-dom": "latest"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
+
"tailwindcss": "^4.0.0",
|
|
17
|
+
"postcss": "^8.4.0",
|
|
18
|
+
"autoprefixer": "^10.4.0",
|
|
19
|
+
"@types/node": "^20.0.0",
|
|
16
20
|
"typescript": "^5.0.0",
|
|
17
21
|
"@types/react": "^18.0.0",
|
|
18
22
|
"@types/react-dom": "^18.0.0"
|
|
@@ -5,16 +5,22 @@
|
|
|
5
5
|
"allowJs": false,
|
|
6
6
|
"skipLibCheck": true,
|
|
7
7
|
"strict": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
8
|
"noEmit": true,
|
|
10
9
|
"esModuleInterop": true,
|
|
11
10
|
"module": "esnext",
|
|
12
11
|
"moduleResolution": "bundler",
|
|
13
12
|
"resolveJsonModule": true,
|
|
14
13
|
"isolatedModules": true,
|
|
15
|
-
"jsx": "
|
|
16
|
-
"incremental": true
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
|
+
"incremental": true,
|
|
16
|
+
"plugins": [{ "name": "next" }]
|
|
17
17
|
},
|
|
18
|
-
"include": [
|
|
18
|
+
"include": [
|
|
19
|
+
"next-env.d.ts",
|
|
20
|
+
"**/*.ts",
|
|
21
|
+
"**/*.tsx",
|
|
22
|
+
".next/types/**/*.ts",
|
|
23
|
+
".next/dev/types/**/*.ts"
|
|
24
|
+
],
|
|
19
25
|
"exclude": ["node_modules"]
|
|
20
26
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import './globals.css';
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
title: 'Asynx App',
|
|
5
|
-
description: 'Generated by create-asynx-next-app',
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function RootLayout({
|
|
9
|
-
children,
|
|
10
|
-
}: {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<html lang="en">
|
|
15
|
-
<body>{children}</body>
|
|
16
|
-
</html>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
-
"allowJs": false,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"strict": true,
|
|
8
|
-
"forceConsistentCasingInFileNames": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true,
|
|
15
|
-
"jsx": "preserve",
|
|
16
|
-
"incremental": true
|
|
17
|
-
},
|
|
18
|
-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
19
|
-
"exclude": ["node_modules"]
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import './globals.css';
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
title: 'Asynx App',
|
|
5
|
-
description: 'Generated by create-asynx-next-app',
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default function RootLayout({
|
|
9
|
-
children,
|
|
10
|
-
}: {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
}) {
|
|
13
|
-
return (
|
|
14
|
-
<html lang="en">
|
|
15
|
-
<body>{children}</body>
|
|
16
|
-
</html>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|