create-better-t-stack 3.7.3 → 3.8.0

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 (33) hide show
  1. package/dist/{cli.js → cli.mjs} +1 -1
  2. package/dist/{index.d.ts → index.d.mts} +112 -254
  3. package/dist/index.mjs +4 -0
  4. package/dist/{src-b1TtTCMt.js → src-BDXa8gsB.mjs} +221 -371
  5. package/package.json +18 -17
  6. package/templates/api/orpc/server/package.json.hbs +0 -3
  7. package/templates/api/trpc/server/package.json.hbs +1 -4
  8. package/templates/auth/better-auth/server/base/package.json.hbs +1 -4
  9. package/templates/backend/convex/packages/backend/convex/README.md +1 -1
  10. package/templates/backend/convex/packages/backend/convex/{schema.ts → schema.ts.hbs} +2 -0
  11. package/templates/backend/convex/packages/backend/package.json.hbs +1 -2
  12. package/templates/backend/server/base/package.json.hbs +1 -3
  13. package/templates/db/base/package.json.hbs +1 -4
  14. package/templates/db/drizzle/base/src/schema/index.ts.hbs +7 -0
  15. package/templates/db/drizzle/mysql/src/index.ts.hbs +8 -0
  16. package/templates/db/drizzle/postgres/src/index.ts.hbs +8 -4
  17. package/templates/db/drizzle/sqlite/src/index.ts.hbs +6 -3
  18. package/templates/examples/todo/convex/packages/backend/convex/todos.ts.hbs +42 -0
  19. package/templates/frontend/native/bare/package.json.hbs +1 -2
  20. package/templates/frontend/native/unistyles/package.json.hbs +1 -2
  21. package/templates/frontend/native/uniwind/package.json.hbs +1 -2
  22. package/templates/frontend/nuxt/package.json.hbs +0 -1
  23. package/templates/frontend/react/next/package.json.hbs +6 -6
  24. package/templates/frontend/react/react-router/package.json.hbs +13 -13
  25. package/templates/frontend/react/tanstack-router/package.json.hbs +7 -8
  26. package/templates/frontend/react/tanstack-start/package.json.hbs +8 -9
  27. package/templates/frontend/solid/package.json.hbs +0 -1
  28. package/templates/frontend/svelte/package.json.hbs +0 -1
  29. package/dist/index.js +0 -4
  30. package/templates/backend/convex/packages/backend/convex/todos.ts +0 -42
  31. /package/dist/{cli.d.ts → cli.d.mts} +0 -0
  32. /package/templates/backend/convex/packages/backend/convex/{healthCheck.ts → healthCheck.ts.hbs} +0 -0
  33. /package/templates/backend/convex/packages/backend/convex/{tsconfig.json → tsconfig.json.hbs} +0 -0
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "create-better-t-stack",
3
- "version": "3.7.3",
3
+ "version": "3.8.0",
4
4
  "description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Aman Varshney",
8
8
  "bin": {
9
- "create-better-t-stack": "dist/cli.js"
9
+ "create-better-t-stack": "dist/cli.mjs"
10
10
  },
11
11
  "files": [
12
12
  "templates",
@@ -57,38 +57,39 @@
57
57
  },
