create-fate 1.7.7 → 1.9.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 (70) hide show
  1. package/bin/create-fate.mjs +50 -8
  2. package/package.json +1 -1
  3. package/templates/fate/_shared/vue-app/package.json +12 -11
  4. package/templates/fate/_shared/vue-app/src/App.css +1 -6
  5. package/templates/fate/_shared/vue-app/vite.config.ts +12 -1
  6. package/templates/fate/drizzle/AGENTS.md +1 -1
  7. package/templates/fate/drizzle/_gitignore +1 -0
  8. package/templates/fate/drizzle/client/package.json +15 -15
  9. package/templates/fate/drizzle/client/pages/layout.tsx +2 -2
  10. package/templates/fate/drizzle/client/src/App.css +1 -6
  11. package/templates/fate/drizzle/package.json +6 -7
  12. package/templates/fate/drizzle/pnpm-workspace.yaml +6 -6
  13. package/templates/fate/drizzle/server/package.json +9 -9
  14. package/templates/fate/graphql/AGENTS.md +2 -2
  15. package/templates/fate/graphql/README.md +12 -0
  16. package/templates/fate/graphql/_gitignore +1 -0
  17. package/templates/fate/graphql/client/package.json +14 -14
  18. package/templates/fate/graphql/client/pages/index.tsx +1 -1
  19. package/templates/fate/graphql/client/pages/layout.tsx +2 -2
  20. package/templates/fate/graphql/client/pages/search.tsx +2 -2
  21. package/templates/fate/graphql/client/src/App.css +1 -6
  22. package/templates/fate/graphql/client/src/fate/graphql.ts +20 -0
  23. package/templates/fate/graphql/client/src/ui/CommentCard.tsx +1 -1
  24. package/templates/fate/graphql/client/src/ui/PostCard.tsx +1 -1
  25. package/templates/fate/graphql/client/src/ui/UserCard.tsx +1 -1
  26. package/templates/fate/graphql/client/vite.config.ts +1 -1
  27. package/templates/fate/graphql/package.json +6 -7
  28. package/templates/fate/graphql/pnpm-workspace.yaml +5 -5
  29. package/templates/fate/graphql/server/README.md +5 -4
  30. package/templates/fate/graphql/server/package.json +19 -19
  31. package/templates/fate/graphql/server/scripts/generate-graphql.tsx +7 -1
  32. package/templates/fate/graphql/server/src/graphql/fate.ts +0 -56
  33. package/templates/fate/graphql/server/src/graphql/schema.tsx +22 -3
  34. package/templates/fate/graphql/server/src/graphql/views.ts +0 -43
  35. package/templates/fate/graphql-client/AGENTS.md +20 -0
  36. package/templates/fate/graphql-client/README.md +16 -14
  37. package/templates/fate/graphql-client/_gitignore +1 -0
  38. package/templates/fate/graphql-client/package.json +14 -13
  39. package/templates/fate/graphql-client/pages/index.tsx +2 -2
  40. package/templates/fate/graphql-client/pnpm-workspace.yaml +5 -6
  41. package/templates/fate/graphql-client/src/App.css +1 -7
  42. package/templates/fate/graphql-client/src/fate/graphql.ts +7 -48
  43. package/templates/fate/graphql-client/src/fate/schema.graphql +48 -0
  44. package/templates/fate/graphql-client/vite.config.ts +1 -11
  45. package/templates/fate/http/AGENTS.md +1 -1
  46. package/templates/fate/http/_gitignore +1 -0
  47. package/templates/fate/http/client/package.json +13 -13
  48. package/templates/fate/http/client/pages/layout.tsx +2 -2
  49. package/templates/fate/http/client/src/App.css +1 -6
  50. package/templates/fate/http/package.json +6 -7
  51. package/templates/fate/http/pnpm-workspace.yaml +6 -6
  52. package/templates/fate/http/server/package.json +8 -8
  53. package/templates/fate/prisma/AGENTS.md +1 -1
  54. package/templates/fate/prisma/_gitignore +1 -0
  55. package/templates/fate/prisma/client/package.json +15 -15
  56. package/templates/fate/prisma/client/pages/layout.tsx +2 -2
  57. package/templates/fate/prisma/client/src/App.css +1 -6
  58. package/templates/fate/prisma/package.json +6 -7
  59. package/templates/fate/prisma/pnpm-workspace.yaml +5 -5
  60. package/templates/fate/prisma/server/package.json +8 -8
  61. package/templates/fate/void/AGENTS.md +23 -0
  62. package/templates/fate/void/_gitignore +1 -0
  63. package/templates/fate/void/db/migrations/20261015035853_better_auth_accounts.sql +3 -0
  64. package/templates/fate/void/db/migrations/meta/20261015035853_snapshot.json +918 -0
  65. package/templates/fate/void/db/migrations/meta/_journal.json +7 -0
  66. package/templates/fate/void/db/schema.ts +20 -3
  67. package/templates/fate/void/package.json +17 -17
  68. package/templates/fate/void/pnpm-workspace.yaml +7 -7
  69. package/templates/fate/void/src/App.css +1 -6
  70. package/templates/fate/void/vite.config.ts +0 -7
