stackkit-cli 0.4.2 → 0.4.4

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 (137) hide show
  1. package/README.md +17 -10
  2. package/bin/stackkit.js +10 -1
  3. package/dist/commands/add.js +164 -25
  4. package/dist/commands/init.d.ts +1 -1
  5. package/dist/commands/init.js +34 -29
  6. package/dist/commands/list.js +12 -12
  7. package/dist/index.js +25 -23
  8. package/dist/types/index.d.ts +28 -16
  9. package/dist/utils/code-inject.d.ts +1 -1
  10. package/dist/utils/code-inject.js +6 -6
  11. package/dist/utils/detect.d.ts +1 -1
  12. package/dist/utils/detect.js +48 -44
  13. package/dist/utils/env-editor.js +20 -20
  14. package/dist/utils/files.js +4 -4
  15. package/dist/utils/json-editor.d.ts +3 -3
  16. package/dist/utils/json-editor.js +10 -14
  17. package/dist/utils/logger.d.ts +1 -1
  18. package/dist/utils/logger.js +8 -8
  19. package/dist/utils/package-manager.d.ts +2 -2
  20. package/dist/utils/package-manager.js +33 -26
  21. package/modules/auth/better-auth/files/api/auth/[...all]/route.ts +4 -0
  22. package/modules/auth/better-auth/files/lib/auth.ts +13 -0
  23. package/modules/auth/better-auth/files/schemas/prisma-schema.prisma +63 -0
  24. package/modules/auth/better-auth/module.json +54 -0
  25. package/modules/auth/{clerk-express/files/lib → clerk/files/express}/auth.ts +1 -1
  26. package/modules/auth/{clerk-nextjs/files/lib → clerk/files/nextjs}/auth-provider.tsx +1 -1
  27. package/modules/auth/clerk/files/nextjs/middleware.ts +9 -0
  28. package/modules/auth/{clerk-react/files/lib → clerk/files/react}/auth-provider.tsx +2 -2
  29. package/modules/auth/clerk/module.json +115 -0
  30. package/modules/database/mongoose-mongodb/files/lib/db.ts +45 -7
  31. package/modules/database/mongoose-mongodb/files/models/User.ts +39 -0
  32. package/modules/database/mongoose-mongodb/module.json +59 -7
  33. package/modules/database/prisma/files/lib/prisma.ts +6 -0
  34. package/modules/database/prisma/files/prisma/schema.prisma +8 -0
  35. package/modules/database/prisma/files/prisma.config.ts +12 -0
  36. package/modules/database/prisma/module.json +140 -0
  37. package/package.json +1 -1
  38. package/templates/express/.env.example +3 -0
  39. package/templates/express/eslint.config.cjs +42 -0
  40. package/templates/express/package.json +33 -0
  41. package/templates/express/src/app.ts +51 -0
  42. package/templates/express/src/config/env.ts +12 -0
  43. package/templates/express/src/features/auth/auth.controller.ts +48 -0
  44. package/templates/express/src/features/auth/auth.route.ts +10 -0
  45. package/templates/express/src/features/auth/auth.service.ts +21 -0
  46. package/templates/express/src/middlewares/error.middleware.ts +18 -0
  47. package/templates/{bases/express-base → express}/src/server.ts +3 -3
  48. package/templates/express/template.json +40 -0
  49. package/templates/express/tsconfig.json +30 -0
  50. package/templates/{bases/nextjs-base → nextjs}/app/layout.tsx +1 -5
  51. package/templates/nextjs/app/page.tsx +57 -0
  52. package/templates/{bases/nextjs-base → nextjs}/package.json +2 -1
  53. package/templates/{bases/nextjs-base → nextjs}/template.json +13 -1
  54. package/templates/react-vite/.env.example +2 -0
  55. package/templates/react-vite/README.md +85 -0
  56. package/templates/react-vite/eslint.config.js +23 -0
  57. package/templates/{bases/react-vite-base → react-vite}/index.html +1 -0
  58. package/templates/{bases/react-vite-base → react-vite}/package.json +16 -2
  59. package/templates/react-vite/src/api/client.ts +47 -0
  60. package/templates/react-vite/src/api/services/user.service.ts +18 -0
  61. package/templates/react-vite/src/components/ErrorBoundary.tsx +51 -0
  62. package/templates/react-vite/src/components/Layout.tsx +13 -0
  63. package/templates/react-vite/src/components/Loading.tsx +8 -0
  64. package/templates/react-vite/src/components/SEO.tsx +49 -0
  65. package/templates/react-vite/src/config/constants.ts +5 -0
  66. package/templates/react-vite/src/hooks/index.ts +64 -0
  67. package/templates/react-vite/src/index.css +1 -0
  68. package/templates/react-vite/src/lib/queryClient.ts +12 -0
  69. package/templates/react-vite/src/main.tsx +22 -0
  70. package/templates/react-vite/src/pages/About.tsx +78 -0
  71. package/templates/react-vite/src/pages/Home.tsx +49 -0
  72. package/templates/react-vite/src/pages/NotFound.tsx +24 -0
  73. package/templates/react-vite/src/pages/UserProfile.tsx +40 -0
  74. package/templates/react-vite/src/router.tsx +33 -0
  75. package/templates/react-vite/src/types/api.d.ts +20 -0
  76. package/templates/react-vite/src/types/user.d.ts +6 -0
  77. package/templates/react-vite/src/utils/helpers.ts +51 -0
  78. package/templates/react-vite/src/utils/storage.ts +35 -0
  79. package/templates/react-vite/src/vite-env.d.ts +11 -0
  80. package/templates/react-vite/template.json +46 -0
  81. package/templates/react-vite/tsconfig.json +4 -0
  82. package/templates/react-vite/vite.config.ts +13 -0
  83. package/modules/auth/better-auth-express/files/lib/auth.ts +0 -16
  84. package/modules/auth/better-auth-express/files/routes/auth.ts +0 -12
  85. package/modules/auth/better-auth-express/module.json +0 -38
  86. package/modules/auth/better-auth-nextjs/files/api/auth/[...all]/route.ts +0 -5
  87. package/modules/auth/better-auth-nextjs/files/lib/auth.ts +0 -26
  88. package/modules/auth/better-auth-nextjs/module.json +0 -41
  89. package/modules/auth/better-auth-react/files/lib/auth-client.ts +0 -9
  90. package/modules/auth/better-auth-react/module.json +0 -26
  91. package/modules/auth/clerk-express/module.json +0 -20
  92. package/modules/auth/clerk-nextjs/files/middleware.ts +0 -9
  93. package/modules/auth/clerk-nextjs/module.json +0 -28
  94. package/modules/auth/clerk-react/module.json +0 -19
  95. package/modules/database/drizzle-postgresql/files/drizzle.config.ts +0 -10
  96. package/modules/database/drizzle-postgresql/files/lib/db.ts +0 -7
  97. package/modules/database/drizzle-postgresql/files/lib/schema.ts +0 -8
  98. package/modules/database/drizzle-postgresql/module.json +0 -35
  99. package/modules/database/prisma-mongodb/files/lib/db.ts +0 -9
  100. package/modules/database/prisma-mongodb/files/prisma/schema.prisma +0 -17
  101. package/modules/database/prisma-mongodb/module.json +0 -36
  102. package/modules/database/prisma-postgresql/files/lib/db.ts +0 -9
  103. package/modules/database/prisma-postgresql/files/prisma/schema.prisma +0 -17
  104. package/modules/database/prisma-postgresql/module.json +0 -36
  105. package/templates/bases/express-base/.env.example +0 -2
  106. package/templates/bases/express-base/package.json +0 -23
  107. package/templates/bases/express-base/src/app.ts +0 -34
  108. package/templates/bases/express-base/src/config/env.ts +0 -14
  109. package/templates/bases/express-base/src/middlewares/error.middleware.ts +0 -12
  110. package/templates/bases/express-base/template.json +0 -7
  111. package/templates/bases/express-base/tsconfig.json +0 -14
  112. package/templates/bases/nextjs-base/app/page.tsx +0 -65
  113. package/templates/bases/react-vite-base/README.md +0 -73
  114. package/templates/bases/react-vite-base/eslint.config.js +0 -23
  115. package/templates/bases/react-vite-base/src/App.css +0 -42
  116. package/templates/bases/react-vite-base/src/App.tsx +0 -35
  117. package/templates/bases/react-vite-base/src/index.css +0 -68
  118. package/templates/bases/react-vite-base/src/main.tsx +0 -10
  119. package/templates/bases/react-vite-base/template.json +0 -19
  120. package/templates/bases/react-vite-base/tsconfig.json +0 -7
  121. package/templates/bases/react-vite-base/vite.config.ts +0 -7
  122. /package/templates/{bases/nextjs-base → nextjs}/README.md +0 -0
  123. /package/templates/{bases/nextjs-base → nextjs}/app/favicon.ico +0 -0
  124. /package/templates/{bases/nextjs-base → nextjs}/app/globals.css +0 -0
  125. /package/templates/{bases/nextjs-base → nextjs}/eslint.config.mjs +0 -0
  126. /package/templates/{bases/nextjs-base → nextjs}/next.config.ts +0 -0
  127. /package/templates/{bases/nextjs-base → nextjs}/postcss.config.mjs +0 -0
  128. /package/templates/{bases/nextjs-base → nextjs}/public/file.svg +0 -0
  129. /package/templates/{bases/nextjs-base → nextjs}/public/globe.svg +0 -0
  130. /package/templates/{bases/nextjs-base → nextjs}/public/next.svg +0 -0
  131. /package/templates/{bases/nextjs-base → nextjs}/public/vercel.svg +0 -0
  132. /package/templates/{bases/nextjs-base → nextjs}/public/window.svg +0 -0
  133. /package/templates/{bases/nextjs-base → nextjs}/tsconfig.json +0 -0
  134. /package/templates/{bases/react-vite-base → react-vite}/public/vite.svg +0 -0
  135. /package/templates/{bases/react-vite-base → react-vite}/src/assets/react.svg +0 -0
  136. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.app.json +0 -0
  137. /package/templates/{bases/react-vite-base → react-vite}/tsconfig.node.json +0 -0