58
58
  "exports": {
59
59
  ".": {
60
- "types": "./dist/index.d.ts",
61
- "import": "./dist/index.js"
60
+ "types": "./dist/index.d.mts",
61
+ "import": "./dist/index.mjs"
62
62
  },
63
63
  "./cli": {
64
- "import": "./dist/cli.js"
64
+ "import": "./dist/cli.mjs"
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@biomejs/js-api": "^3.0.0",
69
- "@biomejs/wasm-nodejs": "^2.2.6",
70
- "@clack/prompts": "^1.0.0-alpha.6",
71
- "@orpc/server": "^1.10.0",
68
+ "@better-t-stack/types": "^3.8.0",
69
+ "@biomejs/js-api": "^4.0.0",
70
+ "@biomejs/wasm-nodejs": "^2.3.8",
71
+ "@clack/prompts": "^1.0.0-alpha.8",
72
+ "@orpc/server": "^1.12.2",
72
73
  "consola": "^3.4.2",
73
- "execa": "^9.6.0",
74
+ "execa": "^9.6.1",
74
75
  "fs-extra": "^11.3.2",
75
76
  "gradient-string": "^3.0.0",
76
77
  "handlebars": "^4.7.8",
77
78
  "jsonc-parser": "^3.3.1",
78
79
  "picocolors": "^1.1.1",
79
80
  "tinyglobby": "^0.2.15",
80
- "trpc-cli": "^0.12.0",
81
+ "trpc-cli": "^0.12.1",
81
82
  "ts-morph": "^27.0.2",
82
- "yaml": "^2.8.1",
83
+ "yaml": "^2.8.2",
83
84
  "zod": "^4.1.13"
84
85
  },
85
86
  "devDependencies": {
86
87
  "@types/fs-extra": "^11.0.4",
87
- "@types/node": "^24.9.1",
88
- "@vitest/ui": "^3.2.4",
89
- "publint": "^0.3.15",
90
- "tsdown": "^0.15.9",
88
+ "@types/node": "^24.10.2",
89
+ "@vitest/ui": "^4.0.15",
90
+ "publint": "^0.3.16",
91
+ "tsdown": "^0.17.2",
91
92
  "typescript": "^5.9.3",
92
- "vitest": "^3.2.4"
93
+ "vitest": "^4.0.15"
93
94
  }
94
95
  }
@@ -11,8 +11,5 @@
11
11
  "type": "module",
12
12
  "scripts": {},
13
13
  "devDependencies": {},
14
- "peerDependencies": {
15
- "typescript": "^5"
16
- },
17
14
  "dependencies": {}
18
15
  }
@@ -10,8 +10,5 @@
10
10
  },
11
11
  "type": "module",
12
12
  "scripts": {},
13
- "devDependencies": {},
14
- "peerDependencies": {
15
- "typescript": "^5"
16
- }
13
+ "devDependencies": {}
17
14
  }
@@ -10,8 +10,5 @@
10
10
  },
11
11
  "type": "module",
12
12
  "scripts": {},
13
- "devDependencies": {},
14
- "peerDependencies": {
15
- "typescript": "^5"
16
- }
13
+ "devDependencies": {}
17
14
  }
@@ -65,7 +65,7 @@ export const myMutationFunction = mutation({
65
65
  const id = await ctx.db.insert("messages", message);
66
66
 
67
67
  // Optionally, return a value from your mutation.
68
- return await ctx.db.get(id);
68
+ return await ctx.db.get("messages", id);
69
69
  },
70
70
  });
