create-signet-app 0.4.8 → 0.6.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 (99) hide show
  1. package/README.md +133 -33
  2. package/{template-full → base/api}/api/app.ts +105 -13
  3. package/base/api/api/db/open.ts +121 -0
  4. package/{template-full → base/api}/api/db/schema.ts +34 -7
  5. package/{template-full → base/api}/api/env.ts +16 -0
  6. package/base/api/api/server.ts +163 -0
  7. package/{template-full → base/api}/api/services.ts +103 -10
  8. package/base/api/drizzle/0002_ai_paywalls_workflows.sql +77 -0
  9. package/base/api/drizzle/meta/0002_snapshot.json +1759 -0
  10. package/{template-full → base/api}/drizzle/meta/_journal.json +7 -0
  11. package/base/api/test/api.test.ts +51 -0
  12. package/base/api/test/helpers.ts +51 -0
  13. package/base/both/scripts/dev.ts +44 -0
  14. package/base/shared/README.md +385 -0
  15. package/{template-full → base/shared}/_github/workflows/ci.yml +1 -1
  16. package/{template-full → base/web}/src/lib/api.ts +28 -1
  17. package/{template-full → base/web}/src/main.tsx +4 -1
  18. package/{template-full → base/web}/src/routeTree.gen.ts +155 -90
  19. package/{template-full → base/web}/src/router.test.ts +13 -9
  20. package/base/web/src/routes/_app/index.tsx +55 -0
  21. package/{template-full → base/web}/src/routes/_app.tsx +40 -16
  22. package/{template-full → base/web}/vite.config.ts +3 -1
  23. package/package.json +9 -5
  24. package/parts/account/api/test/account.test.ts +30 -0
  25. package/parts/account/part.ts +6 -0
  26. package/parts/admin/api/test/admin.test.ts +35 -0
  27. package/parts/admin/part.ts +6 -0
  28. package/{template-full → parts/admin/web}/src/routes/_app/admin.tsx +2 -1
  29. package/parts/ai/api/api/routes/ai.ts +28 -0
  30. package/parts/ai/api/test/ai.test.ts +52 -0
  31. package/parts/ai/part.ts +16 -0
  32. package/{template-full → parts/auth/api}/api/routes/account.ts +32 -3
  33. package/{template-full → parts/auth/api}/api/routes/auth.ts +5 -3
  34. package/parts/auth/api/test/auth.test.ts +28 -0
  35. package/{template-full → parts/auth/both}/e2e/smoke.spec.ts +21 -7
  36. package/parts/auth/part.ts +22 -0
  37. package/parts/growth/part.ts +7 -0
  38. package/{template-full/_mcp → parts/mcp/api}/test/mcp.test.ts +25 -16
  39. package/parts/mcp/part.ts +8 -0
  40. package/parts/notifications/api/test/notifications.test.ts +18 -0
  41. package/parts/notifications/part.ts +6 -0
  42. package/{template-full → parts/notifications/web}/src/routes/_app/notifications.tsx +1 -1
  43. package/parts/orgs/api/test/orgs.test.ts +56 -0
  44. package/parts/orgs/part.ts +7 -0
  45. package/{template-full → parts/payments/api}/api/routes/billing.ts +3 -2
  46. package/parts/payments/api/test/payments.test.ts +31 -0
  47. package/parts/payments/part.ts +12 -0
  48. package/{template-full → parts/payments/web}/src/routes/_app/billing.tsx +6 -3
  49. package/parts/paywalls/api/api/routes/paywall.ts +126 -0
  50. package/parts/paywalls/api/test/paywalls.test.ts +71 -0
  51. package/parts/paywalls/part.ts +8 -0
  52. package/parts/privacy/api/test/privacy.test.ts +20 -0
  53. package/parts/privacy/part.ts +7 -0
  54. package/parts/workflows/api/api/workflows.ts +33 -0
  55. package/parts/workflows/api/test/workflows.test.ts +44 -0
  56. package/parts/workflows/part.ts +7 -0
  57. package/parts/workflows/web/src/routes/_app/approvals.tsx +34 -0
  58. package/src/compose.ts +426 -0
  59. package/src/desktop.ts +10 -10
  60. package/src/index.ts +407 -174
  61. package/template-api/_targets/deno/Dockerfile +12 -0
  62. package/template-api/_targets/deno/_dockerignore +10 -0
  63. package/template-api/_targets/deno/src/server.ts +43 -0
  64. package/template-full/README.md +0 -166
  65. package/template-full/api/db/open.ts +0 -33
  66. package/template-full/api/server.ts +0 -50
  67. package/template-full/scripts/dev.ts +0 -17
  68. package/template-full/src/routes/_app/index.tsx +0 -33
  69. package/template-full/test/api.test.ts +0 -238
  70. package/template-full/tsconfig.json +0 -9
  71. /package/{template-full → base/api}/api/db/index.ts +0 -0
  72. /package/{template-full → base/api}/api/db/kv.ts +0 -0
  73. /package/{template-full → base/api}/drizzle/0000_init.sql +0 -0
  74. /package/{template-full → base/api}/drizzle/0001_orgs.sql +0 -0
  75. /package/{template-full → base/api}/drizzle/meta/0000_snapshot.json +0 -0
  76. /package/{template-full → base/api}/drizzle/meta/0001_snapshot.json +0 -0
  77. /package/{template-full → base/api}/drizzle.config.ts +0 -0
  78. /package/{template-full → base/api}/tsconfig.api.json +0 -0
  79. /package/{template-full → base/shared}/_gitignore +0 -0
  80. /package/{template-full → base/shared}/biome.json +0 -0
  81. /package/{template-full → base/web}/index.html +0 -0
  82. /package/{template-full → base/web}/src/app.css +0 -0
  83. /package/{template-full → base/web}/src/components/toaster.tsx +0 -0
  84. /package/{template-full → base/web}/src/router.ts +0 -0
  85. /package/{template-full → base/web}/src/routes/__root.tsx +0 -0
  86. /package/{template-full → base/web}/tsconfig.app.json +0 -0
  87. /package/{template-full → base/web}/tsconfig.node.json +0 -0
  88. /package/{template-full → base/web}/tsconfig.test.json +0 -0
  89. /package/{template-full → parts/account/web}/src/routes/_app/account.tsx +0 -0
  90. /package/{template-full → parts/auth/both}/playwright.config.ts +0 -0
  91. /package/{template-full → parts/auth/web}/src/routes/login.tsx +0 -0
  92. /package/{template-full → parts/notifications/api}/api/routes/notifications.ts +0 -0
  93. /package/{template-full → parts/orgs/web}/src/routes/_app/org/index.tsx +0 -0
  94. /package/{template-full → parts/orgs/web}/src/routes/_app/org/members.tsx +0 -0
  95. /package/{template-full → parts/orgs/web}/src/routes/_app/org/new.tsx +0 -0
  96. /package/{template-full → parts/orgs/web}/src/routes/invite.$token.tsx +0 -0
  97. /package/{template-full → parts/payments/api}/api/plans.ts +0 -0
  98. /package/{template-full → parts/privacy/api}/api/routes/privacy.ts +0 -0
  99. /package/{template-full → parts/privacy/web}/src/routes/_app/privacy.tsx +0 -0
