create-stackkit-app 0.4.4 → 0.4.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/README.md +1 -1
- package/dist/index.js +61 -4
- package/dist/lib/code-generator.d.ts +80 -0
- package/dist/lib/code-generator.js +541 -0
- package/dist/lib/create-project.d.ts +20 -1
- package/dist/lib/create-project.js +154 -96
- package/dist/lib/framework-utils.d.ts +22 -0
- package/dist/lib/framework-utils.js +74 -0
- package/dist/lib/utils/logger.d.ts +16 -0
- package/dist/lib/utils/logger.js +59 -0
- package/dist/lib/utils/module-discovery.d.ts +62 -0
- package/dist/lib/utils/module-discovery.js +180 -0
- package/dist/lib/utils/package-utils.js +2 -2
- package/modules/auth/authjs/files/api/auth/[...nextauth]/route.ts +6 -0
- package/modules/auth/authjs/files/lib/auth-client.ts +11 -0
- package/modules/auth/authjs/files/lib/auth.ts +36 -0
- package/modules/auth/authjs/files/schemas/prisma-schema.prisma +45 -0
- package/modules/auth/authjs/module.json +22 -0
- package/modules/auth/better-auth/files/lib/auth-client.ts +7 -0
- package/modules/auth/better-auth/files/lib/auth.ts +77 -1
- package/modules/auth/better-auth/files/lib/email-service.ts +34 -0
- package/modules/auth/better-auth/files/lib/email-templates.ts +89 -0
- package/modules/auth/better-auth/files/schemas/prisma-schema.prisma +7 -7
- package/modules/auth/better-auth/generator.json +83 -0
- package/modules/auth/better-auth/module.json +17 -34
- package/modules/database/mongoose/files/lib/db.ts +63 -0
- package/modules/database/{mongoose-mongodb → mongoose}/files/models/User.ts +0 -5
- package/modules/database/mongoose/generator.json +33 -0
- package/modules/database/mongoose/module.json +15 -0
- package/modules/database/prisma/files/lib/prisma.ts +7 -4
- package/modules/database/prisma/files/prisma/schema.prisma +1 -1
- package/modules/database/prisma/files/prisma.config.ts +2 -2
- package/modules/database/prisma/generator.json +46 -0
- package/modules/database/prisma/module.json +6 -132
- package/package.json +1 -1
- package/templates/express/.env.example +0 -1
- package/templates/express/package.json +4 -4
- package/templates/express/src/app.ts +2 -2
- package/templates/express/src/features/health/health.controller.ts +18 -0
- package/templates/express/src/features/health/health.route.ts +9 -0
- package/templates/express/src/features/health/health.service.ts +6 -0
- package/templates/express/template.json +6 -19
- package/templates/nextjs/lib/env.ts +8 -0
- package/templates/nextjs/package.json +7 -7
- package/templates/nextjs/template.json +5 -1
- package/templates/react-vite/.env.example +1 -2
- package/templates/react-vite/.prettierignore +4 -0
- package/templates/react-vite/.prettierrc +9 -0
- package/templates/react-vite/README.md +22 -0
- package/templates/react-vite/package.json +16 -16
- package/templates/react-vite/src/router.tsx +0 -12
- package/templates/react-vite/template.json +6 -14
- package/templates/react-vite/vite.config.ts +0 -6
- package/dist/lib/utils/config-utils.d.ts +0 -2
- package/dist/lib/utils/config-utils.js +0 -33
- package/dist/lib/utils/file-utils.d.ts +0 -8
- package/dist/lib/utils/file-utils.js +0 -75
- package/dist/lib/utils/module-utils.d.ts +0 -2
- package/dist/lib/utils/module-utils.js +0 -311
- package/modules/auth/clerk/files/express/auth.ts +0 -7
- package/modules/auth/clerk/files/nextjs/auth-provider.tsx +0 -5
- package/modules/auth/clerk/files/nextjs/middleware.ts +0 -9
- package/modules/auth/clerk/files/react/auth-provider.tsx +0 -15
- package/modules/auth/clerk/module.json +0 -115
- package/modules/database/mongoose-mongodb/files/lib/db.ts +0 -78
- package/modules/database/mongoose-mongodb/module.json +0 -70
- package/templates/express/src/features/auth/auth.controller.ts +0 -48
- package/templates/express/src/features/auth/auth.route.ts +0 -10
- package/templates/express/src/features/auth/auth.service.ts +0 -21
- package/templates/react-vite/src/api/services/user.service.ts +0 -18
- package/templates/react-vite/src/pages/UserProfile.tsx +0 -40
- package/templates/react-vite/src/types/user.d.ts +0 -6
|
@@ -5,50 +5,33 @@
|
|
|
5
5
|
"category": "auth",
|
|
6
6
|
"provider": "better-auth",
|
|
7
7
|
"supportedFrameworks": ["nextjs", "express", "react-vite"],
|
|
8
|
+
"compatibility": {
|
|
9
|
+
"frameworks": ["nextjs", "express", "react-vite"],
|
|
10
|
+
"databases": ["prisma", "mongoose"],
|
|
11
|
+
"languages": ["typescript", "javascript"],
|
|
12
|
+
"packageManagers": ["npm", "yarn", "pnpm", "bun"]
|
|
13
|
+
},
|
|
8
14
|
"databaseAdapters": {
|
|
9
15
|
"prisma-postgresql": {
|
|
10
|
-
"adapterCode": "import { prisma } from \"{{dbImport}}\";\nimport { prismaAdapter } from \"@better-auth/prisma\";\n\nexport const auth = betterAuth({\n database: prismaAdapter(prisma, {\n provider: \"postgresql\",\n }),",
|
|
11
|
-
"schema": "files/schemas/prisma-schema.prisma",
|
|
12
|
-
"schemaDestination": "prisma/schema.prisma",
|
|
13
16
|
"dependencies": {
|
|
14
|
-
"
|
|
17
|
+
"@prisma/adapter-pg": "^5.0.0",
|
|
18
|
+
"pg": "^8.0.0"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"prisma-mongodb": {
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
"dependencies": {}
|
|
23
|
+
},
|
|
24
|
+
"prisma-mysql": {
|
|
21
25
|
"dependencies": {
|
|
22
|
-
"
|
|
26
|
+
"@prisma/adapter-mariadb": "^5.0.0",
|
|
27
|
+
"mysql2": "^3.0.0"
|
|
23
28
|
}
|
|
24
29
|
},
|
|
25
|
-
"
|
|
26
|
-
"adapterCode": "import { client } from \"{{dbImport}}\";\nimport { mongodbAdapter } from \"better-auth/adapters/mongodb\";\n\nexport const auth = betterAuth({\n database: mongodbAdapter(client),",
|
|
30
|
+
"prisma-sqlite": {
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"better-
|
|
32
|
+
"@prisma/adapter-better-sqlite3": "^5.0.0",
|
|
33
|
+
"better-sqlite3": "^9.0.0"
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
|
-
}
|
|
32
|
-
"envVars": [
|
|
33
|
-
{
|
|
34
|
-
"key": "BETTER_AUTH_SECRET",
|
|
35
|
-
"value": "",
|
|
36
|
-
"description": "Secret key for Better Auth. Generate with: openssl rand -base64 32",
|
|
37
|
-
"required": true
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"key": "BETTER_AUTH_URL",
|
|
41
|
-
"value": "http://localhost:3000",
|
|
42
|
-
"description": "Base URL of your application (change in production)",
|
|
43
|
-
"required": true
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
"patches": [
|
|
47
|
-
{
|
|
48
|
-
"type": "create-file",
|
|
49
|
-
"description": "Create Better Auth configuration",
|
|
50
|
-
"source": "files/lib/auth.ts",
|
|
51
|
-
"destination": "{{lib}}/auth.ts"
|
|
52
|
-
}
|
|
53
|
-
]
|
|
36
|
+
}
|
|
54
37
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import mongoose from "mongoose";
|
|
2
|
+
|
|
3
|
+
type MongooseCache = {
|
|
4
|
+
conn: typeof mongoose | null;
|
|
5
|
+
promise: Promise<typeof mongoose> | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const globalWithMongoose = globalThis as unknown as {
|
|
9
|
+
mongoose: MongooseCache;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Initialize the cache if not already present
|
|
13
|
+
const cached = globalWithMongoose.mongoose || {
|
|
14
|
+
conn: null,
|
|
15
|
+
promise: null,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
if (!globalWithMongoose.mongoose) {
|
|
19
|
+
globalWithMongoose.mongoose = cached;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function dbConnect(): Promise<typeof mongoose> {
|
|
23
|
+
if (cached.conn) {
|
|
24
|
+
return cached.conn;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const uri = process.env.DATABASE_URL as string;
|
|
28
|
+
|
|
29
|
+
if (!cached.promise) {
|
|
30
|
+
const opts = {
|
|
31
|
+
bufferCommands: false,
|
|
32
|
+
connectTimeoutMS: 10000,
|
|
33
|
+
serverSelectionTimeoutMS: 10000,
|
|
34
|
+
// serverApi removed: not needed for mongoose-only connection
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
cached.promise = mongoose
|
|
38
|
+
.connect(uri, opts)
|
|
39
|
+
.then(async (mongooseInstance: typeof mongoose) => {
|
|
40
|
+
console.info("MongoDB connected successfully");
|
|
41
|
+
if (mongoose.connection.db) {
|
|
42
|
+
await mongoose.connection.db.admin().command({ ping: 1 });
|
|
43
|
+
console.info("Pinged your deployment. You successfully connected to MongoDB!");
|
|
44
|
+
}
|
|
45
|
+
return mongooseInstance;
|
|
46
|
+
})
|
|
47
|
+
.catch((error: Error) => {
|
|
48
|
+
console.error("MongoDB connection failed", { error });
|
|
49
|
+
throw error;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
cached.conn = await cached.promise;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
cached.promise = null;
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return cached.conn;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { dbConnect as mongoose, dbConnect as connectMongoose };
|
|
@@ -3,7 +3,6 @@ import mongoose, { Document, Schema } from "mongoose";
|
|
|
3
3
|
export interface IUser extends Document {
|
|
4
4
|
name: string;
|
|
5
5
|
email: string;
|
|
6
|
-
password: string;
|
|
7
6
|
createdAt: Date;
|
|
8
7
|
updatedAt: Date;
|
|
9
8
|
}
|
|
@@ -22,10 +21,6 @@ const UserSchema: Schema = new Schema(
|
|
|
22
21
|
lowercase: true,
|
|
23
22
|
trim: true,
|
|
24
23
|
},
|
|
25
|
-
password: {
|
|
26
|
-
type: String,
|
|
27
|
-
required: true,
|
|
28
|
-
},
|
|
29
24
|
},
|
|
30
25
|
{
|
|
31
26
|
timestamps: true,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mongoose",
|
|
3
|
+
"type": "database",
|
|
4
|
+
"priority": 5,
|
|
5
|
+
"operations": [
|
|
6
|
+
{
|
|
7
|
+
"type": "create-file",
|
|
8
|
+
"source": "lib/db.ts",
|
|
9
|
+
"destination": "src/lib/db.ts"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "create-file",
|
|
13
|
+
"source": "models/User.ts",
|
|
14
|
+
"destination": "src/lib/models.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "create-file",
|
|
18
|
+
"destination": "scripts/seed.ts",
|
|
19
|
+
"condition": { "features": ["seed"] },
|
|
20
|
+
"content": "import dbConnect from '../src/lib/db'\nimport { User } from '../src/lib/models'\n\nasync function main() {\n await dbConnect()\n\n // Create a default user\n const user = await User.findOneAndUpdate(\n { email: 'admin@example.com' },\n {\n email: 'admin@example.com',\n name: 'Admin User',\n role: 'ADMIN',\n },\n { upsert: true, new: true }\n )\n\n console.log('Created user:', user)\n}\n\nmain().catch(console.error)"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"mongoose": "^8.8.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"db:seed": "tsx scripts/seed.ts"
|
|
29
|
+
},
|
|
30
|
+
"envVars": {
|
|
31
|
+
"MONGODB_URI": "mongodb://localhost:27017/database_name"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mongoose",
|
|
3
|
+
"displayName": "Mongoose (MongoDB)",
|
|
4
|
+
"description": "Mongoose ODM for MongoDB database",
|
|
5
|
+
"category": "database",
|
|
6
|
+
"provider": "mongoose",
|
|
7
|
+
"database": "mongodb",
|
|
8
|
+
"supportedFrameworks": ["nextjs", "express"],
|
|
9
|
+
"compatibility": {
|
|
10
|
+
"frameworks": ["nextjs", "express"],
|
|
11
|
+
"databases": ["mongoose"],
|
|
12
|
+
"languages": ["typescript", "javascript"],
|
|
13
|
+
"packageManagers": ["npm", "yarn", "pnpm", "bun"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PrismaClient } from "@/generated/prisma/client";
|
|
1
|
+
import { PrismaClient } from '@prisma/client'
|
|
3
2
|
|
|
4
|
-
{
|
|
3
|
+
const globalForPrisma = globalThis as unknown as {
|
|
4
|
+
prisma: PrismaClient | undefined
|
|
5
|
+
}
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
+
export const prisma = globalForPrisma.prisma ?? new PrismaClient()
|
|
8
|
+
|
|
9
|
+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
import { defineConfig } from "prisma/config";
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
schema: "prisma/schema.prisma",
|
|
@@ -7,6 +7,6 @@ export default defineConfig({
|
|
|
7
7
|
path: "prisma/migrations",
|
|
8
8
|
},
|
|
9
9
|
datasource: {
|
|
10
|
-
url:
|
|
10
|
+
url: env('DATABASE_URL'),
|
|
11
11
|
},
|
|
12
12
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prisma",
|
|
3
|
+
"type": "database",
|
|
4
|
+
"priority": 5,
|
|
5
|
+
"operations": [
|
|
6
|
+
{
|
|
7
|
+
"type": "create-file",
|
|
8
|
+
"destination": "prisma/schema.prisma",
|
|
9
|
+
"content": "// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n\ndatasource db {\n provider = \"{{prismaProvider}}\"\n}\n\nmodel User {\n id String @id {{#if prismaProvider==\"postgresql\"}}@default(cuid()){{/if}}{{#if prismaProvider!=\"postgresql\"}}@default(uuid()){{/if}}\n email String @unique\n name String?\n password String?\n role String @default(\"USER\")\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n\n {{#if auth==\"better-auth\"}}accounts Account[]\n sessions Session[]\n {{/if}}\n}\n\n{{#if auth==\"better-auth\"}}model Account {\n id String @id {{#if prismaProvider==\"postgresql\"}}@default(cuid()){{/if}}{{#if prismaProvider!=\"postgresql\"}}@default(uuid()){{/if}}\n accountId String\n providerId String\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n\n @@unique([providerId, accountId])\n}\n\nmodel Session {\n id String @id {{#if prismaProvider==\"postgresql\"}}@default(cuid()){{/if}}{{#if prismaProvider!=\"postgresql\"}}@default(uuid()){{/if}}\n expiresAt DateTime\n token String @unique\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n userId String\n user User @relation(fields: [userId], references: [id], onDelete: Cascade)\n}\n{{/if}}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "create-file",
|
|
13
|
+
"source": "prisma.config.ts",
|
|
14
|
+
"destination": "prisma.config.ts"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "create-file",
|
|
18
|
+
"source": "lib/prisma.ts",
|
|
19
|
+
"destination": "{{lib}}/prisma.ts"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "create-file",
|
|
23
|
+
"destination": "prisma/seed.ts",
|
|
24
|
+
"condition": { "features": ["seed"] },
|
|
25
|
+
"content": "import { PrismaClient } from '@prisma/client'\n\nconst prisma = new PrismaClient()\n\nasync function main() {\n // Create a default user\n const user = await prisma.user.upsert({\n where: { email: 'admin@example.com' },\n update: {},\n create: {\n email: 'admin@example.com',\n name: 'Admin User',\n role: 'ADMIN',\n },\n })\n console.log('Created user:', user)\n}\n\nmain()\n .then(async () => {\n await prisma.$disconnect()\n })\n .catch(async (e) => {\n console.error(e)\n await prisma.$disconnect()\n process.exit(1)\n })"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"prisma": "^7.2.0",
|
|
30
|
+
"@prisma/client": "^7.2.0",
|
|
31
|
+
"dotenv": "^16.4.5"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"prisma": "^7.2.0"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"db:generate": "prisma generate",
|
|
38
|
+
"db:push": "prisma db push",
|
|
39
|
+
"db:seed": "tsx prisma/seed.ts",
|
|
40
|
+
"db:migrate": "prisma migrate dev",
|
|
41
|
+
"db:studio": "prisma studio"
|
|
42
|
+
},
|
|
43
|
+
"envVars": {
|
|
44
|
+
"DATABASE_URL": "postgresql://username:password@localhost:5432/database_name"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -5,136 +5,10 @@
|
|
|
5
5
|
"category": "database",
|
|
6
6
|
"provider": "prisma",
|
|
7
7
|
"supportedFrameworks": ["nextjs", "express"],
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"postgresql": {
|
|
15
|
-
"@prisma/adapter-pg": "^7.2.0",
|
|
16
|
-
"pg": "^8.16.3"
|
|
17
|
-
},
|
|
18
|
-
"mongodb": {
|
|
19
|
-
"@prisma/client": "6.19"
|
|
20
|
-
},
|
|
21
|
-
"mysql": {
|
|
22
|
-
"@prisma/adapter-mariadb": "^7.2.0"
|
|
23
|
-
},
|
|
24
|
-
"sqlite": {
|
|
25
|
-
"@prisma/adapter-better-sqlite3": "^7.2.0"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"common": {
|
|
31
|
-
"prisma": "^7.2.0",
|
|
32
|
-
"tsx": "^4.21.0"
|
|
33
|
-
},
|
|
34
|
-
"providers": {
|
|
35
|
-
"postgresql": {
|
|
36
|
-
"@types/pg": "^8.16.0"
|
|
37
|
-
},
|
|
38
|
-
"mongodb": {
|
|
39
|
-
"prisma": "6.19"
|
|
40
|
-
},
|
|
41
|
-
"mysql": {},
|
|
42
|
-
"sqlite": {
|
|
43
|
-
"@types/better-sqlite3": "^7.6.13"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"envVars": {
|
|
48
|
-
"common": [
|
|
49
|
-
{
|
|
50
|
-
"key": "DATABASE_URL",
|
|
51
|
-
"value": "{{connectionString}}",
|
|
52
|
-
"description": "Database connection URL",
|
|
53
|
-
"required": true
|
|
54
|
-
}
|
|
55
|
-
],
|
|
56
|
-
"providers": {
|
|
57
|
-
"mysql": [
|
|
58
|
-
{
|
|
59
|
-
"key": "DATABASE_HOST",
|
|
60
|
-
"value": "localhost",
|
|
61
|
-
"description": "MySQL host",
|
|
62
|
-
"required": true
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"key": "DATABASE_USER",
|
|
66
|
-
"value": "",
|
|
67
|
-
"description": "MySQL username",
|
|
68
|
-
"required": true
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"key": "DATABASE_PASSWORD",
|
|
72
|
-
"value": "",
|
|
73
|
-
"description": "MySQL password",
|
|
74
|
-
"required": true
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"key": "DATABASE_NAME",
|
|
78
|
-
"value": "mydb",
|
|
79
|
-
"description": "MySQL database name",
|
|
80
|
-
"required": true
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"key": "DATABASE_PORT",
|
|
84
|
-
"value": "3306",
|
|
85
|
-
"description": "MySQL port",
|
|
86
|
-
"required": false
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"frameworkPatches": {
|
|
92
|
-
"express": {
|
|
93
|
-
"tsconfig.json": {
|
|
94
|
-
"merge": {
|
|
95
|
-
"compilerOptions": {
|
|
96
|
-
"baseUrl": ".",
|
|
97
|
-
"paths": {
|
|
98
|
-
"@/*": ["./src/*"]
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"include": ["src/**/*"],
|
|
102
|
-
"exclude": ["node_modules", "dist", "prisma/migrations"]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"nextjs": {
|
|
107
|
-
"tsconfig.json": {
|
|
108
|
-
"merge": {
|
|
109
|
-
"compilerOptions": {
|
|
110
|
-
"paths": {
|
|
111
|
-
"@/*": ["./*"]
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
"exclude": ["node_modules", ".next", "out", "prisma/migrations"]
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"patches": [
|
|
120
|
-
{
|
|
121
|
-
"type": "create-file",
|
|
122
|
-
"description": "Create Prisma schema",
|
|
123
|
-
"source": "prisma/schema.prisma",
|
|
124
|
-
"destination": "prisma/schema.prisma"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"type": "create-file",
|
|
128
|
-
"description": "Create Prisma config",
|
|
129
|
-
"source": "prisma.config.ts",
|
|
130
|
-
"destination": "prisma.config.ts"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
"type": "create-file",
|
|
134
|
-
"description": "Create Prisma client singleton",
|
|
135
|
-
"source": "lib/prisma.ts",
|
|
136
|
-
"destination": "{{lib}}/prisma.ts"
|
|
137
|
-
}
|
|
138
|
-
],
|
|
139
|
-
"postInstall": ["npx prisma generate"]
|
|
8
|
+
"compatibility": {
|
|
9
|
+
"frameworks": ["nextjs", "express"],
|
|
10
|
+
"databases": ["prisma"],
|
|
11
|
+
"languages": ["typescript", "javascript"],
|
|
12
|
+
"packageManagers": ["npm", "yarn", "pnpm", "bun"]
|
|
13
|
+
}
|
|
140
14
|
}
|
package/package.json
CHANGED
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"@types/cors": "^2.8.19",
|
|
23
23
|
"@types/express": "^5.0.6",
|
|
24
24
|
"@types/morgan": "^1.9.10",
|
|
25
|
-
"@types/node": "^25.0.
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
27
|
-
"@typescript-eslint/parser": "^8.
|
|
25
|
+
"@types/node": "^25.0.8",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
27
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
28
28
|
"cross-env": "^10.1.0",
|
|
29
29
|
"eslint": "^9.39.2",
|
|
30
30
|
"tsx": "^4.21.0",
|
|
31
31
|
"typescript": "^5.9.3"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
|
@@ -3,7 +3,7 @@ import express, { Application, NextFunction, Request, Response } from "express";
|
|
|
3
3
|
import helmet from "helmet";
|
|
4
4
|
import morgan from "morgan";
|
|
5
5
|
import { env } from "./config/env";
|
|
6
|
-
import { authRoutes } from "./features/
|
|
6
|
+
import { authRoutes } from "./features/health/health.route";
|
|
7
7
|
import { errorHandler } from "./middlewares/error.middleware";
|
|
8
8
|
|
|
9
9
|
// app initialization
|
|
@@ -35,7 +35,7 @@ app.get("/", (_req: Request, res: Response) => {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
// routes
|
|
38
|
-
app.use("/api/
|
|
38
|
+
app.use("/api/health", authRoutes);
|
|
39
39
|
|
|
40
40
|
// unhandled routes
|
|
41
41
|
app.use((req: Request, _res: Response, next: NextFunction) => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NextFunction, Request, Response } from "express";
|
|
2
|
+
|
|
3
|
+
const health = async (_req: Request, res: Response, next: NextFunction) => {
|
|
4
|
+
try {
|
|
5
|
+
res.status(200).json({
|
|
6
|
+
success: true,
|
|
7
|
+
message: "API is healthy!",
|
|
8
|
+
timestamp: new Date().toISOString(),
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
});
|
|
11
|
+
} catch (error) {
|
|
12
|
+
next(error);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const healthController = {
|
|
17
|
+
health,
|
|
18
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "express
|
|
2
|
+
"name": "express",
|
|
3
3
|
"displayName": "Express.js",
|
|
4
4
|
"framework": "express",
|
|
5
5
|
"description": "Express.js REST API with TypeScript",
|
|
6
|
+
"compatibility": {
|
|
7
|
+
"databases": ["prisma", "mongoose"],
|
|
8
|
+
"auth": ["better-auth"]
|
|
9
|
+
},
|
|
6
10
|
"files": ["src/", ".gitignore", "package.json", "tsconfig.json", ".env.example"],
|
|
7
11
|
"scripts": {
|
|
8
12
|
"dev": "tsx watch src/server.ts",
|
|
@@ -19,22 +23,5 @@
|
|
|
19
23
|
"lint:fix": "eslint src --ext .js --fix",
|
|
20
24
|
"start": "node src/server.js",
|
|
21
25
|
"start:prod": "cross-env NODE_ENV=production node src/server.js"
|
|
22
|
-
}
|
|
23
|
-
"fileReplacements": [
|
|
24
|
-
{
|
|
25
|
-
"file": "src/server.js",
|
|
26
|
-
"from": "import app from './app'",
|
|
27
|
-
"to": "import app from './app.js'"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"file": "src/app.js",
|
|
31
|
-
"from": "import { env } from './config/env'",
|
|
32
|
-
"to": "import { env } from './config/env.js'"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"file": "src/app.js",
|
|
36
|
-
"from": "import { errorHandler } from './middlewares/error.middleware'",
|
|
37
|
-
"to": "import { errorHandler } from './middlewares/error.middleware.js'"
|
|
38
|
-
}
|
|
39
|
-
]
|
|
26
|
+
}
|
|
40
27
|
}
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"react-dom": "19.2.3"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@tailwindcss/postcss": "^4",
|
|
19
|
-
"@types/node": "^
|
|
20
|
-
"@types/react": "^19",
|
|
21
|
-
"@types/react-dom": "^19",
|
|
22
|
-
"eslint": "^9",
|
|
18
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
19
|
+
"@types/node": "^25.0.8",
|
|
20
|
+
"@types/react": "^19.2.8",
|
|
21
|
+
"@types/react-dom": "^19.2.3",
|
|
22
|
+
"eslint": "^9.39.2",
|
|
23
23
|
"eslint-config-next": "16.1.1",
|
|
24
|
-
"tailwindcss": "^4",
|
|
25
|
-
"typescript": "^5"
|
|
24
|
+
"tailwindcss": "^4.1.18",
|
|
25
|
+
"typescript": "^5.9.3"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "nextjs
|
|
2
|
+
"name": "nextjs",
|
|
3
3
|
"displayName": "Next.js",
|
|
4
4
|
"framework": "nextjs",
|
|
5
5
|
"description": "Next.js 16 App Router with TypeScript",
|
|
6
|
+
"compatibility": {
|
|
7
|
+
"databases": ["prisma", "mongoose"],
|
|
8
|
+
"auth": ["better-auth", "authjs"]
|
|
9
|
+
},
|
|
6
10
|
"files": [
|
|
7
11
|
"app/",
|
|
8
12
|
"public/",
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
VITE_API_URL=http://localhost:3000
|
|
1
|
+
VITE_API_URL=http://localhost:3000
|