@@ -1,4 +1,3 @@
1
- import type { User } from '@app/server/src/graphql/fate.ts';
2
1
  import safeParse from '@nkzw/core/safeParse.js';
3
2
  import Stack, { VStack } from '@nkzw/stack';
4
3
  import { fbs } from 'fbtee';
@@ -7,6 +6,7 @@ import { view } from 'react-fate';
7
6
  import { useFateClient } from 'react-fate';
8
7
  import { ViewRef } from 'react-fate';
9
8
  import { useView } from 'react-fate';
9
+ import type { User } from '../fate/graphql.ts';
10
10
  import { Button } from '../ui/Button.tsx';
11
11
  import Card from '../ui/Card.tsx';
12
12
  import AuthClient from '../user/AuthClient.tsx';
@@ -29,7 +29,7 @@ export default defineConfig({
29
29
  voidReact({ react: { compiler: true } }),
30
30
  ]) ?? []),
31
31
  fate({
32
- module: '@app/server/src/graphql/fate.ts',
32
+ module: './src/fate/graphql.ts',
33
33
  transport: 'graphql',
34
34
  }),
35
35
  ],
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "type": "module",
12
12
  "scripts": {
13
- "build": "dotenv -e server/.env -- vp run --filter '@app/client' --filter '@app/server' build",
13
+ "build": "dotenv run -f server/.env -- vp run --filter '@app/client' --filter '@app/server' build",
14
14
  "dev": "npm-run-all --parallel dev:client dev:server",
15
15
  "dev:client": "cd client && vp dev",
16
16
  "dev:server": "cd server && vp run dev",
@@ -23,11 +23,10 @@
23
23
  "@app/server": "workspace:*",
24
24
  "@nkzw/eslint-plugin": "^2.0.0",
25
25
  "@nkzw/oxlint-config": "^2.0.1",
26
- "@oxc-node/core": "^0.1.0",
27
- "@swc/core": "^1.16.1",
28
- "@types/node": "^26.4.0",
29
- "dotenv": "^17.4.2",
30
- "dotenv-cli": "^11.0.0",
26
+ "@oxc-node/core": "^0.1.7",
27
+ "@swc/core": "^1.16.18",
28
+ "@types/node": "^26.6.5",
29
+ "dotenv": "^18.0.8",
31
30
  "npm-run-all2": "^9.0.3",
32
31
  "prisma": "^7.10.0",
33
32
  "typescript": "^7.0.2",
@@ -39,5 +38,5 @@
39
38
  "node": ">=24.0.0",
40
39
  "pnpm": ">=11.0.0"
41
40
  },
42
- "packageManager": "pnpm@11.0.6"
41
+ "packageManager": "pnpm@12.6.0"
43
42
  }
@@ -5,16 +5,16 @@ packages:
5
5
  allowBuilds:
6
6
  '@prisma/engines': true