@@ -10,166 +10,200 @@
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 AppApprovalsRouteImport } from "./routes/_app/approvals" // @workflows
18
+ import { Route as AppBillingRouteImport } from "./routes/_app/billing" // @payments
19
+ import { Route as AppNotificationsRouteImport } from "./routes/_app/notifications" // @notifications
20
+ import { Route as AppPrivacyRouteImport } from "./routes/_app/privacy" // @privacy
21
+ import { Route as InviteTokenRouteImport } from "./routes/invite.$token" // @orgs
22
+ import { Route as AppOrgIndexRouteImport } from "./routes/_app/org/index" // @orgs
23
+ import { Route as AppOrgMembersRouteImport } from "./routes/_app/org/members" // @orgs
24
+ import { Route as AppOrgNewRouteImport } from "./routes/_app/org/new" // @orgs
24
25
 
25
26
  const AppRoute = AppRouteImport.update({
26
27
  id: "/_app",
27
28
  getParentRoute: () => rootRouteImport,
28
29
  } as any)
30
+ // auth:begin
29
31
  const LoginRoute = LoginRouteImport.update({
30
32
  id: "/login",
31
33
  path: "/login",
32
34
  getParentRoute: () => rootRouteImport,
33
35
  } as any)
36
+ // auth:end
34
37
  const AppIndexRoute = AppIndexRouteImport.update({
35
38
  id: "/",
36
39
  path: "/",
37
40
  getParentRoute: () => AppRoute,
38
41
  } as any)
