create-arkos 2.0.0-next.18 → 2.0.0-next.19

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 (26) hide show
  1. package/package.json +1 -1
  2. package/templates/basic/.gitignore.hbs +2 -0
  3. package/templates/basic/jsconfig.json.hbs +3 -3
  4. package/templates/basic/package.json.hbs +28 -12
  5. package/templates/basic/prisma/schema/schema.prisma.hbs +2 -3
  6. package/templates/basic/prisma.config.ts.hbs +10 -0
  7. package/templates/basic/src/modules/auth/dtos/login.dto.ts.hbs +1 -1
  8. package/templates/basic/src/modules/auth/dtos/signup.dto.ts.hbs +1 -1
  9. package/templates/basic/src/modules/auth/dtos/update-me.dto.ts.hbs +1 -1
  10. package/templates/basic/src/modules/auth/dtos/update-password.dto.ts.hbs +1 -1
  11. package/templates/basic/src/modules/auth-permission/auth-permission.service.ts.hbs +4 -6
  12. package/templates/basic/src/modules/auth-permission/dtos/create-auth-permission.dto.ts.hbs +1 -1
  13. package/templates/basic/src/modules/auth-permission/dtos/query-auth-permission.dto.ts.hbs +1 -1
  14. package/templates/basic/src/modules/auth-permission/dtos/update-auth-permission.dto.ts.hbs +1 -1
  15. package/templates/basic/src/modules/auth-role/auth-role.service.ts.hbs +4 -6
  16. package/templates/basic/src/modules/auth-role/dtos/create-auth-role.dto.ts.hbs +1 -1
  17. package/templates/basic/src/modules/auth-role/dtos/query-auth-role.dto.ts.hbs +1 -1
  18. package/templates/basic/src/modules/auth-role/dtos/update-auth-role.dto.ts.hbs +1 -1
  19. package/templates/basic/src/modules/file-upload/file-upload.router.ts.hbs +1 -1
  20. package/templates/basic/src/modules/user/dtos/create-user.dto.ts.hbs +3 -3
  21. package/templates/basic/src/modules/user/dtos/update-user.dto.ts.hbs +3 -3
  22. package/templates/basic/src/modules/user/user.service.ts.hbs +4 -6
  23. package/templates/basic/src/server.ts.hbs +1 -1
  24. package/templates/basic/src/utils/prisma/index.ts.hbs +48 -2
  25. package/templates/basic/src/utils/validation/api-actions.ts.hbs +1 -1
  26. package/templates/basic/tsconfig.json.hbs +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-arkos",
3
- "version": "2.0.0-next.18",
3
+ "version": "2.0.0-next.19",
4
4
  "type": "module",
5
5
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com",
6
6
  "bin": {
@@ -24,6 +24,7 @@ pnpm-lock.yaml
24
24
  /.build
25
25
  /coverage
26
26
  /.nyc_output
27
+ /src/generated
27
28
 
28
29
  # Arkos.js' base uploads directory
29
30
  /uploads
@@ -79,6 +80,7 @@ $RECYCLE.BIN/
79
80
  .dynamodb/
80
81
  .webpack/
81
82
  .next/
83
+ .arkos/
82
84
  .nuxt/
83
85
  .cache/
84
86
  .docz/
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES6",
4
- "module": "es2020",
3
+ "target": "es2022",
4
+ "module": "es2022",
5
5
  "moduleResolution": "bundler",
6
6
  "rootDir": ".",
7
7
  "baseUrl": ".",
@@ -20,5 +20,5 @@
20
20
  }
21
21
  },
22
22
  "include": ["src/**/*.js", "src/**/*.jsx", "packages/**/*.js", "arkos.config.js"],
23
- "exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "build", "dist", "uploads"]
23
+ "exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "build", "dist", "uploads", "src/generated", ".arkos"]
24
24
  }
@@ -2,7 +2,7 @@
2
2
  "name": "{{projectName}}",
3
3
  "version": "1.0.0",
4
4
  "type": "module",