7
7
  '@swc/core': true
8
- better-sqlite3: true
8
+ better-sqlite3: false
9
9
  esbuild: true
10
10
  prisma: true
11
11
  sharp: true
12
12
  workerd: true
13
13
 
14
14
  catalog:
15
- vite: npm:@voidzero-dev/vite-plus-core@1.0.0
16
- vite-plus: 1.0.0
17
- vitest: 5.0.2
15
+ vite: npm:@voidzero-dev/vite-plus-core@1.3.0
16
+ vite-plus: 1.3.0
17
+ vitest: 5.0.5
18
18
 
19
19
  minimumReleaseAgeExclude:
20
20
  - '@voidzero-dev/vite-plus-core'
@@ -31,7 +31,7 @@ onlyBuiltDependencies:
31
31
  - unrs-resolver
32
32
 
33
33
  overrides:
34
- better-auth: 1.7.7
34
+ better-auth: 1.7.11
35
35
  kysely: 0.28.17
36
36
  vite: 'catalog:'
37
37
  vitest: 'catalog:'
@@ -14,14 +14,15 @@ vp run dev
14
14
 
15
15
  The server defaults to `http://localhost:9000/graphql`.
16
16
 
17
- To generate the Fate client against this server, point the Vite plugin at:
17
+ The client mapping imports the SDL exported from the Pothos schema during `dev:setup`. From the client directory, configure the Vite plugin with:
18
18
 
19
19
  ```ts
20
20
  fate({
21
- module: '@app/server/src/graphql/fate.ts',
21
+ module: './src/fate/graphql.ts',
22
22
  transport: 'graphql',
23
23
  });
24
24
  ```
25
25
 
26
- The generated client keeps the same Fate roots, views, mutations, store, and cache behavior;
27
- only the transport and server module change.
26
+ Fate derives entity fields, connection roots, mutation inputs, and selected results from the schema.
27
+ The server data views in `src/graphql/views.ts` remain responsible for live-event resolution,
28
+ including authorization and computed fields. They do not define the GraphQL client types.
@@ -16,37 +16,37 @@
16
16
  "prisma": "prisma"
17
17
  },
18
18
  "dependencies": {
19
- "@graphql-tools/utils": "^12.0.0",
20
- "@graphql-yoga/plugin-graphql-sse": "^3.22.0",
21
- "@hono/node-server": "^2.1.1",
19
+ "@graphql-tools/utils": "^12.1.0",
20
+ "@graphql-yoga/plugin-graphql-sse": "^3.24.6",
21
+ "@hono/node-server": "^2.1.5",
22
22
  "@nkzw/core": "^1.3.1",
23
23
  "@nkzw/define-env": "^1.1.0",
24
24
  "@nkzw/fate": "latest",
25
- "@pothos/core": "^4.13.1",
26
- "@pothos/plugin-complexity": "^4.2.1",
27
- "@pothos/plugin-directives": "^4.3.1",
28
- "@pothos/plugin-prisma": "^4.15.0",
29
- "@pothos/plugin-relay": "^4.7.1",
30
- "@pothos/plugin-scope-auth": "^4.1.7",
31
- "@prisma/adapter-pg": "^7.10.0",
32
- "@prisma/client": "^7.10.0",
33
- "better-auth": "^1.7.7",
25
+ "@pothos/core": "^4.15.1",
26
+ "@pothos/plugin-complexity": "^4.2.3",
27
+ "@pothos/plugin-directives": "^4.3.2",
28
+ "@pothos/plugin-prisma": "^4.17.0",
29
+ "@pothos/plugin-relay": "^4.8.1",
30
+ "@pothos/plugin-scope-auth": "^4.2.1",
31
+ "@prisma/adapter-pg": "^7.10.1",
32
+ "@prisma/client": "^7.10.1",
33
+ "better-auth": "^1.7.11",
34
34
  "graphql": "^17.0.2",
35
- "graphql-yoga": "^5.22.0",
36
- "hono": "^4.13.5"
35
+ "graphql-yoga": "^5.24.6",
36
+ "hono": "^4.13.13"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@nkzw/eslint-plugin": "^2.0.0",
40
40
  "@nkzw/oxlint-config": "^2.0.1",
41
- "@oxc-node/core": "^0.1.0",
42
- "@swc/core": "^1.16.1",
43
- "@types/node": "^26.4.0",
44
- "dotenv": "^17.4.2",
41
+ "@oxc-node/core": "^0.1.7",
42
+ "@swc/core": "^1.16.18",
43
+ "@types/node": "^26.6.5",
44
+ "dotenv": "^18.0.8",
45
45
  "glob": "^13.0.6",
46
46
  "nodemon": "^3.1.14",
47
47
  "oxfmt": "^0.65.0",
48
48
  "prisma": "^7.10.0",
49
- "prisma-json-types-generator": "^5.1.1",
49
+ "prisma-json-types-generator": "^5.2.0",
50
50
  "typescript": "^7.0.2",
51
51
  "vite-plus": "catalog:",
52
52
  "vitest": "catalog:"
@@ -3,6 +3,8 @@ import { createHash } from 'node:crypto';
3
3
  import { writeFileSync } from 'node:fs';
4
4
  import { join, posix, relative, sep } from 'node:path';
5
5
  import { styleText } from 'node:util';
6
+ import { printSchemaWithDirectives } from '@graphql-tools/utils';
7
+ import dotenv from 'dotenv';
6
8
  import { globSync } from 'glob';
7
9
  import { format } from 'oxfmt';
8
10
 
@@ -37,4 +39,8 @@ writeFileSync(
37
39
  ),
38
40
  );
