create-signet-app 0.4.8 → 0.5.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 (87) hide show
  1. package/README.md +114 -33
  2. package/{template-full → base/api}/api/app.ts +52 -9
  3. package/base/api/api/db/open.ts +121 -0
  4. package/{template-full → base/api}/api/db/schema.ts +22 -7
  5. package/{template-full → base/api}/api/env.ts +8 -0
  6. package/base/api/api/server.ts +157 -0
  7. package/{template-full → base/api}/api/services.ts +61 -8
  8. package/base/api/test/api.test.ts +51 -0
  9. package/base/api/test/helpers.ts +51 -0
  10. package/base/both/scripts/dev.ts +44 -0
  11. package/base/shared/README.md +298 -0
  12. package/{template-full → base/shared}/_github/workflows/ci.yml +1 -1
  13. package/{template-full → base/web}/src/lib/api.ts +28 -1
  14. package/{template-full → base/web}/src/main.tsx +4 -1
  15. package/{template-full → base/web}/src/routeTree.gen.ts +130 -90
  16. package/{template-full → base/web}/src/router.test.ts +12 -9
  17. package/base/web/src/routes/_app/index.tsx +55 -0
  18. package/{template-full → base/web}/src/routes/_app.tsx +39 -16
  19. package/{template-full → base/web}/vite.config.ts +3 -1
  20. package/package.json +5 -4
  21. package/parts/account/api/test/account.test.ts +30 -0
  22. package/parts/account/part.ts +6 -0
  23. package/parts/admin/api/test/admin.test.ts +35 -0
  24. package/parts/admin/part.ts +6 -0
  25. package/{template-full → parts/admin/web}/src/routes/_app/admin.tsx +2 -1
  26. package/{template-full → parts/auth/api}/api/routes/account.ts +32 -3
  27. package/{template-full → parts/auth/api}/api/routes/auth.ts +5 -3
  28. package/parts/auth/api/test/auth.test.ts +28 -0
  29. package/{template-full → parts/auth/both}/e2e/smoke.spec.ts +21 -7
  30. package/parts/auth/part.ts +22 -0
  31. package/parts/growth/part.ts +7 -0
  32. package/{template-full/_mcp → parts/mcp/api}/test/mcp.test.ts +25 -16
  33. package/parts/mcp/part.ts +8 -0
  34. package/parts/notifications/api/test/notifications.test.ts +18 -0
  35. package/parts/notifications/part.ts +6 -0
  36. package/{template-full → parts/notifications/web}/src/routes/_app/notifications.tsx +1 -1
  37. package/parts/orgs/api/test/orgs.test.ts +56 -0
  38. package/parts/orgs/part.ts +7 -0
  39. package/{template-full → parts/payments/api}/api/routes/billing.ts +3 -2
  40. package/parts/payments/api/test/payments.test.ts +31 -0
  41. package/parts/payments/part.ts +12 -0
  42. package/{template-full → parts/payments/web}/src/routes/_app/billing.tsx +6 -3
  43. package/parts/privacy/api/test/privacy.test.ts +20 -0
  44. package/parts/privacy/part.ts +7 -0
  45. package/src/compose.ts +369 -0
  46. package/src/desktop.ts +10 -10
  47. package/src/index.ts +368 -174
  48. package/template-api/_targets/deno/Dockerfile +12 -0
  49. package/template-api/_targets/deno/_dockerignore +10 -0
  50. package/template-api/_targets/deno/src/server.ts +43 -0
  51. package/template-full/README.md +0 -166
  52. package/template-full/api/db/open.ts +0 -33
  53. package/template-full/api/server.ts +0 -50
  54. package/template-full/scripts/dev.ts +0 -17
  55. package/template-full/src/routes/_app/index.tsx +0 -33
  56. package/template-full/test/api.test.ts +0 -238
  57. package/template-full/tsconfig.json +0 -9
  58. /package/{template-full → base/api}/api/db/index.ts +0 -0
  59. /package/{template-full → base/api}/api/db/kv.ts +0 -0
  60. /package/{template-full → base/api}/drizzle/0000_init.sql +0 -0
  61. /package/{template-full → base/api}/drizzle/0001_orgs.sql +0 -0
  62. /package/{template-full → base/api}/drizzle/meta/0000_snapshot.json +0 -0
  63. /package/{template-full → base/api}/drizzle/meta/0001_snapshot.json +0 -0
  64. /package/{template-full → base/api}/drizzle/meta/_journal.json +0 -0
  65. /package/{template-full → base/api}/drizzle.config.ts +0 -0
  66. /package/{template-full → base/api}/tsconfig.api.json +0 -0
  67. /package/{template-full → base/shared}/_gitignore +0 -0
  68. /package/{template-full → base/shared}/biome.json +0 -0
  69. /package/{template-full → base/web}/index.html +0 -0
  70. /package/{template-full → base/web}/src/app.css +0 -0
  71. /package/{template-full → base/web}/src/components/toaster.tsx +0 -0
  72. /package/{template-full → base/web}/src/router.ts +0 -0
  73. /package/{template-full → base/web}/src/routes/__root.tsx +0 -0
  74. /package/{template-full → base/web}/tsconfig.app.json +0 -0
  75. /package/{template-full → base/web}/tsconfig.node.json +0 -0
  76. /package/{template-full → base/web}/tsconfig.test.json +0 -0
  77. /package/{template-full → parts/account/web}/src/routes/_app/account.tsx +0 -0
  78. /package/{template-full → parts/auth/both}/playwright.config.ts +0 -0
  79. /package/{template-full → parts/auth/web}/src/routes/login.tsx +0 -0
  80. /package/{template-full → parts/notifications/api}/api/routes/notifications.ts +0 -0
  81. /package/{template-full → parts/orgs/web}/src/routes/_app/org/index.tsx +0 -0
  82. /package/{template-full → parts/orgs/web}/src/routes/_app/org/members.tsx +0 -0
  83. /package/{template-full → parts/orgs/web}/src/routes/_app/org/new.tsx +0 -0
  84. /package/{template-full → parts/orgs/web}/src/routes/invite.$token.tsx +0 -0
  85. /package/{template-full → parts/payments/api}/api/plans.ts +0 -0
  86. /package/{template-full → parts/privacy/api}/api/routes/privacy.ts +0 -0
  87. /package/{template-full → parts/privacy/web}/src/routes/_app/privacy.tsx +0 -0