42
+ // account:begin
39
43
  const AppAccountRoute = AppAccountRouteImport.update({
40
44
  id: "/account",
41
45
  path: "/account",
42
46
  getParentRoute: () => AppRoute,
43
47
  } as any)
48
+ // account:end
49
+ // admin:begin
44
50
  const AppAdminRoute = AppAdminRouteImport.update({
45
51
  id: "/admin",
46
52
  path: "/admin",
47
53
  getParentRoute: () => AppRoute,
48
54
  } as any)
55
+ // admin:end
56
+ // workflows:begin
57
+ const AppApprovalsRoute = AppApprovalsRouteImport.update({
58
+ id: "/approvals",
59
+ path: "/approvals",
60
+ getParentRoute: () => AppRoute,
61
+ } as any)
62
+ // workflows:end
63
+ // payments:begin
49
64
  const AppBillingRoute = AppBillingRouteImport.update({
50
65
  id: "/billing",
51
66
  path: "/billing",
52
67
  getParentRoute: () => AppRoute,
53
68
  } as any)
69
+ // payments:end
70
+ // notifications:begin
54
71
  const AppNotificationsRoute = AppNotificationsRouteImport.update({
55
72
  id: "/notifications",
56
73
  path: "/notifications",
57
74
  getParentRoute: () => AppRoute,
58
75
  } as any)
76
+ // notifications:end
77
+ // privacy:begin
59
78
  const AppPrivacyRoute = AppPrivacyRouteImport.update({
60
79
  id: "/privacy",
61
80
  path: "/privacy",
62
81
  getParentRoute: () => AppRoute,
63
82
  } as any)
83
+ // privacy:end
84
+ // orgs:begin
64
85
  const InviteTokenRoute = InviteTokenRouteImport.update({
65
86
  id: "/invite/$token",
66
87
  path: "/invite/$token",
67
88
  getParentRoute: () => rootRouteImport,
68
89
  } as any)
90
+ // orgs:end
91
+ // orgs:begin
69
92
  const AppOrgIndexRoute = AppOrgIndexRouteImport.update({
70
93
  id: "/org/",
71
94
  path: "/org/",
72
95
  getParentRoute: () => AppRoute,
73
96
  } as any)
97
+ // orgs:end
98
+ // orgs:begin
74
99
  const AppOrgMembersRoute = AppOrgMembersRouteImport.update({
75
100
  id: "/org/members",
76
101
  path: "/org/members",
77
102
  getParentRoute: () => AppRoute,
78
103
  } as any)
104
+ // orgs:end
105
+ // orgs:begin
79
106
  const AppOrgNewRoute = AppOrgNewRouteImport.update({
80
107
  id: "/org/new",
81
108
  path: "/org/new",
82
109
  getParentRoute: () => AppRoute,
83
110
  } as any)
111
+ // orgs:end
84
112
 
85
113
  export interface FileRoutesByFullPath {
86
114
  "/": 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
115
+ "/login": typeof LoginRoute // @auth
116
+ "/account": typeof AppAccountRoute // @account
117
+ "/admin": typeof AppAdminRoute // @admin
118
+ "/approvals": typeof AppApprovalsRoute // @workflows
119
+ "/billing": typeof AppBillingRoute // @payments
120
+ "/notifications": typeof AppNotificationsRoute // @notifications
121
+ "/privacy": typeof AppPrivacyRoute // @privacy
122
+ "/invite/$token": typeof InviteTokenRoute // @orgs
123
+ "/org/members": typeof AppOrgMembersRoute // @orgs
124
+ "/org/new": typeof AppOrgNewRoute // @orgs
125
+ "/org/": typeof AppOrgIndexRoute // @orgs
97
126
  }
98
127
  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