39
41
 
40
- console.log(styleText(['green', 'bold'], '✓ Done generating GraphQL schema import map.'));
42
+ dotenv.config({ path: join(root, '.env'), quiet: true });
43
+ const { default: schema } = await import('../src/graphql/schema.tsx');
44
+ writeFileSync(join(path, 'schema.graphql'), printSchemaWithDirectives(schema), 'utf8');
45
+
46
+ console.log(styleText(['green', 'bold'], '✓ Done generating GraphQL schema and import map.'));
@@ -1,4 +1,3 @@
1
- import { graphqlMutation } from '@nkzw/fate';
2
1
  import { createLiveEventBus } from '@nkzw/fate/server';
3
2
  import { createPrismaSourceAdapter } from '@nkzw/fate/server/prisma';
4
3
  import type { AppContext } from './context.tsx';
@@ -11,38 +10,8 @@ import {
11
10
  Root,
12
11
  tagDataView,
13
12
  userDataView,
14
- type Comment,
15
- type Post,
16
- type User,
17
13
  } from './views.ts';
18
14
 
19
- type FateMutationInput<Input extends Record<string, unknown>> = Input & {
20
- args?: Record<string, unknown>;
21
- };
22
-
23
- export type PostAddInput = FateMutationInput<{
24
- content: string;
25
- title: string;
26
- }>;
27
- export type PostLikeInput = FateMutationInput<{
28
- error?: 'boundary' | 'callSite';
29
- id: string;
30
- slow?: boolean;
31
- }>;
32
- export type PostUnlikeInput = FateMutationInput<{
33
- id: string;
34
- }>;
35
- export type CommentAddInput = FateMutationInput<{
36
- content: string;
37
- postId: string;
38
- }>;
39
- export type CommentDeleteInput = FateMutationInput<{
40
- id: string;
41
- }>;
42
- export type UserUpdateInput = FateMutationInput<{
43
- name: string;
44
- }>;
45
-
46
15
  export const live = createLiveEventBus();
47
16
 