@@ -10,166 +10,186 @@
10
10
 
11
11
  import { Route as rootRouteImport } from "./routes/__root"
12
12
  import { Route as AppRouteImport } from "./routes/_app"
13
- import { Route as LoginRouteImport } from "./routes/login"
13
+ import { Route as LoginRouteImport } from "./routes/login" // @auth
14
14
  import { Route as AppIndexRouteImport } from "./routes/_app/index"
15
- import { Route as AppAccountRouteImport } from "./routes/_app/account"
16
- import { Route as AppAdminRouteImport } from "./routes/_app/admin"
17
- import { Route as AppBillingRouteImport } from "./routes/_app/billing"
18
- import { Route as AppNotificationsRouteImport } from "./routes/_app/notifications"
19
- import { Route as AppPrivacyRouteImport } from "./routes/_app/privacy"
20
- import { Route as InviteTokenRouteImport } from "./routes/invite.$token"
21
- import { Route as AppOrgIndexRouteImport } from "./routes/_app/org/index"
22
- import { Route as AppOrgMembersRouteImport } from "./routes/_app/org/members"
23
- import { Route as AppOrgNewRouteImport } from "./routes/_app/org/new"
15
+ import { Route as AppAccountRouteImport } from "./routes/_app/account" // @account
16
+ import { Route as AppAdminRouteImport } from "./routes/_app/admin" // @admin
17
+ import { Route as AppBillingRouteImport } from "./routes/_app/billing" // @payments
18
+ import { Route as AppNotificationsRouteImport } from "./routes/_app/notifications" // @notifications
19
+ import { Route as AppPrivacyRouteImport } from "./routes/_app/privacy" // @privacy
20
+ import { Route as InviteTokenRouteImport } from "./routes/invite.$token" // @orgs
21
+ import { Route as AppOrgIndexRouteImport } from "./routes/_app/org/index" // @orgs
22
+ import { Route as AppOrgMembersRouteImport } from "./routes/_app/org/members" // @orgs
23
+ import { Route as AppOrgNewRouteImport } from "./routes/_app/org/new" // @orgs
24
24
 
25
25
  const AppRoute = AppRouteImport.update({
26
26
  id: "/_app",
27
27
  getParentRoute: () => rootRouteImport,
28
28
  } as any)
29
+ // auth:begin
29
30
  const LoginRoute = LoginRouteImport.update({
30
31
  id: "/login",
31
32
  path: "/login",
32
33
  getParentRoute: () => rootRouteImport,
33
34
  } as any)
35
+ // auth:end
34
36
  const AppIndexRoute = AppIndexRouteImport.update({
35
37
  id: "/",
36
38
  path: "/",
37
39
  getParentRoute: () => AppRoute,
38
40
  } as any)
41
+ // account:begin
39
42
  const AppAccountRoute = AppAccountRouteImport.update({
40
43
  id: "/account",
41
44
  path: "/account",
42
45
  getParentRoute: () => AppRoute,
43
46
  } as any)