5
- "description": "This RESTful API was generated by create-arkos, read more about Arkos.js at www.arkosjs.com",
5
+ "description": "This RESTful API was generated by create-arkos, read more about Arkos.js at [www.arkosjs.com](https://www.arkosjs.com)",
6
6
  "scripts": {
7
7
  "dev": "arkos dev",
8
8
  "build": "arkos build",
@@ -14,30 +14,46 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  {{#if typescript}}
17
- "typescript": "5.7.3",
18
- "@types/node": "24.0.12",
19
- "@types/express": "5.0.0",
17
+ "typescript": "7.0.2",
18
+ "@types/node": "26.1.1",
19
+ "@types/express": "5.0.6",
20
20
  {{/if}}
21
21
  "tsx-strict": "0.8.0",
22
22
  "tsx": "4.23.1"{{#if (neq prisma.provider "none")}},
23
- "prisma": "6.19.3"
23
+ "prisma": "7.9.0"
24
24
  {{/if}}
25
25
  },
26
26
  "dependencies": {
27
- "arkos": "2.0.0-next.18",
28
- "express": "4.22.2",
29
- "@scalar/express-api-reference": "0.10.2",
30
- "@scalar/api-reference": "1.55.3"{{#if (or (neq prisma.provider "none") validation.type)}},{{/if}}
27
+ "arkos": "2.0.0-next.19",
28
+ "express": "5.2.1",
29
+ "@scalar/express-api-reference": "0.10.11",
30
+ "@scalar/api-reference": "1.63.0"{{#if (or (neq prisma.provider "none") validation.type)}},{{/if}}
31
31
  {{#if (neq prisma.provider "none")}}
32
- "@prisma/client": "6.19.3"{{#if validation.type}},{{/if}}
32
+ "@prisma/client": "7.9.0",
33
+ {{#if (eq prisma.provider "postgresql")}}
34
+ "@prisma/adapter-pg": "7.9.0",
35
+ {{/if}}
36
+ {{#if (eq prisma.provider "cockroachdb")}}
37
+ "@prisma/adapter-pg": "7.9.0",
38
+ {{/if}}
39
+ {{#if (eq prisma.provider "mysql")}}
40
+ "@prisma/adapter-mariadb": "7.9.0",
41
+ {{/if}}
42
+ {{#if (eq prisma.provider "sqlite")}}
43
+ "@prisma/adapter-better-sqlite3": "7.9.0",
44
+ {{/if}}
45
+ {{#if (eq prisma.provider "sqlserver")}}
46
+ "@prisma/adapter-mssql": "7.9.0",
47
+ {{/if}}
48
+ {{#if validation.type}},{{/if}}
33
49
  {{/if}}
34
50
  {{#if (eq validation.type "class-validator")}}
35
51
  "reflect-metadata": "0.2.2",
36
52
  "class-transformer": "0.5.1",
37
- "class-validator": "0.14.1"
53
+ "class-validator": "0.15.1"
38
54
  {{/if}}
39
55
  {{#if (eq validation.type "zod")}}
40
- "zod": "3.25.76"
56
+ "zod": "4.4.3"
41
57
  {{/if}}
42
58
  }
43
59
  }
@@ -1,9 +1,8 @@
1
1
  generator client {
2
- provider = "prisma-client-js"
2
+ provider = "prisma-client"
3
+ output = "../src/generated/prisma"
3
4
  }
4
5
 
5
6
  datasource db {
6
7
  provider = "{{prisma.provider}}"
7
- url = env("DATABASE_URL")
8
8
  }
9
-
@@ -0,0 +1,10 @@
1
+ import { loadEnvironmentVariables } from "arkos/utils";
2
+ loadEnvironmentVariables()
3
+
4
+ import { defineConfig, env } from "prisma/config";
5
+
6
+ export default defineConfig({
7
+ datasource: {
8
+ url: env("DATABASE_URL"),
9
+ },
10
+ });
@@ -8,7 +8,7 @@ const LoginDto = z.object({
8
8
 
9
9
  export default LoginDto;
10
10
  {{#if typescript}}
11
- export type LoginDtoType = z.infer<typeof LoginDto>;
11
+ export type LoginDto = z.infer<typeof LoginDto>;
12
12
  {{/if}}
13
13
  {{/if}}
14
14
  {{#if (eq validation.type "class-validator")}}
@@ -8,7 +8,7 @@ const SignupDto = z.object({
8
8
 
9
9
  export default SignupDto;
10
10
  {{#if typescript}}
11
- export type SignupDtoType = z.infer<typeof SignupDto>;
11
+ export type SignupDto = z.infer<typeof SignupDto>;
12
12
  {{/if}}
13
13
  {{/if}}
14
14
  {{#if (eq validation.type "class-validator")}}
@@ -7,7 +7,7 @@ const UpdateMeDto = z.object({
7
7
 
8
8
  export default UpdateMeDto;
9
9
  {{#if typescript}}
10
- export type UpdateMeDtoType = z.infer<typeof UpdateMeDto>;
10
+ export type UpdateMeDto = z.infer<typeof UpdateMeDto>;
11
11
  {{/if}}
12
12
  {{/if}}
13
13
  {{#if (eq validation.type "class-validator")}}
@@ -8,7 +8,7 @@ const UpdatePasswordDto = z.object({
8
8
 
9
9
  export default UpdatePasswordDto;
10
10
  {{#if typescript}}
11
- export type UpdatePasswordDtoType = z.infer<typeof UpdatePasswordDto>;
11
+ export type UpdatePasswordDto = z.infer<typeof UpdatePasswordDto>;
12
12
  {{/if}}
13
13
  {{/if}}
14
14
  {{#if (eq validation.type "class-validator")}}
@@ -1,11 +1,9 @@
1
- import { BaseService } from "arkos/services";
2
- {{#if typescript}}
3
- import { Prisma } from "@prisma/client"
1
+ import { ArkosPrismaService } from "arkos/services";
4
2
 
5
- class AuthPermissionService extends BaseService<"auth-permission"> {}
3
+ {{#if typescript}}
4
+ class AuthPermissionService extends ArkosPrismaService<"auth-permission"> {}
6
5
  {{else}}
7
-
8
- class AuthPermissionService extends BaseService {}
6
+ class AuthPermissionService extends ArkosPrismaService {}
9
7
  {{/if}}
10
8
 
11
9
  const authPermissionService = new AuthPermissionService("auth-permission");
@@ -12,7 +12,7 @@ const CreateAuthPermissionDto = z.object({
12
12
 
13
13
  export default CreateAuthPermissionDto;
14
14
  {{#if typescript}}
15
- export type CreateAuthPermissionDtoType = z.infer<typeof CreateAuthPermissionDto>;
15
+ export type CreateAuthPermissionDto = z.infer<typeof CreateAuthPermissionDto>;
16
16
  {{/if}}
17
17
  {{/if}}
18
18
  {{#if (eq validation.type "class-validator")}}
@@ -18,7 +18,7 @@ const QueryAuthPermissionDto = z.object({
18
18
 
19
19
  export default QueryAuthPermissionDto;
20
20
  {{#if typescript}}
21
- export type QueryAuthPermissionDtoType = z.infer<typeof QueryAuthPermissionDto>;
21
+ export type QueryAuthPermissionDto = z.infer<typeof QueryAuthPermissionDto>;
22
22
  {{/if}}
23
23
  {{/if}}
24
24
  {{#if (eq validation.type "class-validator")}}
@@ -12,7 +12,7 @@ const UpdateAuthPermissionDto = z.object({
12
12
 
13
13
  export default UpdateAuthPermissionDto;
14
14
  {{#if typescript}}
15
- export type UpdateAuthPermissionDtoType = z.infer<typeof UpdateAuthPermissionDto>;
15
+ export type UpdateAuthPermissionDto = z.infer<typeof UpdateAuthPermissionDto>;
16
16
  {{/if}}
17
17
  {{/if}}
18
18
  {{#if (eq validation.type "class-validator")}}
@@ -1,11 +1,9 @@
1
- import { BaseService } from "arkos/services";
2
- {{#if typescript}}
3
- import { Prisma } from "@prisma/client"
1
+ import { ArkosPrismaService } from "arkos/services";
4
2
 
5
- class AuthRoleService extends BaseService<"auth-role"> {}
3
+ {{#if typescript}}
4
+ class AuthRoleService extends ArkosPrismaService<"auth-role"> {}
6
5
  {{else}}
7
-
8
- class AuthRoleService extends BaseService {}
6
+ class AuthRoleService extends ArkosPrismaService {}
9
7
  {{/if}}
10
8
 
11
9
  const authRoleService = new AuthRoleService("auth-role");
@@ -15,7 +15,7 @@ const CreateAuthRoleDto = z.object({
15
15
 
16
16
  export default CreateAuthRoleDto;
17
17
  {{#if typescript}}
18
- export type CreateAuthRoleDtoType = z.infer<typeof CreateAuthRoleDto>;
18
+ export type CreateAuthRoleDto = z.infer<typeof CreateAuthRoleDto>;
19
19
  {{/if}}
20
20
  {{/if}}
21
21
  {{#if (eq validation.type "class-validator")}}
@@ -22,7 +22,7 @@ const QueryAuthRoleDto = z.object({
22
22
 
23
23
  export default QueryAuthRoleDto;
24
24
  {{#if typescript}}
25
- export type QueryAuthRoleDtoType = z.infer<typeof QueryAuthRoleDto>;
25
+ export type QueryAuthRoleDto = z.infer<typeof QueryAuthRoleDto>;
26
26
  {{/if}}
27
27
  {{/if}}
28
28
  {{#if (eq validation.type "class-validator")}}
@@ -17,7 +17,7 @@ const UpdateAuthRoleDto = z.object({
17
17
 
18
18
  export default UpdateAuthRoleDto;
19
19
  {{#if typescript}}
20
- export type UpdateAuthRoleDtoType = z.infer<typeof UpdateAuthRoleDto>;
20
+ export type UpdateAuthRoleDto = z.infer<typeof UpdateAuthRoleDto>;
21
21
  {{/if}}
22
22
  {{/if}}
23
23
  {{#if (eq validation.type "class-validator")}}
@@ -24,7 +24,7 @@ fileUploadRouteHook.deleteFile({
24
24
 
25
25
  const fileUploadRouter = ArkosRouter({
26
26
  prefix: config?.fileUpload?.baseRoute,
27
- openapi: { tags: ["File Uploads"] },
27
+ openapi: { tags: ["File Upload"] },
28
28
  });
29
29
 
30
30
  fileUploadRouter.load(fileUploadRouteHook);
@@ -20,9 +20,9 @@ const CreateUserDto = z.object({
20
20
  role: z.string(),
21
21
  {{else}}
22
22
  {{#if authentication.multipleRoles}}
23
- roles: z.array(z.nativeEnum(UserRole)),
23
+ roles: z.array(z.enum(UserRole)),
24
24
  {{else}}
25
- role: z.nativeEnum(UserRole),
25
+ role: z.enum(UserRole),
26
26
  {{/if}}
27
27
  {{/if}}
28
28
  {{else}}
@@ -40,7 +40,7 @@ const CreateUserDto = z.object({
40
40
 
41
41
  export default CreateUserDto;
42
42
  {{#if typescript}}
43
- export type CreateUserDtoType = z.infer<typeof CreateUserDto>;
43
+ export type CreateUserDto = z.infer<typeof CreateUserDto>;
44
44
  {{/if}}
45
45
  {{/if}}
46
46
  {{#if (eq validation.type "class-validator")}}
@@ -22,9 +22,9 @@ const UpdateUserDto = z.object({
22
22
  role: z.string().optional(),
23
23
  {{else}}
24
24
  {{#if authentication.multipleRoles}}
25
- roles: z.array(z.nativeEnum(UserRole)).optional(),
25
+ roles: z.array(z.enum(UserRole)).optional(),
26
26
  {{else}}
27
- role: z.nativeEnum(UserRole).optional(),
27
+ role: z.enum(UserRole).optional(),
28
28
  {{/if}}
29
29
  {{/if}}
30
30
  {{else}}
@@ -46,7 +46,7 @@ const UpdateUserDto = z.object({
46
46
 
47
47
  export default UpdateUserDto;
48
48
  {{#if typescript}}
49
- export type UpdateUserDtoType = z.infer<typeof UpdateUserDto>;
49
+ export type UpdateUserDto = z.infer<typeof UpdateUserDto>;
50
50
  {{/if}}
51
51
  {{/if}}
52
52
  {{#if (eq validation.type "class-validator")}}
@@ -1,11 +1,9 @@
1
- import { BaseService } from "arkos/services";
2
- {{#if typescript}}
3
- import { Prisma } from "@prisma/client"
1
+ import { ArkosPrismaService } from "arkos/services";
4
2
 
5
- class UserService extends BaseService<"user"> {}
3
+ {{#if typescript}}
4
+ class UserService extends ArkosPrismaService<"user"> {}
6
5
  {{else}}
7
-
8
- class UserService extends BaseService {}
6
+ class UserService extends ArkosPrismaService {}
9
7
  {{/if}}
10
8
 
11
9
  const userService = new UserService("user");
@@ -1,7 +1,7 @@
1
1
  import app from "@/src/app";
2
2
  import http from "node:http";
3
3
 
4
- await app.build();
4
+ app.build();
5
5
 
6
6
  const server = http.createServer(app);
7
7
 
@@ -1,5 +1,51 @@
1
- import { PrismaClient } from "@prisma/client";
1
+ {{#if (eq prisma.provider "postgresql")}}
2
+ import { PrismaClient } from "@/src/generated/prisma/client";
3
+ import { PrismaPg } from "@prisma/adapter-pg";
2
4
 
3
- export const prisma = new PrismaClient();
5
+ const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL{{#if typescript}} as string{{/if}} });
6
+ export const prisma = new PrismaClient({ adapter });
7
+ {{/if}}
8
+ {{#if (eq prisma.provider "cockroachdb")}}
9
+ import { PrismaClient } from "@/src/generated/prisma/client";
10
+ import { PrismaPg } from "@prisma/adapter-pg";
11
+
12
+ // CockroachDB uses the PostgreSQL wire protocol, so it shares the pg adapter
13
+ const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL{{#if typescript}} as string{{/if}} });
14
+ export const prisma = new PrismaClient({ adapter });
15
+ {{/if}}
16
+ {{#if (eq prisma.provider "mysql")}}
17
+ import { PrismaClient } from "@/src/generated/prisma/client";
18
+ import { PrismaMariaDb } from "@prisma/adapter-mariadb";
19
+
20
+ const dbUrl = new URL(process.env.DATABASE_URL{{#if typescript}} as string{{/if}});
21
+ const adapter = new PrismaMariaDb({
22
+ host: dbUrl.hostname,
23
+ port: Number(dbUrl.port) || 3306,
24
+ user: decodeURIComponent(dbUrl.username),
25
+ password: decodeURIComponent(dbUrl.password),
26
+ database: dbUrl.pathname.replace(/^\//, ""),
27
+ connectionLimit: 5,
28
+ });
29
+ export const prisma = new PrismaClient({ adapter });
30
+ {{/if}}
31
+ {{#if (eq prisma.provider "sqlite")}}
32
+ import { PrismaClient } from "@/src/generated/prisma/client";
33
+ import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
34
+
35
+ const adapter = new PrismaBetterSqlite3({
36
+ url: process.env.DATABASE_URL || "file:./dev.db",
37
+ });
38
+ export const prisma = new PrismaClient({ adapter });
39
+ {{/if}}
40
+ {{#if (eq prisma.provider "sqlserver")}}
41
+ import { PrismaClient } from "@/src/generated/prisma/client";
42
+ import { PrismaMssql } from "@prisma/adapter-mssql";
43
+
44
+ const adapter = new PrismaMssql(process.env.DATABASE_URL{{#if typescript}} as string{{/if}});
45
+ export const prisma = new PrismaClient({ adapter });
46
+ {{/if}}
47
+ {{#if (eq prisma.provider "none")}}
48
+ export const prisma = null;
49
+ {{/if}}
4
50
 
5
51
  export default prisma;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A simple array of available `apiAction` field when using auto generate API (That uses BaseService)
2
+ * A simple array of available `apiAction` field when using auto generate API (That uses ArkosPrismaService)
3
3
  * class behind the scenes.
4
4
  *
5
5
  * Is worth mentioning that this will be addded into `arkos` as an util.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2020",
4
- "module": "es2020",
3
+ "target": "es2022",
4
+ "module": "es2022",
5
5
  "moduleResolution": "bundler",
6
6
  "rootDir": ".",
7
7
  "baseUrl": ".",
@@ -15,11 +15,12 @@
15
15
  "lib": ["es6", "dom"],
16
16
  "noImplicitAny": true,
17
17
  "paths": {
18
- "@/*": ["./*"]
18
+ "@/*": ["./*"],
19
+ "@arkosjs/generated": ["./.arkos/index.d.ts"]
19
20
  }
20
21
  },
21
22
  "include": ["src/**/*.ts", "src/**/*.js", "src/**/*.tsx", "src/**/*.jsx", "arkos.config.ts"],
22
- "exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "temp", "dist", "build", "uploads"],
23
+ "exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "temp", "dist", "build", "uploads", "src/generated", ".arkos"],
23
24
  "watchOptions": {
24
25
  "excludeDirectories": ["**/node_modules", "node_modules"]
25
26
  }