128
+ "/login": typeof LoginRoute // @auth
129
+ "/account": typeof AppAccountRoute // @account
130
+ "/admin": typeof AppAdminRoute // @admin
131
+ "/approvals": typeof AppApprovalsRoute // @workflows
132
+ "/billing": typeof AppBillingRoute // @payments
133
+ "/notifications": typeof AppNotificationsRoute // @notifications
134
+ "/privacy": typeof AppPrivacyRoute // @privacy
135
+ "/invite/$token": typeof InviteTokenRoute // @orgs
106
136
  "/": typeof AppIndexRoute
107
- "/org/members": typeof AppOrgMembersRoute
108
- "/org/new": typeof AppOrgNewRoute
109
- "/org": typeof AppOrgIndexRoute
137
+ "/org/members": typeof AppOrgMembersRoute // @orgs
138
+ "/org/new": typeof AppOrgNewRoute // @orgs
139
+ "/org": typeof AppOrgIndexRoute // @orgs
110
140
  }
111
141
  export interface FileRoutesById {
112
142
  __root__: typeof rootRouteImport
113
143
  "/_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
144
+ "/login": typeof LoginRoute // @auth
145
+ "/_app/account": typeof AppAccountRoute // @account
146
+ "/_app/admin": typeof AppAdminRoute // @admin
147
+ "/_app/approvals": typeof AppApprovalsRoute // @workflows
148
+ "/_app/billing": typeof AppBillingRoute // @payments
149
+ "/_app/notifications": typeof AppNotificationsRoute // @notifications
150
+ "/_app/privacy": typeof AppPrivacyRoute // @privacy
151
+ "/invite/$token": typeof InviteTokenRoute // @orgs
121
152
  "/_app/": typeof AppIndexRoute
122
- "/_app/org/members": typeof AppOrgMembersRoute
123
- "/_app/org/new": typeof AppOrgNewRoute
124
- "/_app/org/": typeof AppOrgIndexRoute
153
+ "/_app/org/members": typeof AppOrgMembersRoute // @orgs
154
+ "/_app/org/new": typeof AppOrgNewRoute // @orgs
155
+ "/_app/org/": typeof AppOrgIndexRoute // @orgs
125
156
  }
126
157
  export interface FileRouteTypes {
127
158
  fileRoutesByFullPath: FileRoutesByFullPath
128
159
  fullPaths:
129
160
  | "/"
130
- | "/login"
131
- | "/account"
132
- | "/admin"
133
- | "/billing"
134
- | "/notifications"
135
- | "/privacy"
136
- | "/invite/$token"
137
- | "/org/members"
138
- | "/org/new"
139
- | "/org/"
161
+ | "/login" // @auth
162
+ | "/account" // @account
163
+ | "/admin" // @admin
164
+ | "/approvals" // @workflows
165
+ | "/billing" // @payments
166
+ | "/notifications" // @notifications
167
+ | "/privacy" // @privacy
168
+ | "/invite/$token" // @orgs
169
+ | "/org/members" // @orgs
170
+ | "/org/new" // @orgs
171
+ | "/org/" // @orgs
140
172
  fileRoutesByTo: FileRoutesByTo
141
173
  to:
142
- | "/login"
143
- | "/account"
144
- | "/admin"
145
- | "/billing"
146
- | "/notifications"
147
- | "/privacy"
148
- | "/invite/$token"
174
+ | "/login" // @auth
175
+ | "/account" // @account
176
+ | "/admin" // @admin
177
+ | "/approvals" // @workflows
178
+ | "/billing" // @payments
179
+ | "/notifications" // @notifications
180
+ | "/privacy" // @privacy
181
+ | "/invite/$token" // @orgs
149
182
  | "/"
150
- | "/org/members"
151
- | "/org/new"
152
- | "/org"
183
+ | "/org/members" // @orgs
184
+ | "/org/new" // @orgs
185
+ | "/org" // @orgs
153
186
  id:
154
187
  | "__root__"
155
188
  | "/_app"
156
- | "/login"
157
- | "/_app/account"
158
- | "/_app/admin"
159
- | "/_app/billing"
160
- | "/_app/notifications"
161
- | "/_app/privacy"
162
- | "/invite/$token"
189
+ | "/login" // @auth
190
+ | "/_app/account" // @account
191
+ | "/_app/admin" // @admin
192
+ | "/_app/approvals" // @workflows
193
+ | "/_app/billing" // @payments
194
+ | "/_app/notifications" // @notifications
195
+ | "/_app/privacy" // @privacy
196
+ | "/invite/$token" // @orgs
163
197
  | "/_app/"
164
- | "/_app/org/members"
165
- | "/_app/org/new"
166
- | "/_app/org/"
198
+ | "/_app/org/members" // @orgs
199
+ | "/_app/org/new" // @orgs
200
+ | "/_app/org/" // @orgs
167
201
  fileRoutesById: FileRoutesById
168
202
  }