47
+ // account:end
48
+ // admin:begin
44
49
  const AppAdminRoute = AppAdminRouteImport.update({
45
50
  id: "/admin",
46
51
  path: "/admin",
47
52
  getParentRoute: () => AppRoute,
48
53
  } as any)
54
+ // admin:end
55
+ // payments:begin
49
56
  const AppBillingRoute = AppBillingRouteImport.update({
50
57
  id: "/billing",
51
58
  path: "/billing",
52
59
  getParentRoute: () => AppRoute,
53
60
  } as any)
61
+ // payments:end
62
+ // notifications:begin
54
63
  const AppNotificationsRoute = AppNotificationsRouteImport.update({
55
64
  id: "/notifications",
56
65
  path: "/notifications",
57
66
  getParentRoute: () => AppRoute,
58
67
  } as any)
68
+ // notifications:end
69
+ // privacy:begin
59
70
  const AppPrivacyRoute = AppPrivacyRouteImport.update({
60
71
  id: "/privacy",
61
72
  path: "/privacy",
62
73
  getParentRoute: () => AppRoute,
63
74
  } as any)
75
+ // privacy:end
76
+ // orgs:begin
64
77
  const InviteTokenRoute = InviteTokenRouteImport.update({
65
78
  id: "/invite/$token",
66
79
  path: "/invite/$token",
67
80
  getParentRoute: () => rootRouteImport,
68
81
  } as any)
82
+ // orgs:end
83
+ // orgs:begin
69
84
  const AppOrgIndexRoute = AppOrgIndexRouteImport.update({
70
85
  id: "/org/",
71
86
  path: "/org/",
72
87
  getParentRoute: () => AppRoute,
73
88
  } as any)
89
+ // orgs:end
90
+ // orgs:begin
74
91
  const AppOrgMembersRoute = AppOrgMembersRouteImport.update({
75
92
  id: "/org/members",
76
93
  path: "/org/members",
77
94
  getParentRoute: () => AppRoute,
78
95
  } as any)
96
+ // orgs:end
97
+ // orgs:begin
79
98
  const AppOrgNewRoute = AppOrgNewRouteImport.update({
80
99
  id: "/org/new",
81
100
  path: "/org/new",
82
101
  getParentRoute: () => AppRoute,
83
102
  } as any)
103
+ // orgs:end
84
104
 
85
105
  export interface FileRoutesByFullPath {
86
106
  "/": typeof AppIndexRoute
87
- "/login": typeof LoginRoute
88
- "/account": typeof AppAccountRoute
89
- "/admin": typeof AppAdminRoute
90
- "/billing": typeof AppBillingRoute
91
- "/notifications": typeof AppNotificationsRoute
92
- "/privacy": typeof AppPrivacyRoute
93
- "/invite/$token": typeof InviteTokenRoute
94
- "/org/members": typeof AppOrgMembersRoute
95
- "/org/new": typeof AppOrgNewRoute
96
- "/org/": typeof AppOrgIndexRoute
107
+ "/login": typeof LoginRoute // @auth
108
+ "/account": typeof AppAccountRoute // @account
109
+ "/admin": typeof AppAdminRoute // @admin
110
+ "/billing": typeof AppBillingRoute // @payments
111
+ "/notifications": typeof AppNotificationsRoute // @notifications
112
+ "/privacy": typeof AppPrivacyRoute // @privacy
113
+ "/invite/$token": typeof InviteTokenRoute // @orgs
114
+ "/org/members": typeof AppOrgMembersRoute // @orgs
115
+ "/org/new": typeof AppOrgNewRoute // @orgs
116
+ "/org/": typeof AppOrgIndexRoute // @orgs
97
117
  }
98
118
  export interface FileRoutesByTo {
99
- "/login": typeof LoginRoute
100
- "/account": typeof AppAccountRoute
101
- "/admin": typeof AppAdminRoute
102
- "/billing": typeof AppBillingRoute
103
- "/notifications": typeof AppNotificationsRoute
104
- "/privacy": typeof AppPrivacyRoute
105
- "/invite/$token": typeof InviteTokenRoute
119
+ "/login": typeof LoginRoute // @auth
120
+ "/account": typeof AppAccountRoute // @account
121
+ "/admin": typeof AppAdminRoute // @admin
122
+ "/billing": typeof AppBillingRoute // @payments
123
+ "/notifications": typeof AppNotificationsRoute // @notifications
124
+ "/privacy": typeof AppPrivacyRoute // @privacy
125
+ "/invite/$token": typeof InviteTokenRoute // @orgs
106
126
  "/": typeof AppIndexRoute
107
- "/org/members": typeof AppOrgMembersRoute
108
- "/org/new": typeof AppOrgNewRoute
109
- "/org": typeof AppOrgIndexRoute
127
+ "/org/members": typeof AppOrgMembersRoute // @orgs
128
+ "/org/new": typeof AppOrgNewRoute // @orgs
129
+ "/org": typeof AppOrgIndexRoute // @orgs
110
130
  }