@@ -1,16 +0,0 @@
1
- import { betterAuth } from 'better-auth';
2
-
3
- export const auth = betterAuth({
4
- secret: process.env.BETTER_AUTH_SECRET!,
5
- baseURL: process.env.BETTER_AUTH_URL!,
6
-
7
- emailAndPassword: {
8
- enabled: true,
9
- },
10
-
11
- // Uncomment to add database adapter
12
- // database: {
13
- // provider: "pg", // or "mongodb", "mysql"
14
- // url: process.env.DATABASE_URL!,
15
- // },
16
- });
@@ -1,12 +0,0 @@
1
- import { Router } from 'express';
2
- import { auth } from '../lib/auth';
3
-
4
- const router = Router();
5
-
6
- // Mount Better Auth handlers
7
- router.all('/auth/*', async (req, res) => {
8
- const response = await auth.handler(req);
9
- return res.status(response.status).json(response.body);
10
- });
11
-
12
- export default router;
@@ -1,38 +0,0 @@
1
- {
2
- "name": "auth",
3
- "displayName": "Better Auth (Express)",
4
- "description": "Modern authentication with Better Auth for Express",
5
- "category": "auth",
6
- "supportedFrameworks": ["express"],
7
- "dependencies": {
8
- "better-auth": "^1.0.0"
9
- },
10
- "envVars": [
11
- {
12
- "key": "BETTER_AUTH_SECRET",
13
- "value": "",
14
- "description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
15
- "required": true
16
- },
17
- {
18
- "key": "BETTER_AUTH_URL",
19
- "value": "http://localhost:3000",
20
- "description": "Base URL of your application (change in production)",
21
- "required": true
22
- }
23
- ],
24
- "patches": [
25
- {
26
- "type": "create-file",
27
- "description": "Create Better Auth configuration",
28
- "source": "lib/auth.ts",
29
- "destination": "src/lib/auth.ts"
30
- },
31
- {
32
- "type": "create-file",
33
- "description": "Create auth routes",
34
- "source": "routes/auth.ts",
35
- "destination": "src/routes/auth.ts"
36
- }
37
- ]
38
- }
@@ -1,5 +0,0 @@
1
- import { auth } from '@/lib/auth';
2
- import { toNextJsHandler } from 'better-auth/next-js';
3
-
4
- export const { GET, POST } = toNextJsHandler(auth);
5
-
@@ -1,26 +0,0 @@
1
- import { prismaAdapter } from '@better-auth/prisma';
2
- import { betterAuth } from 'better-auth';
3
- import { prisma } from './db';
4
-
5
- export const auth = betterAuth({
6
- database: prismaAdapter(prisma, {
7
- provider: 'postgresql', // Change to 'mongodb' if using MongoDB
8
- }),
9
- emailAndPassword: {
10
- enabled: true,
11
- },
12
- socialProviders: {
13
- // Uncomment to add OAuth providers
14
- // google: {
15
- // clientId: process.env.GOOGLE_CLIENT_ID!,
16
- // clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
17
- // },
18
- // github: {
19
- // clientId: process.env.GITHUB_CLIENT_ID!,
20
- // clientSecret: process.env.GITHUB_CLIENT_SECRET!,
21
- // },
22
- },
23
- });
24
-
25
- export type Session = typeof auth.$Infer.Session;
26
- export type User = typeof auth.$Infer.User;
@@ -1,41 +0,0 @@
1
- {
2
- "name": "auth",
3
- "displayName": "Better Auth (Next.js)",
4
- "description": "Modern authentication with Better Auth for Next.js App Router",
5
- "category": "auth",
6
- "provider": "better-auth",
7
- "supportedFrameworks": ["nextjs"],
8
- "compatibleDatabases": ["prisma-postgresql", "prisma-mongodb"],
9
- "dependencies": {
10
- "better-auth": "^1.1.4",
11
- "@better-auth/prisma": "^1.1.4"
12
- },
13
- "envVars": [
14
- {
15
- "key": "BETTER_AUTH_SECRET",
16
- "value": "",
17
- "description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
18
- "required": true
19
- },
20
- {
21
- "key": "BETTER_AUTH_URL",
22
- "value": "http://localhost:3000",
23
- "description": "Base URL of your application (change in production)",
24
- "required": true
25
- }
26
- ],
27
- "patches": [
28
- {
29
- "type": "create-file",
30
- "description": "Create Better Auth configuration",
31
- "source": "lib/auth.ts",
32
- "destination": "{{lib}}/auth.ts"
33
- },
34
- {
35
- "type": "create-file",
36
- "description": "Create Better Auth API route handler",
37
- "source": "app/api/auth/[...all]/route.ts",
38
- "destination": "{{router}}/api/auth/[...all]/route.ts"
39
- }
40
- ]
41
- }
@@ -1,9 +0,0 @@
1
- import { createAuthClient } from 'better-auth/react';
2
-
3
- export const authClient = createAuthClient({
4
- /** The base URL of the server (optional if you're using the same domain) */
5
- baseURL: import.meta.env.VITE_AUTH_URL || 'http://localhost:3000',
6
- });
7
-
8
- // Export specific methods for convenience
9
- export const { signIn, signUp, signOut, useSession } = authClient;
@@ -1,26 +0,0 @@
1
- {
2
- "name": "auth",
3
- "displayName": "Better Auth (React)",
4
- "description": "Client-side authentication with Better Auth for React",
5
- "category": "auth",
6
- "supportedFrameworks": ["react", "react-vite"],
7
- "dependencies": {
8
- "better-auth": "^1.0.0"
9
- },
10
- "envVars": [
11
- {
12
- "key": "VITE_AUTH_URL",
13
- "value": "http://localhost:3000",
14
- "description": "Base URL of your auth server (optional if same domain)",
15
- "required": false
16
- }
17
- ],
18
- "patches": [
19
- {
20
- "type": "create-file",
21
- "description": "Create Better Auth client configuration",
22
- "source": "lib/auth-client.ts",
23
- "destination": "src/lib/auth-client.ts"
24
- }
25
- ]
26
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "clerk-express",
3
- "displayName": "Clerk (Express)",
4
- "description": "Clerk Authentication for Express.js",
5
- "category": "auth",
6
- "framework": "express",
7
- "dependencies": {
8
- "@clerk/express": "^1.4.5"
9
- },
10
- "env": {
11
- "CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
12
- "CLERK_SECRET_KEY": "sk_test_your_key_here"
13
- },
14
- "files": [
15
- {
16
- "source": "files/lib/auth.ts",
17
- "destination": "lib/auth.ts"
18
- }
19
- ]
20
- }
@@ -1,9 +0,0 @@
1
- import { authMiddleware } from '@clerk/nextjs';
2
-
3
- export default authMiddleware({
4
- publicRoutes: ['/'],
5
- });
6
-
7
- export const config = {
8
- matcher: ['/((?!.+\\.[\\w]+$|_next).*)', '/', '/(api|trpc)(.*)'],
9
- };
@@ -1,28 +0,0 @@
1
- {
2
- "name": "clerk-nextjs",
3
- "displayName": "Clerk (Next.js)",
4
- "description": "Clerk Authentication for Next.js",
5
- "category": "auth",
6
- "framework": "nextjs",
7
- "dependencies": {
8
- "@clerk/nextjs": "^6.10.2"
9
- },
10
- "env": {
11
- "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here",
12
- "CLERK_SECRET_KEY": "sk_test_your_key_here",
13
- "NEXT_PUBLIC_CLERK_SIGN_IN_URL": "/sign-in",
14
- "NEXT_PUBLIC_CLERK_SIGN_UP_URL": "/sign-up",
15
- "NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL": "/",
16
- "NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL": "/"
17
- },
18
- "files": [
19
- {
20
- "source": "files/lib/auth-provider.tsx",
21
- "destination": "lib/auth-provider.tsx"
22
- },
23
- {
24
- "source": "files/middleware.ts",
25
- "destination": "middleware.ts"
26
- }
27
- ]
28
- }
@@ -1,19 +0,0 @@
1
- {
2
- "name": "clerk-react",
3
- "displayName": "Clerk (React)",
4
- "description": "Clerk Authentication for React",
5
- "category": "auth",
6
- "framework": "react-vite",
7
- "dependencies": {
8
- "@clerk/clerk-react": "^5.19.2"
9
- },
10
- "env": {
11
- "VITE_CLERK_PUBLISHABLE_KEY": "pk_test_your_key_here"
12
- },
13
- "files": [
14
- {
15
- "source": "files/lib/auth-provider.tsx",
16
- "destination": "lib/auth-provider.tsx"
17
- }
18
- ]
19
- }
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'drizzle-kit';
2
-
3
- export default defineConfig({
4
- schema: './lib/schema.ts',
5
- out: './drizzle',
6
- dialect: 'postgresql',
7
- dbCredentials: {
8
- url: process.env.DATABASE_URL!,
9
- },
10
- });
@@ -1,7 +0,0 @@
1
- import { drizzle } from 'drizzle-orm/postgres-js';
2
- import postgres from 'postgres';
3
-
4
- const connectionString = process.env.DATABASE_URL!;
5
-
6
- export const client = postgres(connectionString, { prepare: false });
7
- export const db = drizzle(client);
@@ -1,8 +0,0 @@
1
- import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
2
-
3
- export const users = pgTable('users', {
4
- id: serial('id').primaryKey(),
5
- name: text('name').notNull(),
6
- email: text('email').notNull().unique(),
7
- createdAt: timestamp('created_at').defaultNow(),
8
- });
@@ -1,35 +0,0 @@
1
- {
2
- "name": "drizzle-postgresql",
3
- "displayName": "Drizzle + PostgreSQL",
4
- "description": "Drizzle ORM with PostgreSQL",
5
- "category": "database",
6
- "dependencies": {
7
- "drizzle-orm": "^0.36.4",
8
- "postgres": "^3.4.5"
9
- },
10
- "devDependencies": {
11
- "drizzle-kit": "^0.28.1"
12
- },
13
- "scripts": {
14
- "db:generate": "drizzle-kit generate",
15
- "db:migrate": "drizzle-kit migrate",
16
- "db:studio": "drizzle-kit studio"
17
- },
18
- "env": {
19
- "DATABASE_URL": "postgresql://postgres:password@localhost:5432/myapp"
20
- },
21
- "files": [
22
- {
23
- "source": "files/lib/db.ts",
24
- "destination": "lib/db.ts"
25
- },
26
- {
27
- "source": "files/lib/schema.ts",
28
- "destination": "lib/schema.ts"
29
- },
30
- {
31
- "source": "files/drizzle.config.ts",
32
- "destination": "drizzle.config.ts"
33
- }
34
- ]
35
- }
@@ -1,9 +0,0 @@
1
- import { PrismaClient } from '@prisma/client';
2
-
3
- const globalForPrisma = globalThis as unknown as {
4
- prisma: PrismaClient | undefined;
5
- };
6
-
7
- export const db = globalForPrisma.prisma ?? new PrismaClient();
8
-
9
- if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
@@ -1,17 +0,0 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- }
4
-
5
- datasource db {
6
- provider = "mongodb"
7
- url = env("DATABASE_URL")
8
- }
9
-
10
- // Example model - customize as needed
11
- model User {
12
- id String @id @default(auto()) @map("_id") @db.ObjectId
13
- email String @unique
14
- name String?
15
- createdAt DateTime @default(now())
16
- updatedAt DateTime @updatedAt
17
- }
@@ -1,36 +0,0 @@
1
- {
2
- "name": "database",
3
- "displayName": "Prisma + MongoDB",
4
- "description": "Add Prisma ORM with MongoDB database",
5
- "category": "database",
6
- "supportedFrameworks": ["nextjs", "express"],
7
- "dependencies": {
8
- "@prisma/client": "^6.1.0"
9
- },
10
- "devDependencies": {
11
- "prisma": "^6.1.0"
12
- },
13
- "envVars": [
14
- {
15
- "key": "DATABASE_URL",
16
- "value": "mongodb://localhost:27017/mydb",
17
- "description": "MongoDB connection URL",
18
- "required": true
19
- }
20
- ],
21
- "patches": [
22
- {
23
- "type": "create-file",
24
- "description": "Create Prisma schema for MongoDB",
25
- "source": "prisma/schema.prisma",
26
- "destination": "prisma/schema.prisma"
27
- },
28
- {
29
- "type": "create-file",
30
- "description": "Create Prisma client singleton",
31
- "source": "lib/db.ts",
32
- "destination": "{{lib}}/db.ts"
33
- }
34
- ],
35
- "postInstall": ["npx prisma generate"]
36
- }
@@ -1,9 +0,0 @@
1
- import { PrismaClient } from '@prisma/client';
2
-
3
- const globalForPrisma = globalThis as unknown as {
4
- prisma: PrismaClient | undefined;
5
- };
6
-
7
- export const db = globalForPrisma.prisma ?? new PrismaClient();
8
-
9
- if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = db;
@@ -1,17 +0,0 @@
1
- generator client {
2
- provider = "prisma-client-js"
3
- }
4
-
5
- datasource db {
6
- provider = "postgresql"
7
- url = env("DATABASE_URL")
8
- }
9
-
10
- // Example model - customize as needed
11
- model User {
12
- id String @id @default(cuid())
13
- email String @unique
14
- name String?
15
- createdAt DateTime @default(now())
16
- updatedAt DateTime @updatedAt
17
- }
@@ -1,36 +0,0 @@
1
- {
2
- "name": "database",
3
- "displayName": "Prisma + PostgreSQL",
4
- "description": "Add Prisma ORM with PostgreSQL database",
5
- "category": "database",
6
- "supportedFrameworks": ["nextjs", "express"],
7
- "dependencies": {
8
- "@prisma/client": "^6.1.0"
9
- },
10
- "devDependencies": {
11
- "prisma": "^6.1.0"
12
- },
13
- "envVars": [
14
- {
15
- "key": "DATABASE_URL",
16
- "value": "postgresql://user:password@localhost:5432/mydb?schema=public",
17
- "description": "PostgreSQL database connection URL",
18
- "required": true
19
- }
20
- ],
21
- "patches": [
22
- {
23
- "type": "create-file",
24
- "description": "Create Prisma schema",
25
- "source": "prisma/schema.prisma",
26
- "destination": "prisma/schema.prisma"
27
- },
28
- {
29
- "type": "create-file",
30
- "description": "Create Prisma client singleton",
31
- "source": "lib/db.ts",
32
- "destination": "{{lib}}/db.ts"
33
- }
34
- ],
35
- "postInstall": ["npx prisma generate"]
36
- }
@@ -1,2 +0,0 @@
1
- PORT=3000
2
- NODE_ENV=development
@@ -1,23 +0,0 @@
1
- {
2
- "name": "my-app",
3
- "version": "1.0.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "tsx watch src/server.ts",
7
- "build": "tsc",
8
- "start": "node dist/server.js",
9
- "lint": "eslint src"
10
- },
11
- "dependencies": {
12
- "express": "^4.21.2",
13
- "dotenv": "^16.4.7",
14
- "cors": "^2.8.5"
15
- },
16
- "devDependencies": {
17
- "@types/express": "^5.0.0",
18
- "@types/node": "^22.10.5",
19
- "@types/cors": "^2.8.17",
20
- "tsx": "^4.19.2",
21
- "typescript": "^5.7.2"
22
- }
23
- }
@@ -1,34 +0,0 @@
1
- import cors from 'cors';
2
- import express, { Application, NextFunction, Request, Response } from 'express';
3
- import { env } from './config/env';
4
- import { errorHandler } from './middlewares/error.middleware';
5
-
6
- // app initialization
7
- const app: Application = express();
8
- app.use(express.json());
9
-
10
- // cors configuration
11
- app.use(
12
- cors({
13
- origin: [env.app.site_url],
14
- credentials: true,
15
- })
16
- );
17
-
18
- // Home page route
19
- app.get('/', (req: Request, res: Response) => {
20
- res.send('Hello World!');
21
- });
22
-
23
- // unhandled routes
24
- app.use((req: Request, res: Response, next: NextFunction) => {
25
- const error: any = new Error(`Can't find ${req.originalUrl} on this server!`);
26
- error.status = 404;
27
-
28
- next(error);
29
- });
30
-
31
- // Global error handler
32
- app.use(errorHandler);
33
-
34
- export default app;
@@ -1,14 +0,0 @@
1
- import dotenv from 'dotenv';
2
- import path from 'path';
3
-
4
- dotenv.config({ path: path.join(process.cwd(), '.env') });
5
-
6
- const env = {
7
- app: {
8
- port: Number(process.env.PORT) || 3000,
9
- url: process.env.APP_URL || 'http://localhost:3000',
10
- site_url: process.env.SITE_URL || 'http://localhost:5173',
11
- },
12
- };
13
-
14
- export { env };
@@ -1,12 +0,0 @@
1
- import { NextFunction, Request, Response } from 'express';
2
-
3
- export const errorHandler = (err: any, req: Request, res: Response, next: NextFunction) => {
4
- const statusCode = err.status || 500;
5
- const errorMessage = err?.message || 'Internal server error!';
6
-
7
- res.status(statusCode).json({
8
- success: false,
9
- message: errorMessage,
10
- errors: errorMessage,
11
- });
12
- };
@@ -1,7 +0,0 @@
1
- {
2
- "name": "express-base",
3
- "displayName": "Express.js",
4
- "framework": "express",
5
- "description": "Express.js REST API with TypeScript",
6
- "files": ["src/", ".env.example", ".gitignore", "package.json", "tsconfig.json"]
7
- }
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "rootDir": "./src",
4
- "outDir": "./dist",
5
- "module": "ESNext",
6
- "moduleResolution": "node",
7
- "target": "ES2023",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "ignoreDeprecations": "5.0"
11
- },
12
- "include": ["src/**/*"],
13
- "exclude": ["node_modules", "dist"]
14
- }
@@ -1,65 +0,0 @@
1
- import Image from "next/image";
2
-
3
- export default function Home() {
4
- return (
5
- <div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
6
- <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
7
- <Image
8
- className="dark:invert"
9
- src="/next.svg"
10
- alt="Next.js logo"
11
- width={100}
12
- height={20}
13
- priority
14
- />
15
- <div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
16
- <h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
17
- To get started, edit the page.tsx file.
18
- </h1>
19
- <p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
20
- Looking for a starting point or more instructions? Head over to{" "}
21
- <a
22
- href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
23
- className="font-medium text-zinc-950 dark:text-zinc-50"
24
- >
25
- Templates
26
- </a>{" "}
27
- or the{" "}
28
- <a
29
- href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
30
- className="font-medium text-zinc-950 dark:text-zinc-50"
31
- >
32
- Learning
33
- </a>{" "}
34
- center.
35
- </p>
36
- </div>
37
- <div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
38
- <a
39
- className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
40
- href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
41
- target="_blank"
42
- rel="noopener noreferrer"
43
- >
44
- <Image
45
- className="dark:invert"
46
- src="/vercel.svg"
47
- alt="Vercel logomark"
48
- width={16}
49
- height={16}
50
- />
51
- Deploy Now
52
- </a>
53
- <a
54
- className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
55
- href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
56
- target="_blank"
57
- rel="noopener noreferrer"
58
- >
59
- Documentation
60
- </a>
61
- </div>
62
- </main>
63
- </div>
64
- );
65
- }