48
17
  export const fate = createPrismaSourceAdapter<AppContext>({
@@ -58,28 +27,3 @@ export const viewsByType = {
58
27
  Tag: tagDataView,
59
28
  User: userDataView,
60
29
  } as const;
61
-
62
- export const fateGraphQL = {
63
- mutations: {
64
- 'comment.add': graphqlMutation<Comment, CommentAddInput, Comment>('Comment', {
65
- field: 'commentAdd',
66
- }),
67
- 'comment.delete': graphqlMutation<Comment, CommentDeleteInput, Comment>('Comment', {
68
- field: 'commentDelete',
69
- }),
70
- 'post.add': graphqlMutation<Post, PostAddInput, Post>('Post', {
71
- field: 'postAdd',
72
- }),
73
- 'post.like': graphqlMutation<Post, PostLikeInput, Post>('Post', {
74
- field: 'postLike',
75
- }),
76
- 'post.unlike': graphqlMutation<Post, PostUnlikeInput, Post>('Post', {
77
- field: 'postUnlike',
78
- }),
79
- 'user.update': graphqlMutation<User, UserUpdateInput, User>('User', {
80
- field: 'userUpdate',
81
- }),
82
- },
83
- } as const;
84
-
85
- export * from './views.ts';
@@ -1,14 +1,33 @@
1
1
  import { writeFileSync } from 'node:fs';
2
2
  import './schemaImportMap.tsx';
3
- import { join } from 'node:path';
4
3
  import { printSchemaWithDirectives } from '@graphql-tools/utils';
4
+ import {
5
+ DirectiveLocation,
6
+ GraphQLBoolean,
7
+ GraphQLDirective,
8
+ GraphQLString,
9
+ specifiedDirectives,
10
+ } from 'graphql';
5
11
  import builder from './builder.tsx';
6
12
 
7
- const schema = builder.toSchema();
13
+ const schema = builder.toSchema({
14
+ directives: [
15
+ ...specifiedDirectives,
16
+ new GraphQLDirective({
17
+ args: { role: { type: GraphQLString }, self: { type: GraphQLBoolean } },
18
+ locations: [
19
+ DirectiveLocation.FIELD_DEFINITION,
20
+ DirectiveLocation.OBJECT,
21
+ DirectiveLocation.INTERFACE,
22
+ ],
23
+ name: 'auth',
24
+ }),
25
+ ],
26
+ });
8
27
 
9
28
  if (process.env.NODE_ENV === 'development') {
10
29
  writeFileSync(
11
- join(process.cwd(), 'src/graphql/schema.graphql'),
30
+ new URL('./schema.graphql', import.meta.url),
12
31
  printSchemaWithDirectives(schema),
13
32
  'utf8',
14
33
  );
@@ -138,49 +138,6 @@ export const eventDataView = dataView<EventItem>('Event')({
138
138
  type: true,
139
139
  });
140
140
 
141
- export type User = Entity<typeof userDataView, 'User'>;
142
- export type Tag = Entity<typeof tagDataView, 'Tag'>;
143
- export type Comment = Entity<
144
- typeof commentDataView,
145
- 'Comment',
146
- {
147
- author: User;
148
- post: Post;
149
- }
150
- >;
151
- export type EventAttendee = Entity<
152
- typeof eventAttendeeDataView,
153
- 'EventAttendee',
154
- {
155
- user: User;
156
- }
157
- >;
158
- export type Post = Entity<
159
- typeof postDataView,
160
- 'Post',
161
- {
162
- author: User;
163
- category: Category | null;
164
- comments: Array<Comment>;
165
- tags: Array<Tag>;
166
- }
167
- >;
168
- export type Category = Entity<
169
- typeof categoryDataView,
170
- 'Category',
171
- {
172
- posts: Array<Post>;
173
- }
174
- >;
175
- export type Event = Entity<
176
- typeof eventDataView,
177
- 'Event',
178
- {
179
- attendees: Array<EventAttendee>;
180
- host: User;
181
- }
182
- >;
183
-
184
141
  export const Root = {
185
142
  categories: list(categoryDataView, { orderBy: { createdAt: 'asc', id: 'asc' } }),
186
143
  commentSearch: {
@@ -1,3 +1,23 @@
1
+ # Using fate
2
+
3
+ Before working on fate, read only the relevant Markdown docs in `node_modules/react-fate/docs/`. Start with `index.md` to find guides, integrations, and API references. The docs match the installed package version. Online documentation is at [fate.technology](https://fate.technology/).
4
+
5
+ <!--VITE PLUS START-->
6
+
7
+ # Using Vite+, the Unified Toolchain for the Web
8
+
9
+ This project is using Vite+, a unified toolchain built on top of Vite, Rolldown, Vitest, tsdown, Oxlint, Oxfmt, and Vite Task. Vite+ wraps runtime management, package management, and frontend tooling in a single global CLI called `vp`. Vite+ is distinct from Vite, and it invokes Vite through `vp dev` and `vp build`. Run `vp help` to print a list of commands and `vp <command> --help` for information about a specific command.
10
+
11
+ Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.dev/guide/.
12
+
13
+ ## Review Checklist
14
+
15
+ - [ ] Run `vp install` after pulling remote changes and before getting started.
16
+ - [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
17
+ - [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
18
+
1
19
  Run `vp run test:all` to verify changes.
2
20
 
3
21
  Run `vp check --fix` to fix formatting and lint errors.
22
+
23
+ <!--VITE PLUS END-->
@@ -34,22 +34,24 @@ VITE_GRAPHQL_URL="https://api.example.com/graphql" vp run build
34
34
 
35
35
  These `VITE_*` values are embedded in the client bundle. Do not put credentials in them. Production builds do not read `.env`.
36
36
 
37
- Then edit `src/fate/graphql.ts`. This file is the mapping layer between your GraphQL schema and _fate_:
37
+ Replace `src/fate/schema.graphql` with the schema exported by your existing
38
+ GraphQL server, then edit `src/fate/graphql.ts` to map application names:
38
39
 
39
- - `dataView(...)` describes the fields React components are allowed to select.
40
- - `Root` describes the root GraphQL fields _fate_ can request.
41
- - `fateGraphQL.roots` maps _fate_ root names to GraphQL field names.
42
- - `fateGraphQL.mutations` maps _fate_ mutation names to GraphQL mutation fields.
40
+ - `fateGraphQL.schema` supplies the SDL used during generation.
41
+ - `fateGraphQL.roots` exposes query fields and optionally maps different names
42
+ through `field`. Entity and connection types are inferred from the schema.
43
+ - `fateGraphQL.mutations` maps application mutation names to schema fields.
44
+ - `fateGraphQL.scalars` optionally describes custom scalar wire types. Unmapped
45
+ custom scalars are `unknown`.
43
46
 
44
- The sample assumes your GraphQL server exposes:
47
+ The sample schema includes `viewer`, `posts(first:, after:)`, `postLike(input:)`,
48
+ `node(id:)`, and `nodes(ids:)`, with Relay-style connections. Replace it with your
49
+ server's actual contract, including nullability and arguments.
45
50
 
46
- - `viewer`
47
- - `posts(first:, after:)`
48
- - `node(id:)` or `nodes(ids:)`
49
- - Relay-style connections with `edges`, `cursor`, `node`, and `pageInfo`
50
- - Entity objects with stable `id` and `__typename`
51
-
52
- Replace the sample `User` and `Post` views with your own schema types.
51
+ Run `vp run fate:generate` to generate `.fate/schema.generated.ts`. Client views
52
+ use `GraphQLEntities` from that file; there are no handwritten entity or mutation
53
+ input types to keep synchronized. The schema and generation imports are excluded
54
+ from the browser client.
53
55
 
54
56
  ## Development
55
57
 
@@ -74,7 +76,7 @@ vp run dev
74
76
  Common commands:
75
77
 
76
78
  - `vp run dev` starts the client.
77
- - `vp run fate:generate` refreshes _fate_ client support after changing `src/fate/graphql.ts`.
79
+ - `vp run fate:generate` refreshes _fate_ client support after changing the schema or `src/fate/graphql.ts`.
78
80
  - `vp check --fix` formats, lints, and type-checks the project.
79
81
  - `vp run test:all` verifies the project.
80
82
 
@@ -1,6 +1,7 @@
1
1
  .fate/
2
2
  **/.fate/
3
3
  .void/
4
+ .wrangler/
4
5
  **/.void/
5
6
  .eslintcache
6
7
  .pnpm-debug.log
@@ -23,29 +23,30 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@nkzw/fate": "latest",
26
- "@void/react": "^0.24.0",
26
+ "@void/react": "^1.1.12",
27
27
  "fbtee": "^5.0.0",
28
- "graphql-sse": "^2.6.1",
29
- "lucide-react": "^1.34.0",
30
- "react": "^19.3.0",
31
- "react-dom": "^19.3.0",
32
- "react-error-boundary": "^6.1.3",
28
+ "graphql-sse": "^2.6.3",
29
+ "lucide-react": "^1.59.0",
30
+ "react": "^19.3.1",
31
+ "react-dom": "^19.3.1",
32
+ "react-error-boundary": "^6.1.6",
33
33
  "react-fate": "latest",
34
- "void": "^0.24.0"
34
+ "void": "^1.1.12"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@nkzw/eslint-plugin": "^2.0.0",
38
38
  "@nkzw/fbtee-compiler": "^5.0.0",
39
39
  "@nkzw/oxlint-config": "^2.0.1",
40
40
  "@nkzw/vite-plugin-fbtee": "^5.0.0",
41
- "@oxc-node/core": "^0.1.0",
42
- "@swc/core": "^1.16.1",
41
+ "@oxc-node/core": "^0.1.7",
42
+ "@swc/core": "^1.16.18",
43
43
  "@tailwindcss/vite": "^4.3.3",
44
- "@types/node": "^26.4.0",
44
+ "@types/node": "^26.6.5",
45
45
  "@types/react": "^19.3.0",
46
46
  "@types/react-dom": "^19.3.0",
47
- "@vitejs/plugin-react": "^6.1.0",
48
- "oxc-transform-react": "^0.147.0",
47
+ "@vitejs/plugin-react": "^6.1.2",
48
+ "graphql": "^17.0.2",
49
+ "oxc-transform-react": "^0.154.0",
49
50
  "tailwindcss": "^4.3.3",
50
51
  "typescript": "^7.0.2",
51
52
  "vite": "catalog:",
@@ -61,5 +62,5 @@
61
62
  "node": ">=24.0.0",
62
63
  "pnpm": ">=11.0.0"
63
64
  },
64
- "packageManager": "pnpm@11.0.6"
65
+ "packageManager": "pnpm@12.6.0"
65
66
  }
@@ -90,8 +90,8 @@ export default function HomePage() {
90
90
  </h1>
91
91
  <p className="max-w-2xl text-slate-600 dark:text-slate-300">
92
92
  <fbt desc="GraphQL client setup instructions">
93
- Replace the sample views in <code>src/fate/graphql.ts</code> with your schema types and
94
- point <code>VITE_GRAPHQL_URL</code> at your API.
93
+ Replace <code>src/fate/schema.graphql</code> with your server schema and point{' '}
94
+ <code>VITE_GRAPHQL_URL</code> at your API.
95
95
  </fbt>
96
96
  </p>
97
97
  </header>
@@ -3,15 +3,15 @@ packages:
3
3
 
4
4
  allowBuilds:
5
5
  '@swc/core': true
6
- better-sqlite3: true
6
+ better-sqlite3: false
7
7
  esbuild: true
8
8
  sharp: true
9
9
  workerd: true
10
10
 
11
11
  catalog:
12
- vite: npm:@voidzero-dev/vite-plus-core@1.0.0
13
- vite-plus: 1.0.0
14
- vitest: 5.0.2
12
+ vite: npm:@voidzero-dev/vite-plus-core@1.3.0
13
+ vite-plus: 1.3.0
14
+ vitest: 5.0.5
15
15
 
16
16
  minimumReleaseAgeExclude:
17
17
  - '@voidzero-dev/vite-plus-core'
@@ -20,14 +20,13 @@ minimumReleaseAgeExclude:
20
20
  onlyBuiltDependencies:
21
21
  - '@swc/core'
22
22
  - '@tailwindcss/oxide'
23
- - better-sqlite3
24
23
  - esbuild
25
24
  - msgpackr-extract
26
25
  - sharp
27
26
  - workerd
28
27
 
29
28
  overrides:
30
- better-auth: 1.7.7
29
+ better-auth: 1.7.11
31
30
  vite: 'catalog:'
32
31
  vitest: 'catalog:'
33
32
 
@@ -5,13 +5,7 @@ body {
5
5
  background: #f8fafc;
6
6
  color: #111827;
7
7
  font-family:
8
- Inter,
9
- ui-sans-serif,
10
- system-ui,
11
- -apple-system,
12
- BlinkMacSystemFont,
13
- 'Segoe UI',
14
- sans-serif;
8
+ Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
15
9
  }
16
10
 
17
11
  button,
@@ -1,52 +1,11 @@
1
- import { graphqlMutation } from '@nkzw/fate';
2
- import { dataView, list, type Entity } from '@nkzw/fate/server';
1
+ import type { GraphQLEntities } from '../../.fate/schema.generated.ts';
2
+ import schema from './schema.graphql?raw';
3
3
 
4
- type GraphQLUser = {
5
- id: string;
6
- name?: string | null;
7
- username?: string | null;
8
- };
9
-
10
- type GraphQLPost = {
11
- author?: GraphQLUser | null;
12
- id: string;
13
- title: string;
14
- };
15
-
16
- export const userDataView = dataView<GraphQLUser>('User')({
17
- id: true,
18
- name: true,
19
- username: true,
20
- });
21
-
22
- export const postDataView = dataView<GraphQLPost>('Post')({
23
- author: userDataView,
24
- id: true,
25
- title: true,
26
- });
27
-
28
- export type User = Entity<typeof userDataView, 'User'>;
29
- export type Post = Entity<
30
- typeof postDataView,
31
- 'Post',
32
- {
33
- author: User | null;
34
- }
35
- >;
36
-
37
- export const Root = {
38
- posts: list(postDataView),
39
- viewer: userDataView,
40
- };
4
+ export type User = GraphQLEntities['User'];
5
+ export type Post = GraphQLEntities['Post'];
41
6
 
42
7
  export const fateGraphQL = {
43
- mutations: {
44
- 'post.like': graphqlMutation<Post, { id: string }, Post>('Post', {
45
- field: 'postLike',
46
- }),
47
- },
48
- roots: {
49
- posts: { field: 'posts' },
50
- viewer: { field: 'viewer' },
51
- },
8
+ mutations: { 'post.like': { entity: 'Post', field: 'postLike' } },
9
+ roots: { posts: {}, viewer: {} },
10
+ schema,
52
11
  } as const;
@@ -0,0 +1,48 @@
1
+ # Replace this sample with the schema exported by your GraphQL server.
2
+ interface Node {
3
+ id: ID!
4
+ }
5
+
6
+ type User implements Node {
7
+ id: ID!
8
+ name: String
9
+ username: String
10
+ }
11
+
12
+ type Post implements Node {
13
+ author: User
14
+ id: ID!
15
+ title: String!
16
+ }
17
+
18
+ type Query {
19
+ node(id: ID!): Node
20
+ nodes(ids: [ID!]!): [Node]!
21
+ posts(first: Int, after: String): PostConnection!
22
+ viewer: User
23
+ }
24
+
25
+ type PostConnection {
26
+ edges: [PostEdge!]!
27
+ pageInfo: PageInfo!
28
+ }
29
+
30
+ type PostEdge {
31
+ cursor: String!
32
+ node: Post!
33
+ }
34
+
35
+ type PageInfo {
36
+ startCursor: String
37
+ endCursor: String
38
+ hasNextPage: Boolean!
39
+ hasPreviousPage: Boolean!
40
+ }
41
+
42
+ type Mutation {
43
+ postLike(input: PostLikeInput!): Post
44
+ }
45
+
46
+ input PostLikeInput {
47
+ id: ID!
48
+ }