169
203
  export interface RootRouteChildren {
170
204
  AppRoute: typeof AppRouteWithChildren
171
- LoginRoute: typeof LoginRoute
172
- InviteTokenRoute: typeof InviteTokenRoute
205
+ LoginRoute: typeof LoginRoute // @auth
206
+ InviteTokenRoute: typeof InviteTokenRoute // @orgs
173
207
  }
174
208
 
175
209
  declare module "@tanstack/react-router" {
@@ -181,6 +215,7 @@ declare module "@tanstack/react-router" {
181
215
  preLoaderRoute: typeof AppRouteImport
182
216
  parentRoute: typeof rootRouteImport
183
217
  }
218
+ // auth:begin
184
219
  "/login": {
185
220
  id: "/login"
186
221
  path: "/login"
@@ -188,6 +223,7 @@ declare module "@tanstack/react-router" {
188
223
  preLoaderRoute: typeof LoginRouteImport
189
224
  parentRoute: typeof rootRouteImport
190
225
  }
226
+ // auth:end
191
227
  "/_app/": {
192
228
  id: "/_app/"
193
229
  path: "/"
@@ -195,6 +231,7 @@ declare module "@tanstack/react-router" {
195
231
  preLoaderRoute: typeof AppIndexRouteImport
196
232
  parentRoute: typeof AppRoute
197
233
  }
234
+ // account:begin
198
235
  "/_app/account": {
199
236
  id: "/_app/account"
200
237
  path: "/account"
@@ -202,6 +239,8 @@ declare module "@tanstack/react-router" {
202
239
  preLoaderRoute: typeof AppAccountRouteImport
203
240
  parentRoute: typeof AppRoute
204
241
  }
242
+ // account:end
243
+ // admin:begin
205
244
  "/_app/admin": {
206
245
  id: "/_app/admin"
207
246
  path: "/admin"
@@ -209,6 +248,17 @@ declare module "@tanstack/react-router" {
209
248
  preLoaderRoute: typeof AppAdminRouteImport
210
249
  parentRoute: typeof AppRoute
211
250
  }
251
+ // admin:end
252
+ // workflows:begin
253
+ "/_app/approvals": {
254
+ id: "/_app/approvals"
255
+ path: "/approvals"
256
+ fullPath: "/approvals"
257
+ preLoaderRoute: typeof AppApprovalsRouteImport
258
+ parentRoute: typeof AppRoute
259
+ }
260
+ // workflows:end
261
+ // payments:begin
212
262
  "/_app/billing": {
213
263
  id: "/_app/billing"
214
264
  path: "/billing"
@@ -216,6 +266,8 @@ declare module "@tanstack/react-router" {
216
266
  preLoaderRoute: typeof AppBillingRouteImport
217
267
  parentRoute: typeof AppRoute
218
268
  }
269
+ // payments:end
270
+ // notifications:begin
219
271
  "/_app/notifications": {
220
272
  id: "/_app/notifications"
221
273
  path: "/notifications"
@@ -223,6 +275,8 @@ declare module "@tanstack/react-router" {
223
275
  preLoaderRoute: typeof AppNotificationsRouteImport
224
276
  parentRoute: typeof AppRoute
225
277
  }
278
+ // notifications:end
279
+ // privacy:begin
226
280
  "/_app/privacy": {
227
281
  id: "/_app/privacy"
228
282
  path: "/privacy"
@@ -230,6 +284,8 @@ declare module "@tanstack/react-router" {
230
284
  preLoaderRoute: typeof AppPrivacyRouteImport
231
285
  parentRoute: typeof AppRoute
232
286
  }
287
+ // privacy:end
288
+ // orgs:begin
233
289
  "/invite/$token": {
234
290
  id: "/invite/$token"
235
291
  path: "/invite/$token"
@@ -237,6 +293,8 @@ declare module "@tanstack/react-router" {
237
293
  preLoaderRoute: typeof InviteTokenRouteImport
238
294
  parentRoute: typeof rootRouteImport
239
295
  }
296
+ // orgs:end
297
+ // orgs:begin
240
298
  "/_app/org/": {
241
299
  id: "/_app/org/"
242
300
  path: "/org"
@@ -244,6 +302,8 @@ declare module "@tanstack/react-router" {
244
302
  preLoaderRoute: typeof AppOrgIndexRouteImport
245
303
  parentRoute: typeof AppRoute
246
304
  }
305
+ // orgs:end
306
+ // orgs:begin
247
307
  "/_app/org/members": {
248
308
  id: "/_app/org/members"
249
309
  path: "/org/members"
@@ -251,6 +311,8 @@ declare module "@tanstack/react-router" {
251
311
  preLoaderRoute: typeof AppOrgMembersRouteImport
252
312
  parentRoute: typeof AppRoute
253
313
  }
314
+ // orgs:end
315
+ // orgs:begin
254
316
  "/_app/org/new": {
255
317
  id: "/_app/org/new"
256
318
  path: "/org/new"
@@ -258,39 +320,42 @@ declare module "@tanstack/react-router" {
258
320
  preLoaderRoute: typeof AppOrgNewRouteImport
259
321
  parentRoute: typeof AppRoute
260
322
  }
323
+ // orgs:end
261
324
  }
262
325
  }
263
326
 
264
327
  interface AppRouteChildren {
265
- AppAccountRoute: typeof AppAccountRoute
266
- AppAdminRoute: typeof AppAdminRoute
267
- AppBillingRoute: typeof AppBillingRoute
268
- AppNotificationsRoute: typeof AppNotificationsRoute
269
- AppPrivacyRoute: typeof AppPrivacyRoute
328
+ AppAccountRoute: typeof AppAccountRoute // @account
329
+ AppAdminRoute: typeof AppAdminRoute // @admin
330
+ AppApprovalsRoute: typeof AppApprovalsRoute // @workflows
331
+ AppBillingRoute: typeof AppBillingRoute // @payments
332
+ AppNotificationsRoute: typeof AppNotificationsRoute // @notifications
333
+ AppPrivacyRoute: typeof AppPrivacyRoute // @privacy
270
334
  AppIndexRoute: typeof AppIndexRoute
271
- AppOrgMembersRoute: typeof AppOrgMembersRoute
272
- AppOrgNewRoute: typeof AppOrgNewRoute
273
- AppOrgIndexRoute: typeof AppOrgIndexRoute
335
+ AppOrgMembersRoute: typeof AppOrgMembersRoute // @orgs
336
+ AppOrgNewRoute: typeof AppOrgNewRoute // @orgs
337
+ AppOrgIndexRoute: typeof AppOrgIndexRoute // @orgs
274
338
  }
275
339
 
276
340
  const AppRouteChildren: AppRouteChildren = {
277
- AppAccountRoute: AppAccountRoute,
278
- AppAdminRoute: AppAdminRoute,
279
- AppBillingRoute: AppBillingRoute,
280
- AppNotificationsRoute: AppNotificationsRoute,
281
- AppPrivacyRoute: AppPrivacyRoute,
341
+ AppAccountRoute: AppAccountRoute, // @account
342
+ AppAdminRoute: AppAdminRoute, // @admin
343
+ AppApprovalsRoute: AppApprovalsRoute, // @workflows
344
+ AppBillingRoute: AppBillingRoute, // @payments
345
+ AppNotificationsRoute: AppNotificationsRoute, // @notifications
346
+ AppPrivacyRoute: AppPrivacyRoute, // @privacy
282
347
  AppIndexRoute: AppIndexRoute,
283
- AppOrgMembersRoute: AppOrgMembersRoute,
284
- AppOrgNewRoute: AppOrgNewRoute,
285
- AppOrgIndexRoute: AppOrgIndexRoute,
348
+ AppOrgMembersRoute: AppOrgMembersRoute, // @orgs
349
+ AppOrgNewRoute: AppOrgNewRoute, // @orgs
350
+ AppOrgIndexRoute: AppOrgIndexRoute, // @orgs
286
351
  }
287
352
 
288
353
  const AppRouteWithChildren = AppRoute._addFileChildren(AppRouteChildren)
289
354
 
290
355
  const rootRouteChildren: RootRouteChildren = {
291
356
  AppRoute: AppRouteWithChildren,
292
- LoginRoute: LoginRoute,
293
- InviteTokenRoute: InviteTokenRoute,
357
+ LoginRoute: LoginRoute, // @auth
358
+ InviteTokenRoute: InviteTokenRoute, // @orgs
294
359
  }
295
360
  export const routeTree = rootRouteImport
296
361
  ._addFileChildren(rootRouteChildren)
@@ -2,20 +2,24 @@ 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
+ ["/approvals", "/_app/approvals"], // @workflows
17
+ // orgs:begin
15
18
  ["/org", "/_app/org/"],
16
19
  ["/org/members", "/_app/org/members"],
17
20
  ["/org/new", "/_app/org/new"],
18
21
  ["/invite/abc", "/invite/$token"],
22
+ // orgs:end
19
23
  ])("%s resolves to %s", async (path, id) => {
20
24
  const router = createAppRouter(createMemoryHistory({ initialEntries: [path] }))
21
25
  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,52 @@
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: "/approvals", label: "Approvals" }, // @workflows
33
+ { to: "/org", label: "Org" }, // @orgs
22
34
  ] as const
23
35
 
24
36
  function AppLayout() {
25
- const me = useQuery(meQuery)
37
+ const me = useQuery(meQuery) // @admin
38
+ // notifications:begin
26
39
  const unread = useQuery({
27
40
  queryKey: ["notifications", "count"],
28
41
  queryFn: async () => (await api.notifications.$get({ query: {} })).json(),
29
42
  }).data?.unreadCount
30
- const staff = me.data && me.data.user.role !== "user"
43
+ // notifications:end
44
+ const staff = me.data && me.data.user.role !== "user" // @admin
45
+ // orgs:begin
31
46
  const navigate = useNavigate()
32
47
  const orgs = useQuery(orgsQuery).data?.orgs ?? []
33
48
  const current = useQuery({ ...currentOrgQuery, retry: false }).data
49
+ // orgs:end
34
50
 
35
51
  return (
36
52
  <>
@@ -38,6 +54,7 @@ function AppLayout() {
38
54
  <Link to="/" className="font-medium">
39
55
  __APP_NAME__
40
56
  </Link>
57
+ {/* orgs:begin */}
41
58
  {/* Every org you belong to; switching reloads into the other one. */}
42
59
  <OrgSwitcher
43
60
  className="w-48"
@@ -46,6 +63,7 @@ function AppLayout() {
46
63
  onSwitch={(id) => switchOrg(id)}
47
64
  onCreate={() => navigate({ to: "/org/new" })}
48
65
  />
66
+ {/* orgs:end */}
49
67
  <nav className="flex flex-1 flex-wrap items-center gap-1 text-sm">
50
68
  {NAV.map((n) => (
51
69
  <Link
@@ -54,11 +72,14 @@ function AppLayout() {
54
72
  className="rounded-md px-2 py-1 text-muted-foreground data-[status=active]:bg-muted data-[status=active]:text-foreground"
55
73
  >
56
74
  {n.label}
75
+ {/* notifications:begin */}
57
76
  {n.to === "/notifications" && unread ? (
58
77
  <Badge className="ml-1">{unread}</Badge>
59
78
  ) : null}
79
+ {/* notifications:end */}
60
80
  </Link>
61
81
  ))}
82
+ {/* admin:begin */}
62
83
  {staff ? (
63
84
  <Link
64
85
  to="/admin"
@@ -67,8 +88,10 @@ function AppLayout() {
67
88
  Admin
68
89
  </Link>
69
90
  ) : null}
91
+ {/* admin:end */}
70
92
  </nav>
71
93
  <ThemeToggle />
94
+ {/* auth:begin */}
72
95
  <Button
73
96
  variant="ghost"
74
97
  size="sm"
@@ -79,6 +102,7 @@ function AppLayout() {
79
102
  >
80
103
  Sign out
81
104
  </Button>
105
+ {/* auth:end */}
82
106
  </header>
83
107
  <main className="mx-auto max-w-3xl p-6">
84
108
  <Outlet />