111
131
  export interface FileRoutesById {
112
132
  __root__: typeof rootRouteImport
113
133
  "/_app": typeof AppRouteWithChildren
114
- "/login": typeof LoginRoute
115
- "/_app/account": typeof AppAccountRoute
116
- "/_app/admin": typeof AppAdminRoute
117
- "/_app/billing": typeof AppBillingRoute
118
- "/_app/notifications": typeof AppNotificationsRoute
119
- "/_app/privacy": typeof AppPrivacyRoute
120
- "/invite/$token": typeof InviteTokenRoute
134
+ "/login": typeof LoginRoute // @auth
135
+ "/_app/account": typeof AppAccountRoute // @account
136
+ "/_app/admin": typeof AppAdminRoute // @admin
137
+ "/_app/billing": typeof AppBillingRoute // @payments
138
+ "/_app/notifications": typeof AppNotificationsRoute // @notifications
139
+ "/_app/privacy": typeof AppPrivacyRoute // @privacy
140
+ "/invite/$token": typeof InviteTokenRoute // @orgs
121
141
  "/_app/": typeof AppIndexRoute
122
- "/_app/org/members": typeof AppOrgMembersRoute
123
- "/_app/org/new": typeof AppOrgNewRoute
124
- "/_app/org/": typeof AppOrgIndexRoute
142
+ "/_app/org/members": typeof AppOrgMembersRoute // @orgs
143
+ "/_app/org/new": typeof AppOrgNewRoute // @orgs
144
+ "/_app/org/": typeof AppOrgIndexRoute // @orgs
125
145
  }
126
146
  export interface FileRouteTypes {
127
147
  fileRoutesByFullPath: FileRoutesByFullPath
128
148
  fullPaths:
129
149
  | "/"
130
- | "/login"
131
- | "/account"
132
- | "/admin"
133
- | "/billing"
134
- | "/notifications"
135
- | "/privacy"
136
- | "/invite/$token"
137
- | "/org/members"
138
- | "/org/new"
139
- | "/org/"
150
+ | "/login" // @auth
151
+ | "/account" // @account
152
+ | "/admin" // @admin
153
+ | "/billing" // @payments
154
+ | "/notifications" // @notifications
155
+ | "/privacy" // @privacy
156
+ | "/invite/$token" // @orgs
157
+ | "/org/members" // @orgs
158
+ | "/org/new" // @orgs
159
+ | "/org/" // @orgs
140
160
  fileRoutesByTo: FileRoutesByTo
141
161
  to:
142
- | "/login"
143
- | "/account"
144
- | "/admin"
145
- | "/billing"
146
- | "/notifications"
147
- | "/privacy"
148
- | "/invite/$token"
162
+ | "/login" // @auth
163
+ | "/account" // @account
164
+ | "/admin" // @admin
165
+ | "/billing" // @payments
166
+ | "/notifications" // @notifications
167
+ | "/privacy" // @privacy
168
+ | "/invite/$token" // @orgs
149
169
  | "/"
150
- | "/org/members"
151
- | "/org/new"
152
- | "/org"
170
+ | "/org/members" // @orgs
171
+ | "/org/new" // @orgs
172
+ | "/org" // @orgs
153
173
  id:
154
174
  | "__root__"
155
175
  | "/_app"
156
- | "/login"
157
- | "/_app/account"
158
- | "/_app/admin"
159
- | "/_app/billing"
160
- | "/_app/notifications"
161
- | "/_app/privacy"
162
- | "/invite/$token"
176
+ | "/login" // @auth
177
+ | "/_app/account" // @account
178
+ | "/_app/admin" // @admin
179
+ | "/_app/billing" // @payments
180
+ | "/_app/notifications" // @notifications
181
+ | "/_app/privacy" // @privacy
182
+ | "/invite/$token" // @orgs
163
183
  | "/_app/"
164
- | "/_app/org/members"
165
- | "/_app/org/new"
166
- | "/_app/org/"
184
+ | "/_app/org/members" // @orgs
185
+ | "/_app/org/new" // @orgs
186
+ | "/_app/org/" // @orgs
167
187
  fileRoutesById: FileRoutesById
168
188
  }
169
189
  export interface RootRouteChildren {
170
190
  AppRoute: typeof AppRouteWithChildren
171
- LoginRoute: typeof LoginRoute
172
- InviteTokenRoute: typeof InviteTokenRoute
191
+ LoginRoute: typeof LoginRoute // @auth
192
+ InviteTokenRoute: typeof InviteTokenRoute // @orgs
173
193
  }
