stackkit 0.3.1 → 0.3.2

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.
@@ -69,15 +69,3 @@ model Verification {
69
69
  @@index([identifier])
70
70
  @@map("verification")
71
71
  }
72
-
73
- enum Role {
74
- SUPER_ADMIN
75
- ADMIN
76
- USER
77
- }
78
-
79
- enum UserStatus {
80
- ACTIVE
81
- BLOCKED
82
- DELETED
83
- }
@@ -0,0 +1,11 @@
1
+ enum Role {
2
+ SUPER_ADMIN
3
+ ADMIN
4
+ USER
5
+ }
6
+
7
+ enum UserStatus {
8
+ ACTIVE
9
+ BLOCKED
10
+ DELETED
11
+ }
@@ -222,15 +222,10 @@
222
222
  "condition": { "framework": "react" }
223
223
  },
224
224
  {
225
- "type": "patch-file",
226
- "destination": "prisma/schema.prisma",
227
- "condition": { "database": "prisma" },
228
- "operations": [
229
- {
230
- "type": "add-to-bottom",
231
- "source": "shared/prisma/schema.prisma"
232
- }
233
- ]
225
+ "type": "create-file",
226
+ "source": "shared/prisma/*",
227
+ "destination": "prisma/*",
228
+ "condition": { "database": "prisma" }
234
229
  },