71
71
  ```
@@ -2,8 +2,10 @@ import { defineSchema, defineTable } from "convex/server";
2
2
  import { v } from "convex/values";
3
3
 
4
4
  export default defineSchema({
5
+ {{#if (includes examples "todo")}}
5
6
  todos: defineTable({
6
7
  text: v.string(),
7
8
  completed: v.boolean(),
8
9
  }),
10
+ {{/if}}
9
11
  });
@@ -9,8 +9,7 @@
9
9
  "license": "ISC",
10
10
  "description": "",
11
11
  "devDependencies": {
12
- "@types/node": "^24.3.0",
13
- "typescript": "^5.9.2"
12
+ "@types/node": "^24.3.0"
14
13
  },
15
14
  "dependencies": {}
16
15
  }
@@ -13,7 +13,5 @@
13
13
  "supabase"
14
14
  ],
15
15
  {{/if}}
16
- "devDependencies": {
17
- "typescript": "^5.8.2"
18
- }
16
+ "devDependencies": {}
19
17
  }
@@ -10,8 +10,5 @@
10
10
  }
11
11
  },
12
12
  "scripts": {},
13
- "devDependencies": {},
14
- "peerDependencies": {
15
- "typescript": "^5"
16
- }
13
+ "devDependencies": {}
17
14
  }
@@ -0,0 +1,7 @@
1
+ {{#if (eq auth "better-auth")}}
2
+ export * from "./auth";
3
+ {{/if}}
4
+ {{#if (includes examples "todo")}}
5
+ export * from "./todo";
6
+ {{/if}}
7
+ export {};
@@ -7,6 +7,8 @@ dotenv.config({
7
7
  });
8
8
 
9
9
  {{/if}}
10
+ import * as schema from "./schema";
11
+
10
12
  {{#if (eq dbSetup "planetscale")}}
11
13
  import { drizzle } from "drizzle-orm/planetscale-serverless";
12
14
 
@@ -16,6 +18,7 @@ export const db = drizzle({
16
18
  username: process.env.DATABASE_USERNAME,
17
19
  password: process.env.DATABASE_PASSWORD,
18
20
  },
21
+ schema,
19
22
  });
20
23
  {{else}}
21
24
  import { drizzle } from "drizzle-orm/mysql2";
@@ -24,11 +27,14 @@ export const db = drizzle({
24
27
  connection: {
25
28
  uri: process.env.DATABASE_URL,
26
29
  },
30
+ schema,
27
31
  });
28
32
  {{/if}}
29
33
  {{/if}}
30
34
 
31
35
  {{#if (eq runtime "workers")}}
36
+ import * as schema from "./schema";
37
+
32
38
  {{#if (eq dbSetup "planetscale")}}
33
39
  import { drizzle } from "drizzle-orm/planetscale-serverless";
34
40
  import { env } from "cloudflare:workers";
@@ -39,6 +45,7 @@ export const db = drizzle({
39
45
  username: env.DATABASE_USERNAME,
40
46
  password: env.DATABASE_PASSWORD,
41
47
  },
48
+ schema,
42
49
  });
43
50
  {{else}}
44
51
  import { drizzle } from "drizzle-orm/mysql2";
@@ -48,6 +55,7 @@ export const db = drizzle({
48
55
  connection: {
49
56
  uri: env.DATABASE_URL,
50
57
  },
58
+ schema,
51
59
  });
52
60
  {{/if}}
53
61
  {{/if}}
@@ -7,6 +7,8 @@ dotenv.config({
7
7
  });
8
8
 
9
9
  {{/if}}
10
+ import * as schema from "./schema";
11
+
10
12
  {{#if (eq dbSetup "neon")}}
11
13
  import { neon, neonConfig } from '@neondatabase/serverless';
12
14
  import { drizzle } from 'drizzle-orm/neon-http';
@@ -18,15 +20,17 @@ neonConfig.webSocketConstructor = ws;
18
20
  // neonConfig.poolQueryViaFetch = true
19
21
 
20
22
  const sql = neon(process.env.DATABASE_URL || "");
21
- export const db = drizzle(sql);
23
+ export const db = drizzle(sql, { schema });
22
24
  {{else}}
23
25
  import { drizzle } from "drizzle-orm/node-postgres";
24
26
 
25
- export const db = drizzle(process.env.DATABASE_URL || "");
27
+ export const db = drizzle(process.env.DATABASE_URL || "", { schema });
26
28
  {{/if}}
27
29
  {{/if}}
28
30
 
29
31
  {{#if (eq runtime "workers")}}
32
+ import * as schema from "./schema";
33
+
30
34
  {{#if (eq dbSetup "neon")}}
31
35
  import { neon, neonConfig } from '@neondatabase/serverless';
32
36
  import { drizzle } from 'drizzle-orm/neon-http';
@@ -37,11 +41,11 @@ neonConfig.webSocketConstructor = ws;
37
41
  neonConfig.poolQueryViaFetch = true;
38
42
 
39
43
  const sql = neon(env.DATABASE_URL || "");
40
- export const db = drizzle(sql);
44
+ export const db = drizzle(sql, { schema });
41
45
  {{else}}
42
46
  import { drizzle } from "drizzle-orm/node-postgres";
43
47
  import { env } from "cloudflare:workers";
44
48
 
45
- export const db = drizzle(env.DATABASE_URL || "");
49
+ export const db = drizzle(env.DATABASE_URL || "", { schema });
46
50
  {{/if}}
47
51
  {{/if}}
@@ -7,6 +7,7 @@ dotenv.config({
7
7
  });
8
8
 
9
9
  {{/if}}
10
+ import * as schema from "./schema";
10
11
  import { drizzle } from "drizzle-orm/libsql";
11
12
  import { createClient } from "@libsql/client";
12
13
 
@@ -17,15 +18,17 @@ const client = createClient({
17
18
  {{/if}}
18
19
  });
19
20
 
20
- export const db = drizzle({ client });
21
+ export const db = drizzle({ client, schema });
21
22
  {{/if}}
22
23
 
23
24
  {{#if (eq runtime "workers")}}
25
+ import * as schema from "./schema";
26
+
24
27
  {{#if (eq dbSetup "d1")}}
25
28
  import { drizzle } from "drizzle-orm/d1";
26
29
  import { env } from "cloudflare:workers";
27
30
 
28
- export const db = drizzle(env.DB);
31
+ export const db = drizzle(env.DB, { schema });
29
32
  {{else}}
30
33
  import { drizzle } from "drizzle-orm/libsql";
31
34
  import { env } from "cloudflare:workers";
@@ -38,6 +41,6 @@ const client = createClient({
38
41
  {{/if}}
39
42
  });
40
43
 
41
- export const db = drizzle({ client });
44
+ export const db = drizzle({ client, schema });
42
45
  {{/if}}
43
46
  {{/if}}
@@ -0,0 +1,42 @@
1
+ import { query, mutation } from "./_generated/server";
2
+ import { v } from "convex/values";
3
+
4
+ export const getAll = query({
5
+ handler: async (ctx) => {
6
+ return await ctx.db.query("todos").collect();
7
+ },
8
+ });
9
+
10
+ export const create = mutation({
11
+ args: {
12
+ text: v.string(),
13
+ },
14
+ handler: async (ctx, args) => {
15
+ const newTodoId = await ctx.db.insert("todos", {
16
+ text: args.text,
17
+ completed: false,
18
+ });
19
+ return await ctx.db.get("todos", newTodoId);
20
+ },
21
+ });
22
+
23
+ export const toggle = mutation({
24
+ args: {
25
+ id: v.id("todos"),
26
+ completed: v.boolean(),
27
+ },
28
+ handler: async (ctx, args) => {
29
+ await ctx.db.patch("todos", args.id, { completed: args.completed });
30
+ return { success: true };
31
+ },
32
+ });
33
+
34
+ export const deleteTodo = mutation({
35
+ args: {
36
+ id: v.id("todos"),
37
+ },
38
+ handler: async (ctx, args) => {
39
+ await ctx.db.delete("todos", args.id);
40
+ return { success: true };
41
+ },
42
+ });
@@ -44,8 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@babel/core": "^7.26.10",
47
- "@types/react": "~19.1.10",
48
- "typescript": "~5.8.2"
47
+ "@types/react": "~19.1.10"
49
48
  },
50
49
  "private": true
51
50
  }
@@ -46,7 +46,6 @@
46
46
  "devDependencies": {
47
47
  "ajv": "^8.17.1",
48
48
  "@babel/core": "^7.28.0",
49
- "@types/react": "~19.1.10",
50
- "typescript": "~5.9.2"
49
+ "@types/react": "~19.1.10"
51
50
  }
52
51
  }
@@ -48,8 +48,7 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^24.10.0",
51
- "@types/react": "~19.1.0",
52
- "typescript": "~5.9.2"
51
+ "@types/react": "~19.1.0"
53
52
  },
54
53
  "private": true
55
54
  }
@@ -14,7 +14,6 @@
14
14
  "@nuxt/content": "^3.7.1",
15
15
  "@nuxtjs/mdc": "^0.17.4",
16
16
  "nuxt": "^4.1.2",
17
- "typescript": "^5.9.2",
18
17
  "vue": "^3.5.21",
19
18
  "vue-router": "^4.5.1"
20
19
  },
@@ -9,14 +9,14 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "radix-ui": "^1.4.2",
12
- "@tanstack/react-form": "^1.12.3",
12
+ "@tanstack/react-form": "^1.27.3",
13
13
  "class-variance-authority": "^0.7.1",
14
14
  "clsx": "^2.1.1",
15
15
  "lucide-react": "^0.546.0",
16
- "next": "^16.0.7",
16
+ "next": "^16.0.10",
17
17
  "next-themes": "^0.4.6",
18
- "react": "19.1.2",
19
- "react-dom": "19.1.2",
18
+ "react": "19.2.3",
19
+ "react-dom": "19.2.3",
20
20
  "sonner": "^2.0.5",
21
21
  "tailwind-merge": "^3.3.1",
22
22
  "tw-animate-css": "^1.3.4",
@@ -25,8 +25,8 @@
25
25
  "devDependencies": {
26
26
  "@tailwindcss/postcss": "^4.1.10",
27
27
  "@types/node": "^20",
28
- "@types/react": "19.2.2",
29
- "@types/react-dom": "19.2.2",
28
+ "@types/react": "19.2.7",
29
+ "@types/react-dom": "19.2.3",
30
30
  "tailwindcss": "^4.1.10",
31
31
  "typescript": "^5"
32
32
  }
@@ -10,32 +10,32 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "radix-ui": "^1.4.2",
13
- "@react-router/fs-routes": "^7.6.1",
14
- "@react-router/node": "^7.6.1",
15
- "@react-router/serve": "^7.6.1",
16
- "@tanstack/react-form": "^1.12.0",
13
+ "@react-router/fs-routes": "^7.10.1",
14
+ "@react-router/node": "^7.10.1",
15
+ "@react-router/serve": "^7.10.1",
16
+ "@tanstack/react-form": "^1.27.3",
17
17
  "class-variance-authority": "^0.7.1",
18
18
  "clsx": "^2.1.1",
19
19
  "isbot": "^5.1.28",
20
20
  "lucide-react": "^0.511.0",
21
21
  "next-themes": "^0.4.6",
22
- "react": "19.1.2",
23
- "react-dom": "19.1.2",
24
- "react-router": "^7.6.1",
22
+ "react": "19.2.3",
23
+ "react-dom": "19.2.3",
24
+ "react-router": "^7.10.1",
25
25
  "sonner": "^2.0.3",
26
26
  "tailwind-merge": "^3.3.0",
27
27
  "tw-animate-css": "^1.3.2"
28
28
  },
29
29
  "devDependencies": {
30
- "@react-router/dev": "^7.6.1",
31
- "@tailwindcss/vite": "^4.1.8",
30
+ "@react-router/dev": "^7.10.1",
31
+ "@tailwindcss/vite": "^4.1.18",
32
32
  "@types/node": "^20",
33
- "@types/react": "~19.1.10",
34
- "@types/react-dom": "^19.0.4",
33
+ "@types/react": "~19.2.7",
34
+ "@types/react-dom": "^19.2.3",
35
35
  "react-router-devtools": "^1.1.0",
36
- "tailwindcss": "^4.1.8",
36
+ "tailwindcss": "^4.1.18",
37
37
  "typescript": "^5.8.3",
38
- "vite": "^6.3.5",
38
+ "vite": "^7.2.7",
39
39
  "vite-tsconfig-paths": "^5.1.4"
40
40
  }
41
41
  }
@@ -15,26 +15,25 @@
15
15
  "radix-ui": "^1.4.2",
16
16
  "@tanstack/react-form": "^1.12.3",
17
17
  "@tailwindcss/vite": "^4.0.15",
18
- "@tanstack/react-router": "^1.114.25",
18
+ "@tanstack/react-router": "^1.141.1",
19
19
  "class-variance-authority": "^0.7.1",
20
20
  "clsx": "^2.1.1",
21
21
  "lucide-react": "^0.473.0",
22
22
  "next-themes": "^0.4.6",
23
- "react": "19.1.2",
24
- "react-dom": "19.1.2",
23
+ "react": "19.2.3",
24
+ "react-dom": "19.2.3",
25
25
  "sonner": "^2.0.5",
26
26
  "tailwind-merge": "^3.3.1",
27
27
  "tw-animate-css": "^1.2.5"
28
28
  },
29
29
  "devDependencies": {
30
- "@tanstack/react-router-devtools": "^1.114.27",
31
- "@tanstack/router-plugin": "^1.114.27",
30
+ "@tanstack/react-router-devtools": "^1.141.1",
31
+ "@tanstack/router-plugin": "^1.141.1",
32
32
  "@types/node": "^22.13.13",
33
- "@types/react": "~19.1.10",
34
- "@types/react-dom": "^19.0.4",
33
+ "@types/react": "19.2.7",
34
+ "@types/react-dom": "19.2.3",
35
35
  "@vitejs/plugin-react": "^4.3.4",
36
36
  "postcss": "^8.5.3",
37
- "typescript": "^5.8.3",
38
37
  "tailwindcss": "^4.0.15",
39
38
  "vite": "^6.2.2"
40
39
  }
@@ -12,16 +12,16 @@
12
12
  "@tanstack/react-form": "^1.23.5",
13
13
  "@tailwindcss/vite": "^4.1.8",
14
14
  "@tanstack/react-query": "^5.80.6",
15
- "@tanstack/react-router": {{#if (eq auth "clerk")}}"1.134.4"{{else}}"^1.132.31"{{/if}},
15
+ "@tanstack/react-router": "^1.141.1",
16
16
  "@tanstack/react-router-with-query": "^1.130.17",
17
- "@tanstack/react-start": {{#if (eq auth "clerk")}}"1.134.6"{{else}}"^1.132.31"{{/if}},
18
- "@tanstack/router-plugin": {{#if (eq auth "clerk")}}"1.134.4"{{else}}"^1.132.31"{{/if}},
17
+ "@tanstack/react-start": "^1.141.1",
18
+ "@tanstack/router-plugin": "^1.141.1",
19
19
  "class-variance-authority": "^0.7.1",
20
20
  "clsx": "^2.1.1",
21
21
  "lucide-react": "^0.525.0",
22
22
  "next-themes": "^0.4.6",
23
- "react": "19.1.2",
24
- "react-dom": "19.1.2",
23
+ "react": "19.2.3",
24
+ "react-dom": "19.2.3",
25
25
  "sonner": "^2.0.3",
26
26
  "tailwindcss": "^4.1.3",
27
27
  "tailwind-merge": "^3.3.1",
@@ -29,14 +29,13 @@
29
29
  "vite-tsconfig-paths": "^5.1.4"
30
30
  },
31
31
  "devDependencies": {
32
- "@tanstack/react-router-devtools": {{#if (eq auth "clerk")}}"1.134.4"{{else}}"^1.132.31"{{/if}},
32
+ "@tanstack/react-router-devtools": "^1.141.1",
33
33
  "@testing-library/dom": "^10.4.0",
34
34
  "@testing-library/react": "^16.2.0",
35
- "@types/react": "~19.1.10",
36
- "@types/react-dom": "^19.0.4",
35
+ "@types/react": "19.2.7",
36
+ "@types/react-dom": "19.2.3",
37
37
  "@vitejs/plugin-react": "^5.0.4",
38
38
  "jsdom": "^26.0.0",
39
- "typescript": "^5.7.2",
40
39
  "vite": "^7.0.2",
41
40
  "web-vitals": "^5.0.3"
42
41
  }
@@ -18,7 +18,6 @@
18
18
  "tailwindcss": "^4.1.13"
19
19
  },
20
20
  "devDependencies": {
21
- "typescript": "^5.9.2",
22
21
  "vite": "^7.1.5",
23
22
  "vite-plugin-solid": "^2.11.8"
24
23
  }
@@ -19,7 +19,6 @@
19
19
  "svelte": "^5.38.1",
20
20
  "svelte-check": "^4.3.1",
21
21
  "tailwindcss": "^4.1.12",
22
- "typescript": "^5.9.2",
23
22
  "vite": "^7.1.2"
24
23
  },
25
24
  "dependencies": {
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { a as router, i as init, n as createBtsCli, o as sponsors, r as docs, t as builder } from "./src-b1TtTCMt.js";
3
-
4
- export { builder, createBtsCli, docs, init, router, sponsors };
@@ -1,42 +0,0 @@
1
- import { query, mutation } from "./_generated/server";
2
- import { v } from "convex/values";
3
-
4
- export const getAll = query({
5
- handler: async (ctx) => {
6
- return await ctx.db.query("todos").collect();
7
- },
8
- });
9
-
10
- export const create = mutation({
11
- args: {
12
- text: v.string(),
13
- },
14
- handler: async (ctx, args) => {
15
- const newTodoId = await ctx.db.insert("todos", {
16
- text: args.text,
17
- completed: false,
18
- });
19
- return await ctx.db.get(newTodoId);
20
- },
21
- });
22
-
23
- export const toggle = mutation({
24
- args: {
25
- id: v.id("todos"),
26
- completed: v.boolean(),
27
- },
28
- handler: async (ctx, args) => {
29
- await ctx.db.patch(args.id, { completed: args.completed });
30
- return { success: true };
31
- },
32
- });
33
-
34
- export const deleteTodo = mutation({
35
- args: {
36
- id: v.id("todos"),
37
- },
38
- handler: async (ctx, args) => {
39
- await ctx.db.delete(args.id);
40
- return { success: true };
41
- },
42
- });
File without changes