174
194
 
175
195
  declare module "@tanstack/react-router" {
@@ -181,6 +201,7 @@ declare module "@tanstack/react-router" {
181
201
  preLoaderRoute: typeof AppRouteImport
182
202
  parentRoute: typeof rootRouteImport
183
203
  }
204
+ // auth:begin
184
205
  "/login": {
185
206
  id: "/login"
186
207
  path: "/login"
@@ -188,6 +209,7 @@ declare module "@tanstack/react-router" {
188
209
  preLoaderRoute: typeof LoginRouteImport
189
210
  parentRoute: typeof rootRouteImport
190
211
  }
212
+ // auth:end
191
213
  "/_app/": {
192
214
  id: "/_app/"
193
215
  path: "/"
@@ -195,6 +217,7 @@ declare module "@tanstack/react-router" {
195
217
  preLoaderRoute: typeof AppIndexRouteImport
196
218
  parentRoute: typeof AppRoute
197
219
  }
220
+ // account:begin
198
221
  "/_app/account": {
199
222
  id: "/_app/account"
200
223
  path: "/account"
@@ -202,6 +225,8 @@ declare module "@tanstack/react-router" {
202
225
  preLoaderRoute: typeof AppAccountRouteImport
203
226
  parentRoute: typeof AppRoute
204
227
  }
228
+ // account:end
229
+ // admin:begin
205
230
  "/_app/admin": {
206
231
  id: "/_app/admin"
207
232
  path: "/admin"
@@ -209,6 +234,8 @@ declare module "@tanstack/react-router" {
209
234
  preLoaderRoute: typeof AppAdminRouteImport
210
235
  parentRoute: typeof AppRoute
211
236
  }
237
+ // admin:end
238
+ // payments:begin
212
239
  "/_app/billing": {
213
240
  id: "/_app/billing"
214
241
  path: "/billing"
@@ -216,6 +243,8 @@ declare module "@tanstack/react-router" {
216
243
  preLoaderRoute: typeof AppBillingRouteImport
217
244
  parentRoute: typeof AppRoute
218
245
  }
246
+ // payments:end
247
+ // notifications:begin
219
248
  "/_app/notifications": {
220
249
  id: "/_app/notifications"
221
250
  path: "/notifications"
@@ -223,6 +252,8 @@ declare module "@tanstack/react-router" {
223
252
  preLoaderRoute: typeof AppNotificationsRouteImport
224
253
  parentRoute: typeof AppRoute
225
254
  }
255
+ // notifications:end
256
+ // privacy:begin
226
257
  "/_app/privacy": {
227
258
  id: "/_app/privacy"
228
259
  path: "/privacy"
@@ -230,6 +261,8 @@ declare module "@tanstack/react-router" {
230
261
  preLoaderRoute: typeof AppPrivacyRouteImport
231
262
  parentRoute: typeof AppRoute
232
263
  }
264
+ // privacy:end
265
+ // orgs:begin
233
266
  "/invite/$token": {
234
267
  id: "/invite/$token"
235
268
  path: "/invite/$token"
@@ -237,6 +270,8 @@ declare module "@tanstack/react-router" {
237
270
  preLoaderRoute: typeof InviteTokenRouteImport
238
271
  parentRoute: typeof rootRouteImport
239
272
  }
273
+ // orgs:end
274
+ // orgs:begin
240
275
  "/_app/org/": {
241
276
  id: "/_app/org/"
242
277
  path: "/org"
@@ -244,6 +279,8 @@ declare module "@tanstack/react-router" {
244
279
  preLoaderRoute: typeof AppOrgIndexRouteImport
245
280
  parentRoute: typeof AppRoute
246
281
  }
282
+ // orgs:end
283
+ // orgs:begin
247
284
  "/_app/org/members": {
248
285
  id: "/_app/org/members"
249
286
  path: "/org/members"
@@ -251,6 +288,8 @@ declare module "@tanstack/react-router" {
251
288
  preLoaderRoute: typeof AppOrgMembersRouteImport
252
289
  parentRoute: typeof AppRoute
253
290
  }
291
+ // orgs:end
292
+ // orgs:begin
254
293
  "/_app/org/new": {
255
294
  id: "/_app/org/new"
256
295
  path: "/org/new"
@@ -258,39 +297,40 @@ declare module "@tanstack/react-router" {
258
297
  preLoaderRoute: typeof AppOrgNewRouteImport
259
298
  parentRoute: typeof AppRoute
260
299
  }
300
+ // orgs:end
261
301
  }
262
302
  }
263
303
 
264
304
  interface AppRouteChildren {
265
- AppAccountRoute: typeof AppAccountRoute
266
- AppAdminRoute: typeof AppAdminRoute
267
- AppBillingRoute: typeof AppBillingRoute
268
- AppNotificationsRoute: typeof AppNotificationsRoute
269
- AppPrivacyRoute: typeof AppPrivacyRoute
305
+ AppAccountRoute: typeof AppAccountRoute // @account
306
+ AppAdminRoute: typeof AppAdminRoute // @admin
307
+ AppBillingRoute: typeof AppBillingRoute // @payments
308
+ AppNotificationsRoute: typeof AppNotificationsRoute // @notifications
309
+ AppPrivacyRoute: typeof AppPrivacyRoute // @privacy
270
310
  AppIndexRoute: typeof AppIndexRoute
271
- AppOrgMembersRoute: typeof AppOrgMembersRoute
272
- AppOrgNewRoute: typeof AppOrgNewRoute
273
- AppOrgIndexRoute: typeof AppOrgIndexRoute
311
+ AppOrgMembersRoute: typeof AppOrgMembersRoute // @orgs
312
+ AppOrgNewRoute: typeof AppOrgNewRoute // @orgs
313
+ AppOrgIndexRoute: typeof AppOrgIndexRoute // @orgs
274
314
  }
275
315
 
276
316
  const AppRouteChildren: AppRouteChildren = {
277
- AppAccountRoute: AppAccountRoute,
278
- AppAdminRoute: AppAdminRoute,
279
- AppBillingRoute: AppBillingRoute,
280
- AppNotificationsRoute: AppNotificationsRoute,
281
- AppPrivacyRoute: AppPrivacyRoute,
317
+ AppAccountRoute: AppAccountRoute, // @account
318
+ AppAdminRoute: AppAdminRoute, // @admin
319
+ AppBillingRoute: AppBillingRoute, // @payments
320
+ AppNotificationsRoute: AppNotificationsRoute, // @notifications
321
+ AppPrivacyRoute: AppPrivacyRoute, // @privacy
282
322
  AppIndexRoute: AppIndexRoute,
283
- AppOrgMembersRoute: AppOrgMembersRoute,
284
- AppOrgNewRoute: AppOrgNewRoute,
285
- AppOrgIndexRoute: AppOrgIndexRoute,
323
+ AppOrgMembersRoute: AppOrgMembersRoute, // @orgs
324
+ AppOrgNewRoute: AppOrgNewRoute, // @orgs
325
+ AppOrgIndexRoute: AppOrgIndexRoute, // @orgs
286
326
  }
287
327
 
288
328
  const AppRouteWithChildren = AppRoute._addFileChildren(AppRouteChildren)
289
329
 
290
330
  const rootRouteChildren: RootRouteChildren = {
291
331
  AppRoute: AppRouteWithChildren,
292
- LoginRoute: LoginRoute,
293
- InviteTokenRoute: InviteTokenRoute,
332
+ LoginRoute: LoginRoute, // @auth
333
+ InviteTokenRoute: InviteTokenRoute, // @orgs
294
334
  }
295
335
  export const routeTree = rootRouteImport
296
336
  ._addFileChildren(rootRouteChildren)
@@ -2,20 +2,23 @@ import { expect, test } from "bun:test"
2
2
  import { createMemoryHistory } from "@tanstack/react-router"
3
3
  import { createAppRouter } from "./router"
4
4
 
5
- // Every page resolves to its own route. "/login" is where main.tsx sends a
6
- // 401, so losing it would land users on a not-found page.
5
+ // Every page resolves to its own route. "/login" is where main.tsx sends a // @auth
6
+ // 401, so losing it would land users on a not-found page. // @auth
7
+ // Every page resolves to its own route. // @!auth
7
8
  test.each([
8
- ["/login", "/login"],
9
- ["/", "/_app/"],
10
- ["/account", "/_app/account"],
11
- ["/notifications", "/_app/notifications"],
12
- ["/privacy", "/_app/privacy"],
13
- ["/billing", "/_app/billing"],
14
- ["/admin", "/_app/admin"],
9
+ ["/login", "/login"], // @auth
10
+ ["/", "/_app/"], // home, the page that is yours
11
+ ["/account", "/_app/account"], // @account
12
+ ["/notifications", "/_app/notifications"], // @notifications
13
+ ["/privacy", "/_app/privacy"], // @privacy
14
+ ["/billing", "/_app/billing"], // @payments
15
+ ["/admin", "/_app/admin"], // @admin
16
+ // orgs:begin
15
17
  ["/org", "/_app/org/"],
16
18
  ["/org/members", "/_app/org/members"],
17
19
  ["/org/new", "/_app/org/new"],
18
20
  ["/invite/abc", "/invite/$token"],
21
+ // orgs:end
19
22
  ])("%s resolves to %s", async (path, id) => {
20
23
  const router = createAppRouter(createMemoryHistory({ initialEntries: [path] }))
21
24
  await router.load()
@@ -0,0 +1,55 @@
1
+ import { Card, CardContent, CardHeader, CardTitle } from "@dapplelight/signet-ui/components/card"
2
+ import { useQuery } from "@tanstack/react-query" // @auth
3
+ import { createFileRoute, Link } from "@tanstack/react-router" // @payments
4
+ import { createFileRoute } from "@tanstack/react-router" // @!payments
5
+ import { meQuery } from "../../lib/api" // @auth
6
+
7
+ export const Route = createFileRoute("/_app/")({
8
+ component: Home,
9
+ })
10
+
11
+ // Your product goes here. The other pages are already wired; this one is
12
+ // yours.
13
+ function Home() {
14
+ // auth:begin
15
+ const me = useQuery(meQuery).data
16
+ return (
17
+ <Card>
18
+ <CardHeader>
19
+ <CardTitle>Hello{me?.user.name ? `, ${me.user.name}` : ""}</CardTitle>
20
+ </CardHeader>
21
+ <CardContent className="space-y-2 text-sm text-muted-foreground">
22
+ {/* payments:begin */}
23
+ <p>
24
+ You are on the <strong className="text-foreground">{me?.plan ?? "…"}</strong> plan.{" "}
25
+ <Link to="/billing" className="underline">
26
+ See plans
27
+ </Link>
28
+ </p>
29
+ {/* payments:end */}
30
+ <p>
31
+ Replace this page with your product: <code>src/routes/_app/index.tsx</code>, backed by a
32
+ route in <code>api/app.ts</code>. {/* @api */}
33
+ route in your API. {/* @!api */}
34
+ </p>
35
+ </CardContent>
36
+ </Card>
37
+ )
38
+ // auth:end
39
+ // !auth:begin
40
+ return (
41
+ <Card>
42
+ <CardHeader>
43
+ <CardTitle>Hello</CardTitle>
44
+ </CardHeader>
45
+ <CardContent className="space-y-2 text-sm text-muted-foreground">
46
+ <p>
47
+ Replace this page with your product: <code>src/routes/_app/index.tsx</code>, backed by a
48
+ route in <code>api/app.ts</code>. {/* @api */}
49
+ route in your API. {/* @!api */}
50
+ </p>
51
+ </CardContent>
52
+ </Card>
53
+ )
54
+ // !auth:end
55
+ }
@@ -1,36 +1,51 @@
1
- import { Badge } from "@dapplelight/signet-ui/components/badge"
2
- import { Button } from "@dapplelight/signet-ui/components/button"
1
+ import { Badge } from "@dapplelight/signet-ui/components/badge" // @notifications
2
+ import { Button } from "@dapplelight/signet-ui/components/button" // @auth
3
3
  import { ThemeToggle } from "@dapplelight/signet-ui/components/theme-toggle"
4
- import { OrgSwitcher } from "@dapplelight/signet-ui/screens/org-screens"
5
- import { useQuery } from "@tanstack/react-query"
6
- import { createFileRoute, Link, Outlet, useNavigate } from "@tanstack/react-router"
7
- import { api, currentOrgQuery, meQuery, orgsQuery, switchOrg } from "../lib/api"
4
+ import { OrgSwitcher } from "@dapplelight/signet-ui/screens/org-screens" // @orgs
5
+ import { useQuery } from "@tanstack/react-query" // @orgs
6
+ // !orgs:begin
7
+ import { useQuery } from "@tanstack/react-query" // @notifications
8
+ // !orgs:end
9
+ import { createFileRoute, Link, Outlet, useNavigate } from "@tanstack/react-router" // @orgs
10
+ import { createFileRoute, Link, Outlet } from "@tanstack/react-router" // @!orgs
11
+ // auth:begin
12
+ import { api, currentOrgQuery, meQuery, orgsQuery, switchOrg } from "../lib/api" // @admin
13
+ // !admin:begin
14
+ import { api, currentOrgQuery, orgsQuery, switchOrg } from "../lib/api" // @orgs
15
+ import { api } from "../lib/api" // @!orgs
16
+ // !admin:end
17
+ // auth:end
8
18
 
9
- // The signed-in shell. Every page under routes/_app/ renders inside it; a
10
- // 401 from any of their queries sends the browser to /login (main.tsx).
19
+ // The signed-in shell. Every page under routes/_app/ renders inside it; a // @auth
20
+ // 401 from any of their queries sends the browser to /login (main.tsx). // @auth
21
+ // The app's shell. Every page under routes/_app/ renders inside it. // @!auth
11
22
  export const Route = createFileRoute("/_app")({
12
23
  component: AppLayout,
13
24
  })
14
25
 
15
26
  const NAV = [
16
- { to: "/", label: "Home" },
17
- { to: "/notifications", label: "Inbox" },
18
- { to: "/billing", label: "Billing" },
19
- { to: "/account", label: "Account" },
20
- { to: "/privacy", label: "Privacy" },
21
- { to: "/org", label: "Org" },
27
+ { to: "/", label: "Home" }, // your product
28
+ { to: "/notifications", label: "Inbox" }, // @notifications
29
+ { to: "/billing", label: "Billing" }, // @payments
30
+ { to: "/account", label: "Account" }, // @account
31
+ { to: "/privacy", label: "Privacy" }, // @privacy
32
+ { to: "/org", label: "Org" }, // @orgs
22
33
  ] as const
23
34
 
24
35
  function AppLayout() {
25
- const me = useQuery(meQuery)
36
+ const me = useQuery(meQuery) // @admin
37
+ // notifications:begin
26
38
  const unread = useQuery({
27
39
  queryKey: ["notifications", "count"],
28
40
  queryFn: async () => (await api.notifications.$get({ query: {} })).json(),
29
41
  }).data?.unreadCount
30
- const staff = me.data && me.data.user.role !== "user"
42
+ // notifications:end
43
+ const staff = me.data && me.data.user.role !== "user" // @admin
44
+ // orgs:begin
31
45
  const navigate = useNavigate()
32
46
  const orgs = useQuery(orgsQuery).data?.orgs ?? []
33
47
  const current = useQuery({ ...currentOrgQuery, retry: false }).data
48
+ // orgs:end
34
49
 
35
50
  return (
36
51
  <>
@@ -38,6 +53,7 @@ function AppLayout() {
38
53
  <Link to="/" className="font-medium">
39
54
  __APP_NAME__
40
55
  </Link>
56
+ {/* orgs:begin */}
41
57
  {/* Every org you belong to; switching reloads into the other one. */}
42
58
  <OrgSwitcher
43
59
  className="w-48"
@@ -46,6 +62,7 @@ function AppLayout() {
46
62
  onSwitch={(id) => switchOrg(id)}
47
63
  onCreate={() => navigate({ to: "/org/new" })}
48
64
  />
65
+ {/* orgs:end */}
49
66
  <nav className="flex flex-1 flex-wrap items-center gap-1 text-sm">
50
67
  {NAV.map((n) => (
51
68
  <Link
@@ -54,11 +71,14 @@ function AppLayout() {
54
71
  className="rounded-md px-2 py-1 text-muted-foreground data-[status=active]:bg-muted data-[status=active]:text-foreground"
55
72
  >
56
73
  {n.label}
74
+ {/* notifications:begin */}
57
75
  {n.to === "/notifications" && unread ? (
58
76
  <Badge className="ml-1">{unread}</Badge>
59
77
  ) : null}
78
+ {/* notifications:end */}
60
79
  </Link>
61
80
  ))}
81
+ {/* admin:begin */}
62
82
  {staff ? (
63
83
  <Link
64
84
  to="/admin"
@@ -67,8 +87,10 @@ function AppLayout() {
67
87
  Admin
68
88
  </Link>
69
89
  ) : null}
90
+ {/* admin:end */}
70
91
  </nav>
71
92
  <ThemeToggle />
93
+ {/* auth:begin */}
72
94
  <Button
73
95
  variant="ghost"
74
96
  size="sm"
@@ -79,6 +101,7 @@ function AppLayout() {
79
101
  >
80
102
  Sign out
81
103
  </Button>
104
+ {/* auth:end */}
82
105
  </header>
83
106
  <main className="mx-auto max-w-3xl p-6">
84
107
  <Outlet />
@@ -3,11 +3,13 @@ import tailwindcss from "@tailwindcss/vite"
3
3
  import { tanstackRouter } from "@tanstack/router-plugin/vite"
4
4
  import react from "@vitejs/plugin-react"
5
5
  import { defineConfig } from "vite"
6
+ // api:begin
6
7
 
7
8
  // The API (api/server.ts) listens on PORT, 3000 by default. In dev, Vite
8
9
  // proxies /api and /mcp to it, so the browser sees one origin, as it does in
9
10
  // production where api/server.ts also serves the built app.
10
11
  const api = `http://localhost:${process.env.PORT ?? 3000}`
12
+ // api:end
11
13
 
12
14
  export default defineConfig({
13
15
  plugins: [
@@ -20,5 +22,5 @@ export default defineConfig({
20
22
  resolve: {
21
23
  alias: { "@": path.resolve(import.meta.dirname, "./src") },
22
24
  },
23
- server: { proxy: { "/api": api, "/mcp": api } },
25
+ server: { proxy: { "/api": api, "/mcp": api } }, // @api
24
26
  })