235
230
  {
236
231
  "type": "add-dependency",
@@ -1,7 +1,8 @@
1
1
  generator client {
2
- provider = "prisma-client-js"
2
+ provider = "prisma-client-js"
3
+ output = "../src/generated/prisma"
3
4
  }
4
5
 
5
6
  datasource db {
6
- provider = "{{prismaProvider}}"
7
+ provider = "{{prismaProvider}}"
7
8
  }
@@ -9,7 +9,7 @@ import { defineConfig } from "prisma/config";
9
9
  {{/switch}}
10
10
 
11
11
  export default defineConfig({
12
- schema: "prisma/schema.prisma",
12
+ schema: "./prisma",
13
13
  migrations: {
14
14
  path: "prisma/migrations",
15
15
  },
@@ -34,23 +34,23 @@
34
34
  {
35
35
  "type": "add-script",
36
36
  "scripts": {
37
- "db:generate": "npx prisma generate",
38
- "db:push": "npx prisma db push",
39
- "db:seed": "tsx prisma/seed.ts",
40
- "db:migrate": "npx prisma migrate dev",
41
- "db:studio": "npx prisma studio"
37
+ "generate": "prisma generate",
38
+ "push": "prisma db push",
39
+ "seed": "tsx prisma/seed.ts",
40
+ "migrate": "prisma migrate dev",
41
+ "studio": "prisma studio"
42
42
  }
43
43
  },
44
44
  {
45
45
  "type": "add-dependency",
46
46
  "condition": { "prismaProvider": "postgresql" },
47
47
  "dependencies": {
48
- "@prisma/client": "^7.2.0",
48
+ "@prisma/client": "^7.4.2",
49
49
  "@prisma/adapter-pg": "^7.0.0",
50
50
  "pg": "^8.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "prisma": "^7.2.0"
53
+ "prisma": "^7.4.2"
54
54
  }
55
55
  },
56
56
  {
@@ -64,12 +64,12 @@
64
64
  "type": "add-dependency",
65
65
  "condition": { "prismaProvider": "mysql" },
66
66
  "dependencies": {
67
- "@prisma/client": "^7.2.0",
67
+ "@prisma/client": "^7.4.2",
68
68
  "@prisma/adapter-mariadb": "^7.0.0",
69
69
  "mysql2": "^3.0.0"
70
70
  },
71
71
  "devDependencies": {
72
- "prisma": "^7.2.0"
72
+ "prisma": "^7.4.2"
73
73
  }
74
74
  },
75
75
  {
@@ -83,12 +83,12 @@
83
83
  "type": "add-dependency",
84
84
  "condition": { "prismaProvider": "sqlite" },
85
85
  "dependencies": {
86
- "@prisma/client": "^7.2.0",
86
+ "@prisma/client": "^7.4.2",
87
87
  "@prisma/adapter-better-sqlite3": "^7.0.0",
88
88
  "better-sqlite3": "^9.0.0"
89
89
  },
90
90
  "devDependencies": {
91
- "prisma": "^7.2.0"
91
+ "prisma": "^7.4.2"
92
92
  }
93
93
  },
94
94
  {
@@ -102,10 +102,10 @@
102
102
  "type": "add-dependency",
103
103
  "condition": { "prismaProvider": "mongodb" },
104
104
  "dependencies": {
105
- "@prisma/client": "^6.19.0"
105
+ "@prisma/client": "^7.4.2"
106
106
  },
107
107
  "devDependencies": {
108
- "prisma": "^6.19.0"
108
+ "prisma": "^7.4.2"
109
109
  }
110
110
  },
111
111
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stackkit",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Production-ready CLI to create and extend JavaScript or TypeScript apps with modular stacks.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,5 +1,7 @@
1
+ import { QueryProviders } from "@/components/providers/query-provider";
1
2
  import type { Metadata } from "next";
2
3
  import { Geist, Geist_Mono } from "next/font/google";
4
+ import { Toaster } from "sonner";
3
5
  import "./globals.css";
4
6
 
5
7
  const geistSans = Geist({
@@ -13,8 +15,8 @@ const geistMono = Geist_Mono({
13
15
  });
14
16
 
15
17
  export const metadata: Metadata = {
16
- title: "Create Next App",
17
- description: "Generated by create next app",
18
+ title: "Create Next App - StackKit",
19
+ description: "Generated by create next app with StackKit template",
18
20
  };
19
21
 
20
22
  export default function RootLayout({
@@ -24,7 +26,11 @@ export default function RootLayout({
24
26
  }>) {
25
27
  return (
26
28
  <html lang="en">
27
- <body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
29
+ <head />
30
+ <body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
31
+ <QueryProviders>{children}</QueryProviders>
32
+ <Toaster theme="system" position="top-right" richColors />
33
+ </body>
28
34
  </html>
29
35
  );
30
36
  }
@@ -0,0 +1,37 @@
1
+ "use client";
2
+
3
+ import { isServer, QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
+ import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental";
5
+
6
+ function makeQueryClient() {
7
+ return new QueryClient({
8
+ defaultOptions: {
9
+ queries: {
10
+ staleTime: 60 * 1000,
11
+ },
12
+ },
13
+ });
14
+ }
15
+
16
+ let browserQueryClient: QueryClient | undefined = undefined;
17
+
18
+ function getQueryClient() {
19
+ if (isServer) {
20
+ return makeQueryClient();
21
+ } else {
22
+ if (!browserQueryClient) browserQueryClient = makeQueryClient();
23
+ return browserQueryClient;
24
+ }
25
+ }
26
+
27
+ function QueryProviders({ children }: { children: React.ReactNode }) {
28
+ const queryClient = getQueryClient();
29
+
30
+ return (
31
+ <QueryClientProvider client={queryClient}>
32
+ <ReactQueryStreamedHydration>{children}</ReactQueryStreamedHydration>
33
+ </QueryClientProvider>
34
+ );
35
+ }
36
+
37
+ export { getQueryClient, QueryProviders };
@@ -0,0 +1,48 @@
1
+ import type { AxiosResponse } from "axios";
2
+ import axios, { AxiosError } from "axios";
3
+ import { toast } from "sonner";
4
+ import { envVars } from "../env";
5
+
6
+ const api = axios.create({
7
+ baseURL: envVars.API_URL || "http://localhost:5000/api",
8
+ timeout: 30000,
9
+ headers: {
10
+ "Content-Type": "application/json",
11
+ },
12
+ });
13
+
14
+ api.interceptors.request.use(
15
+ (config) => {
16
+ const token = localStorage.getItem("auth_token");
17
+ if (token) {
18
+ (config.headers as Record<string, string>).Authorization = `Bearer ${token}`;
19
+ }
20
+ return config;
21
+ },
22
+ (error: AxiosError) => {
23
+ return Promise.reject(error);
24
+ },
25
+ );
26
+
27
+ api.interceptors.response.use(
28
+ (response: AxiosResponse) => response,
29
+ (error: AxiosError) => {
30
+ if (error.response?.status === 401) {
31
+ localStorage.removeItem("auth_token");
32
+ toast.error("Session expired. Please login again.");
33
+ } else if (error.response?.status === 403) {
34
+ toast.error("You do not have permission to perform this action.");
35
+ } else if (error.response?.status === 404) {
36
+ toast.error("Resource not found.");
37
+ } else if (error.response?.status === 500) {
38
+ toast.error("Server error. Please try again later.");
39
+ } else if (error.code === "ECONNABORTED") {
40
+ toast.error("Request timeout. Please try again.");
41
+ } else if (!error.response) {
42
+ toast.error("Network error. Please check your connection.");
43
+ }
44
+ return Promise.reject(error);
45
+ },
46
+ );
47
+
48
+ export { api };
@@ -1,9 +1,10 @@
1
1
  interface EnvVars {
2
2
  APP_URL: string;
3
+ API_URL: string;
3
4
  }
4
5
 
5
6
  const loadEnvVars = (): EnvVars => {
6
- const requiredEnvVars = [""];
7
+ const requiredEnvVars = ["NEXT_PUBLIC_API_URL"];
7
8
 
8
9
  requiredEnvVars.forEach((varName) => {
9
10
  if (!process.env[varName]) {
@@ -13,6 +14,7 @@ const loadEnvVars = (): EnvVars => {
13
14
 
14
15
  return {
15
16
  APP_URL: process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3000",
17
+ API_URL: process.env.NEXT_PUBLIC_API_URL || "http://localhost:5000/api",
16
18
  };
17
19
  };
18
20
 
@@ -10,9 +10,13 @@
10
10
  "lint": "eslint"
11
11
  },
12
12
  "dependencies": {
13
+ "@tanstack/react-query": "^5.90.21",
14
+ "@tanstack/react-query-next-experimental": "^5.91.0",
15
+ "axios": "^1.13.5",
13
16
  "next": "16.1.1",
14
17
  "react": "19.2.3",
15
- "react-dom": "19.2.3"
18
+ "react-dom": "19.2.3",
19
+ "sonner": "^2.0.7"
16
20
  },
17
21
  "devDependencies": {
18
22
  "@tailwindcss/postcss": "^4.1.18",
@@ -24,4 +28,4 @@
24
28
  "tailwindcss": "^4.1.18",
25
29
  "typescript": "^5.9.3"
26
30
  }
27
- }
31
+ }
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "files": [
11
11
  "app/",
12
+ "components/",
12
13
  "lib/",
13
14
  "public/",
14
15
  ".env.example",