@0x0501/mystack 0.0.0-stage → 0.1.0-bootstrap.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 (211) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -2
  3. package/assets/auth.sqlite.schema.ts +479 -0
  4. package/assets/bun-sqlite.test.ts +46 -0
  5. package/assets/d1.test.ts +41 -0
  6. package/assets/drizzle.config.ts +2 -0
  7. package/assets/generate-auth-schema.mjs +25 -0
  8. package/assets/platform.sqlite.schema.ts +46 -0
  9. package/assets/polar-checkout.ts +10 -0
  10. package/assets/polar-route.ts +19 -0
  11. package/assets/polar.test.ts +30 -0
  12. package/assets/polar.ts +12 -0
  13. package/assets/purchase.bun-sqlite.ts +38 -0
  14. package/assets/purchase.sqlite.ts +39 -0
  15. package/assets/sqlite-migrations/0000_thin_phalanx.sql +295 -0
  16. package/assets/sqlite-migrations/meta/0000_snapshot.json +2058 -0
  17. package/assets/sqlite-migrations/meta/_journal.json +13 -0
  18. package/assets/turso.test.ts +40 -0
  19. package/package.json +44 -5
  20. package/src/adapters/database.mjs +448 -0
  21. package/src/adapters/deployment.mjs +101 -0
  22. package/src/adapters/email.mjs +75 -0
  23. package/src/adapters/payments.mjs +270 -0
  24. package/src/catalog.mjs +128 -0
  25. package/src/cli.mjs +294 -0
  26. package/src/generate.mjs +183 -0
  27. package/src/template.mjs +93 -0
  28. package/template/.env.docker +16 -0
  29. package/template/.env.example +67 -0
  30. package/template/DESIGN.md +58 -0
  31. package/template/LICENSE +21 -0
  32. package/template/biome.json +46 -0
  33. package/template/docker-compose.yml +47 -0
  34. package/template/docs/project-guide.md +61 -0
  35. package/template/drizzle/0000_create-app-role.sql +54 -0
  36. package/template/drizzle/0001_add-rls-context.sql +21 -0
  37. package/template/drizzle/0002_platform_tables.sql +320 -0
  38. package/template/drizzle/meta/0002_snapshot.json +2125 -0
  39. package/template/drizzle/meta/_journal.json +27 -0
  40. package/template/drizzle.config.ts +25 -0
  41. package/template/e2e/authenticated-ui.spec.ts +40 -0
  42. package/template/e2e/headless-design.spec.ts +66 -0
  43. package/template/e2e/navigation-loading.spec.ts +70 -0
  44. package/template/e2e/theme-responsive.spec.ts +260 -0
  45. package/template/gitignore +24 -0
  46. package/template/messages/de.json +212 -0
  47. package/template/messages/en.json +212 -0
  48. package/template/package.json +101 -0
  49. package/template/paraglide.config.ts +49 -0
  50. package/template/playwright.config.ts +58 -0
  51. package/template/project.inlang/settings.json +12 -0
  52. package/template/public/drizzle.svg +1 -0
  53. package/template/public/favicon.ico +0 -0
  54. package/template/public/logo192.png +0 -0
  55. package/template/public/logo512.png +0 -0
  56. package/template/public/manifest.json +25 -0
  57. package/template/public/robots.txt +3 -0
  58. package/template/scripts/check-client-bundle.ts +150 -0
  59. package/template/scripts/check-server-fns.ts +290 -0
  60. package/template/scripts/check-sql-raw.ts +50 -0
  61. package/template/scripts/compile-paraglide.ts +12 -0
  62. package/template/scripts/postgres/README.md +76 -0
  63. package/template/scripts/postgres/create-app-role.sh +60 -0
  64. package/template/scripts/seed-local.ts +331 -0
  65. package/template/scripts/validate-prod-env.ts +53 -0
  66. package/template/src/__tests__/README.md +9 -0
  67. package/template/src/__tests__/account-security.test.ts +664 -0
  68. package/template/src/__tests__/admin-http-surface.test.ts +311 -0
  69. package/template/src/__tests__/admin-peer-protection.test.ts +178 -0
  70. package/template/src/__tests__/auth-harness.ts +104 -0
  71. package/template/src/__tests__/auth-rate-limit.test.ts +43 -0
  72. package/template/src/__tests__/auth-redirect.test.ts +120 -0
  73. package/template/src/__tests__/body-limit.test.ts +47 -0
  74. package/template/src/__tests__/creem.test.ts +62 -0
  75. package/template/src/__tests__/demo-checkout.test.ts +141 -0
  76. package/template/src/__tests__/email-locale.test.ts +110 -0
  77. package/template/src/__tests__/global-setup.ts +80 -0
  78. package/template/src/__tests__/input-rules.test.ts +0 -0
  79. package/template/src/__tests__/message-parity.test.ts +38 -0
  80. package/template/src/__tests__/navigation-loading.test.tsx +252 -0
  81. package/template/src/__tests__/nowpayments.test.ts +106 -0
  82. package/template/src/__tests__/paraglide-url-contract.test.ts +87 -0
  83. package/template/src/__tests__/purchase-fulfillment.test.ts +204 -0
  84. package/template/src/__tests__/query-unauthorized-redirect.test.ts +95 -0
  85. package/template/src/__tests__/rls-policy.test.ts +120 -0
  86. package/template/src/__tests__/same-page-locale-href.test.ts +47 -0
  87. package/template/src/__tests__/search-params-oauth.test.ts +57 -0
  88. package/template/src/__tests__/security-headers.test.ts +12 -0
  89. package/template/src/__tests__/server-fn-error-contract.test.ts +173 -0
  90. package/template/src/__tests__/stripe.test.ts +84 -0
  91. package/template/src/__tests__/test-db.ts +32 -0
  92. package/template/src/__tests__/test-rls-db.ts +23 -0
  93. package/template/src/__tests__/user-update-guard.test.ts +109 -0
  94. package/template/src/components/LocaleSwitcher.tsx +79 -0
  95. package/template/src/components/ThemeToggle.tsx +47 -0
  96. package/template/src/components/auth/social.tsx +90 -0
  97. package/template/src/components/auth/turnstile.tsx +67 -0
  98. package/template/src/components/root/navigation-progress.tsx +32 -0
  99. package/template/src/components/root/not-found.tsx +20 -0
  100. package/template/src/components/root/pending.tsx +9 -0
  101. package/template/src/components/root/root-document.tsx +37 -0
  102. package/template/src/components/root/root-error.tsx +34 -0
  103. package/template/src/components/shells.tsx +201 -0
  104. package/template/src/components/ui/styles.ts +9 -0
  105. package/template/src/db/auth.schema.ts +455 -0
  106. package/template/src/db/helper.ts +38 -0
  107. package/template/src/db/index.ts +15 -0
  108. package/template/src/db/platform.schema.ts +122 -0
  109. package/template/src/db/schema.ts +2 -0
  110. package/template/src/env.ts +65 -0
  111. package/template/src/hooks/use-theme.ts +32 -0
  112. package/template/src/integrations/better-auth/header-user.tsx +36 -0
  113. package/template/src/integrations/better-auth/session-query.ts +11 -0
  114. package/template/src/integrations/react-email/PasswordOtpEmail.tsx +62 -0
  115. package/template/src/integrations/react-email/ResetPasswordEmail.tsx +64 -0
  116. package/template/src/integrations/react-email/VerifyEmail.tsx +72 -0
  117. package/template/src/integrations/react-email/theme.ts +75 -0
  118. package/template/src/integrations/tanstack-query/devtools.tsx +6 -0
  119. package/template/src/integrations/tanstack-query/root-provider.tsx +60 -0
  120. package/template/src/lib/auth-client.ts +27 -0
  121. package/template/src/lib/auth-paths.ts +94 -0
  122. package/template/src/lib/auth-plugins/existing-email-signup.ts +86 -0
  123. package/template/src/lib/auth-plugins/field-rules.ts +84 -0
  124. package/template/src/lib/auth-plugins/social-two-factor.ts +194 -0
  125. package/template/src/lib/auth-timing.ts +9 -0
  126. package/template/src/lib/auth.ts +279 -0
  127. package/template/src/lib/captcha.ts +11 -0
  128. package/template/src/lib/email.tsx +162 -0
  129. package/template/src/lib/github.ts +18 -0
  130. package/template/src/lib/locale-cookie.ts +12 -0
  131. package/template/src/lib/localized-pages.ts +25 -0
  132. package/template/src/lib/oauth-metadata.ts +19 -0
  133. package/template/src/lib/permissions.ts +29 -0
  134. package/template/src/lib/security-headers.ts +20 -0
  135. package/template/src/lib/site.ts +59 -0
  136. package/template/src/lib/theme.ts +42 -0
  137. package/template/src/lib/user-update-guard.ts +35 -0
  138. package/template/src/middlewares/admin.ts +46 -0
  139. package/template/src/middlewares/auth-rate-limit.ts +37 -0
  140. package/template/src/middlewares/better-auth.ts +15 -0
  141. package/template/src/middlewares/body-limit.ts +62 -0
  142. package/template/src/middlewares/database.ts +13 -0
  143. package/template/src/middlewares/protected.ts +45 -0
  144. package/template/src/routeTree.gen.ts +536 -0
  145. package/template/src/router.tsx +53 -0
  146. package/template/src/routes/[.]well-known/oauth-authorization-server/api/auth.ts +18 -0
  147. package/template/src/routes/[.]well-known/oauth-protected-resource/index.ts +32 -0
  148. package/template/src/routes/__root.tsx +175 -0
  149. package/template/src/routes/admin/audit.tsx +74 -0
  150. package/template/src/routes/admin/index.tsx +7 -0
  151. package/template/src/routes/admin/oauth-apps.tsx +164 -0
  152. package/template/src/routes/admin/route.tsx +27 -0
  153. package/template/src/routes/admin/users.tsx +215 -0
  154. package/template/src/routes/api/auth/$.ts +14 -0
  155. package/template/src/routes/api/auth/[.]well-known/openid-configuration.ts +15 -0
  156. package/template/src/routes/api/webhooks/creem.ts +69 -0
  157. package/template/src/routes/api/webhooks/nowpayments.ts +62 -0
  158. package/template/src/routes/api/webhooks/stripe.ts +74 -0
  159. package/template/src/routes/dashboard/account.tsx +430 -0
  160. package/template/src/routes/dashboard/index.tsx +128 -0
  161. package/template/src/routes/dashboard/route.tsx +17 -0
  162. package/template/src/routes/forgot-password.tsx +65 -0
  163. package/template/src/routes/index.tsx +85 -0
  164. package/template/src/routes/oauth/consent.tsx +77 -0
  165. package/template/src/routes/reset-password.tsx +78 -0
  166. package/template/src/routes/sign-in.tsx +174 -0
  167. package/template/src/routes/sign-up.tsx +135 -0
  168. package/template/src/routes/two-factor.tsx +74 -0
  169. package/template/src/server/README.md +3 -0
  170. package/template/src/server/account-security.ts +163 -0
  171. package/template/src/server/admin-audit.ts +37 -0
  172. package/template/src/server/admin-users.ts +112 -0
  173. package/template/src/server/auth.ts +44 -0
  174. package/template/src/server/demo-checkout.ts +67 -0
  175. package/template/src/server/oauth-clients.ts +83 -0
  176. package/template/src/server/payment-toggles.ts +39 -0
  177. package/template/src/server.ts +20 -0
  178. package/template/src/services/README.md +3 -0
  179. package/template/src/services/account-security.ts +893 -0
  180. package/template/src/services/admin-security.ts +164 -0
  181. package/template/src/services/admin-users.ts +181 -0
  182. package/template/src/services/auth-rate-limit.ts +32 -0
  183. package/template/src/services/creem.ts +83 -0
  184. package/template/src/services/demo-checkout.ts +100 -0
  185. package/template/src/services/nowpayments.ts +154 -0
  186. package/template/src/services/oauth-client.ts +85 -0
  187. package/template/src/services/oauth-clients.ts +15 -0
  188. package/template/src/services/payment-providers.ts +157 -0
  189. package/template/src/services/payment-toggles.ts +48 -0
  190. package/template/src/services/purchase.ts +233 -0
  191. package/template/src/services/stripe.ts +106 -0
  192. package/template/src/start.ts +35 -0
  193. package/template/src/styles/layout.css +93 -0
  194. package/template/src/styles/theme.css +84 -0
  195. package/template/src/styles/ui.css +233 -0
  196. package/template/src/styles.css +90 -0
  197. package/template/src/utils/api-error.ts +129 -0
  198. package/template/src/utils/auth-errors.ts +157 -0
  199. package/template/src/utils/auth-redirect.ts +61 -0
  200. package/template/src/utils/body-limit.ts +84 -0
  201. package/template/src/utils/cn.ts +6 -0
  202. package/template/src/utils/input-rules.ts +172 -0
  203. package/template/src/utils/locale-paths.ts +18 -0
  204. package/template/src/utils/same-page-locale-href.ts +20 -0
  205. package/template/src/utils/search-params.ts +71 -0
  206. package/template/tsconfig.json +30 -0
  207. package/template/tsr.config.json +6 -0
  208. package/template/vite.config.ts +24 -0
  209. package/template/vitest.config.ts +26 -0
  210. package/template/worker-configuration.d.ts +14660 -0
  211. package/template/wrangler.jsonc +39 -0
@@ -0,0 +1,536 @@
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+
7
+ // This file was automatically generated by TanStack Router.
8
+ // You should NOT make any changes in this file as it will be overwritten.
9
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
+
11
+ import { Route as rootRouteImport } from './routes/__root'
12
+ import { Route as IndexRouteImport } from './routes/index'
13
+ import { Route as AdminRouteRouteImport } from './routes/admin/route'
14
+ import { Route as DashboardRouteRouteImport } from './routes/dashboard/route'
15
+ import { Route as ForgotPasswordRouteImport } from './routes/forgot-password'
16
+ import { Route as ResetPasswordRouteImport } from './routes/reset-password'
17
+ import { Route as SignInRouteImport } from './routes/sign-in'
18
+ import { Route as SignUpRouteImport } from './routes/sign-up'
19
+ import { Route as TwoFactorRouteImport } from './routes/two-factor'
20
+ import { Route as AdminIndexRouteImport } from './routes/admin/index'
21
+ import { Route as AdminAuditRouteImport } from './routes/admin/audit'
22
+ import { Route as AdminOauthAppsRouteImport } from './routes/admin/oauth-apps'
23
+ import { Route as AdminUsersRouteImport } from './routes/admin/users'
24
+ import { Route as DashboardIndexRouteImport } from './routes/dashboard/index'
25
+ import { Route as DashboardAccountRouteImport } from './routes/dashboard/account'
26
+ import { Route as OauthConsentRouteImport } from './routes/oauth/consent'
27
+ import { Route as DotwellKnownOauthProtectedResourceIndexRouteImport } from './routes/[.]well-known/oauth-protected-resource/index'
28
+ import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
29
+ import { Route as ApiWebhooksCreemRouteImport } from './routes/api/webhooks/creem'
30
+ import { Route as ApiWebhooksNowpaymentsRouteImport } from './routes/api/webhooks/nowpayments'
31
+ import { Route as ApiWebhooksStripeRouteImport } from './routes/api/webhooks/stripe'
32
+ import { Route as DotwellKnownOauthAuthorizationServerApiAuthRouteImport } from './routes/[.]well-known/oauth-authorization-server/api/auth'
33
+ import { Route as ApiAuthDotwellKnownOpenidConfigurationRouteImport } from './routes/api/auth/[.]well-known/openid-configuration'
34
+
35
+ const IndexRoute = IndexRouteImport.update({
36
+ id: '/',
37
+ path: '/',
38
+ getParentRoute: () => rootRouteImport,
39
+ } as any)
40
+ const AdminRouteRoute = AdminRouteRouteImport.update({
41
+ id: '/admin',
42
+ path: '/admin',
43
+ getParentRoute: () => rootRouteImport,
44
+ } as any)
45
+ const DashboardRouteRoute = DashboardRouteRouteImport.update({
46
+ id: '/dashboard',
47
+ path: '/dashboard',
48
+ getParentRoute: () => rootRouteImport,
49
+ } as any)
50
+ const ForgotPasswordRoute = ForgotPasswordRouteImport.update({
51
+ id: '/forgot-password',
52
+ path: '/forgot-password',
53
+ getParentRoute: () => rootRouteImport,
54
+ } as any)
55
+ const ResetPasswordRoute = ResetPasswordRouteImport.update({
56
+ id: '/reset-password',
57
+ path: '/reset-password',
58
+ getParentRoute: () => rootRouteImport,
59
+ } as any)
60
+ const SignInRoute = SignInRouteImport.update({
61
+ id: '/sign-in',
62
+ path: '/sign-in',
63
+ getParentRoute: () => rootRouteImport,
64
+ } as any)
65
+ const SignUpRoute = SignUpRouteImport.update({
66
+ id: '/sign-up',
67
+ path: '/sign-up',
68
+ getParentRoute: () => rootRouteImport,
69
+ } as any)
70
+ const TwoFactorRoute = TwoFactorRouteImport.update({
71
+ id: '/two-factor',
72
+ path: '/two-factor',
73
+ getParentRoute: () => rootRouteImport,
74
+ } as any)
75
+ const AdminIndexRoute = AdminIndexRouteImport.update({
76
+ id: '/',
77
+ path: '/',
78
+ getParentRoute: () => AdminRouteRoute,
79
+ } as any)
80
+ const AdminAuditRoute = AdminAuditRouteImport.update({
81
+ id: '/audit',
82
+ path: '/audit',
83
+ getParentRoute: () => AdminRouteRoute,
84
+ } as any)
85
+ const AdminOauthAppsRoute = AdminOauthAppsRouteImport.update({
86
+ id: '/oauth-apps',
87
+ path: '/oauth-apps',
88
+ getParentRoute: () => AdminRouteRoute,
89
+ } as any)
90
+ const AdminUsersRoute = AdminUsersRouteImport.update({
91
+ id: '/users',
92
+ path: '/users',
93
+ getParentRoute: () => AdminRouteRoute,
94
+ } as any)
95
+ const DashboardIndexRoute = DashboardIndexRouteImport.update({
96
+ id: '/',
97
+ path: '/',
98
+ getParentRoute: () => DashboardRouteRoute,
99
+ } as any)
100
+ const DashboardAccountRoute = DashboardAccountRouteImport.update({
101
+ id: '/account',
102
+ path: '/account',
103
+ getParentRoute: () => DashboardRouteRoute,
104
+ } as any)
105
+ const OauthConsentRoute = OauthConsentRouteImport.update({
106
+ id: '/oauth/consent',
107
+ path: '/oauth/consent',
108
+ getParentRoute: () => rootRouteImport,
109
+ } as any)
110
+ const DotwellKnownOauthProtectedResourceIndexRoute =
111
+ DotwellKnownOauthProtectedResourceIndexRouteImport.update({
112
+ id: '/.well-known/oauth-protected-resource/',
113
+ path: '/.well-known/oauth-protected-resource/',
114
+ getParentRoute: () => rootRouteImport,
115
+ } as any)
116
+ const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
117
+ id: '/api/auth/$',
118
+ path: '/api/auth/$',
119
+ getParentRoute: () => rootRouteImport,
120
+ } as any)
121
+ const ApiWebhooksCreemRoute = ApiWebhooksCreemRouteImport.update({
122
+ id: '/api/webhooks/creem',
123
+ path: '/api/webhooks/creem',
124
+ getParentRoute: () => rootRouteImport,
125
+ } as any)
126
+ const ApiWebhooksNowpaymentsRoute = ApiWebhooksNowpaymentsRouteImport.update({
127
+ id: '/api/webhooks/nowpayments',
128
+ path: '/api/webhooks/nowpayments',
129
+ getParentRoute: () => rootRouteImport,
130
+ } as any)
131
+ const ApiWebhooksStripeRoute = ApiWebhooksStripeRouteImport.update({
132
+ id: '/api/webhooks/stripe',
133
+ path: '/api/webhooks/stripe',
134
+ getParentRoute: () => rootRouteImport,
135
+ } as any)
136
+ const DotwellKnownOauthAuthorizationServerApiAuthRoute =
137
+ DotwellKnownOauthAuthorizationServerApiAuthRouteImport.update({
138
+ id: '/.well-known/oauth-authorization-server/api/auth',
139
+ path: '/.well-known/oauth-authorization-server/api/auth',
140
+ getParentRoute: () => rootRouteImport,
141
+ } as any)
142
+ const ApiAuthDotwellKnownOpenidConfigurationRoute =
143
+ ApiAuthDotwellKnownOpenidConfigurationRouteImport.update({
144
+ id: '/api/auth/.well-known/openid-configuration',
145
+ path: '/api/auth/.well-known/openid-configuration',
146
+ getParentRoute: () => rootRouteImport,
147
+ } as any)
148
+
149
+ export interface FileRoutesByFullPath {
150
+ '/': typeof IndexRoute
151
+ '/admin': typeof AdminRouteRouteWithChildren
152
+ '/dashboard': typeof DashboardRouteRouteWithChildren
153
+ '/forgot-password': typeof ForgotPasswordRoute
154
+ '/reset-password': typeof ResetPasswordRoute
155
+ '/sign-in': typeof SignInRoute
156
+ '/sign-up': typeof SignUpRoute
157
+ '/two-factor': typeof TwoFactorRoute
158
+ '/admin/audit': typeof AdminAuditRoute
159
+ '/admin/oauth-apps': typeof AdminOauthAppsRoute
160
+ '/admin/users': typeof AdminUsersRoute
161
+ '/dashboard/account': typeof DashboardAccountRoute
162
+ '/oauth/consent': typeof OauthConsentRoute
163
+ '/admin/': typeof AdminIndexRoute
164
+ '/dashboard/': typeof DashboardIndexRoute
165
+ '/api/auth/$': typeof ApiAuthSplatRoute
166
+ '/api/webhooks/creem': typeof ApiWebhooksCreemRoute
167
+ '/api/webhooks/nowpayments': typeof ApiWebhooksNowpaymentsRoute
168
+ '/api/webhooks/stripe': typeof ApiWebhooksStripeRoute
169
+ '/.well-known/oauth-protected-resource/': typeof DotwellKnownOauthProtectedResourceIndexRoute
170
+ '/.well-known/oauth-authorization-server/api/auth': typeof DotwellKnownOauthAuthorizationServerApiAuthRoute
171
+ '/api/auth/.well-known/openid-configuration': typeof ApiAuthDotwellKnownOpenidConfigurationRoute
172
+ }
173
+ export interface FileRoutesByTo {
174
+ '/': typeof IndexRoute
175
+ '/forgot-password': typeof ForgotPasswordRoute
176
+ '/reset-password': typeof ResetPasswordRoute
177
+ '/sign-in': typeof SignInRoute
178
+ '/sign-up': typeof SignUpRoute
179
+ '/two-factor': typeof TwoFactorRoute
180
+ '/admin/audit': typeof AdminAuditRoute
181
+ '/admin/oauth-apps': typeof AdminOauthAppsRoute
182
+ '/admin/users': typeof AdminUsersRoute
183
+ '/dashboard/account': typeof DashboardAccountRoute
184
+ '/oauth/consent': typeof OauthConsentRoute
185
+ '/admin': typeof AdminIndexRoute
186
+ '/dashboard': typeof DashboardIndexRoute
187
+ '/api/auth/$': typeof ApiAuthSplatRoute
188
+ '/api/webhooks/creem': typeof ApiWebhooksCreemRoute
189
+ '/api/webhooks/nowpayments': typeof ApiWebhooksNowpaymentsRoute
190
+ '/api/webhooks/stripe': typeof ApiWebhooksStripeRoute
191
+ '/.well-known/oauth-protected-resource': typeof DotwellKnownOauthProtectedResourceIndexRoute
192
+ '/.well-known/oauth-authorization-server/api/auth': typeof DotwellKnownOauthAuthorizationServerApiAuthRoute
193
+ '/api/auth/.well-known/openid-configuration': typeof ApiAuthDotwellKnownOpenidConfigurationRoute
194
+ }
195
+ export interface FileRoutesById {
196
+ __root__: typeof rootRouteImport
197
+ '/': typeof IndexRoute
198
+ '/admin': typeof AdminRouteRouteWithChildren
199
+ '/dashboard': typeof DashboardRouteRouteWithChildren
200
+ '/forgot-password': typeof ForgotPasswordRoute
201
+ '/reset-password': typeof ResetPasswordRoute
202
+ '/sign-in': typeof SignInRoute
203
+ '/sign-up': typeof SignUpRoute
204
+ '/two-factor': typeof TwoFactorRoute
205
+ '/admin/audit': typeof AdminAuditRoute
206
+ '/admin/oauth-apps': typeof AdminOauthAppsRoute
207
+ '/admin/users': typeof AdminUsersRoute
208
+ '/dashboard/account': typeof DashboardAccountRoute
209
+ '/oauth/consent': typeof OauthConsentRoute
210
+ '/admin/': typeof AdminIndexRoute
211
+ '/dashboard/': typeof DashboardIndexRoute
212
+ '/api/auth/$': typeof ApiAuthSplatRoute
213
+ '/api/webhooks/creem': typeof ApiWebhooksCreemRoute
214
+ '/api/webhooks/nowpayments': typeof ApiWebhooksNowpaymentsRoute
215
+ '/api/webhooks/stripe': typeof ApiWebhooksStripeRoute
216
+ '/.well-known/oauth-protected-resource/': typeof DotwellKnownOauthProtectedResourceIndexRoute
217
+ '/.well-known/oauth-authorization-server/api/auth': typeof DotwellKnownOauthAuthorizationServerApiAuthRoute
218
+ '/api/auth/.well-known/openid-configuration': typeof ApiAuthDotwellKnownOpenidConfigurationRoute
219
+ }
220
+ export interface FileRouteTypes {
221
+ fileRoutesByFullPath: FileRoutesByFullPath
222
+ fullPaths:
223
+ | '/'
224
+ | '/admin'
225
+ | '/dashboard'
226
+ | '/forgot-password'
227
+ | '/reset-password'
228
+ | '/sign-in'
229
+ | '/sign-up'
230
+ | '/two-factor'
231
+ | '/admin/audit'
232
+ | '/admin/oauth-apps'
233
+ | '/admin/users'
234
+ | '/dashboard/account'
235
+ | '/oauth/consent'
236
+ | '/admin/'
237
+ | '/dashboard/'
238
+ | '/api/auth/$'
239
+ | '/api/webhooks/creem'
240
+ | '/api/webhooks/nowpayments'
241
+ | '/api/webhooks/stripe'
242
+ | '/.well-known/oauth-protected-resource/'
243
+ | '/.well-known/oauth-authorization-server/api/auth'
244
+ | '/api/auth/.well-known/openid-configuration'
245
+ fileRoutesByTo: FileRoutesByTo
246
+ to:
247
+ | '/'
248
+ | '/forgot-password'
249
+ | '/reset-password'
250
+ | '/sign-in'
251
+ | '/sign-up'
252
+ | '/two-factor'
253
+ | '/admin/audit'
254
+ | '/admin/oauth-apps'
255
+ | '/admin/users'
256
+ | '/dashboard/account'
257
+ | '/oauth/consent'
258
+ | '/admin'
259
+ | '/dashboard'
260
+ | '/api/auth/$'
261
+ | '/api/webhooks/creem'
262
+ | '/api/webhooks/nowpayments'
263
+ | '/api/webhooks/stripe'
264
+ | '/.well-known/oauth-protected-resource'
265
+ | '/.well-known/oauth-authorization-server/api/auth'
266
+ | '/api/auth/.well-known/openid-configuration'
267
+ id:
268
+ | '__root__'
269
+ | '/'
270
+ | '/admin'
271
+ | '/dashboard'
272
+ | '/forgot-password'
273
+ | '/reset-password'
274
+ | '/sign-in'
275
+ | '/sign-up'
276
+ | '/two-factor'
277
+ | '/admin/audit'
278
+ | '/admin/oauth-apps'
279
+ | '/admin/users'
280
+ | '/dashboard/account'
281
+ | '/oauth/consent'
282
+ | '/admin/'
283
+ | '/dashboard/'
284
+ | '/api/auth/$'
285
+ | '/api/webhooks/creem'
286
+ | '/api/webhooks/nowpayments'
287
+ | '/api/webhooks/stripe'
288
+ | '/.well-known/oauth-protected-resource/'
289
+ | '/.well-known/oauth-authorization-server/api/auth'
290
+ | '/api/auth/.well-known/openid-configuration'
291
+ fileRoutesById: FileRoutesById
292
+ }
293
+ export interface RootRouteChildren {
294
+ IndexRoute: typeof IndexRoute
295
+ AdminRouteRoute: typeof AdminRouteRouteWithChildren
296
+ DashboardRouteRoute: typeof DashboardRouteRouteWithChildren
297
+ ForgotPasswordRoute: typeof ForgotPasswordRoute
298
+ ResetPasswordRoute: typeof ResetPasswordRoute
299
+ SignInRoute: typeof SignInRoute
300
+ SignUpRoute: typeof SignUpRoute
301
+ TwoFactorRoute: typeof TwoFactorRoute
302
+ OauthConsentRoute: typeof OauthConsentRoute
303
+ ApiAuthSplatRoute: typeof ApiAuthSplatRoute
304
+ ApiWebhooksCreemRoute: typeof ApiWebhooksCreemRoute
305
+ ApiWebhooksNowpaymentsRoute: typeof ApiWebhooksNowpaymentsRoute
306
+ ApiWebhooksStripeRoute: typeof ApiWebhooksStripeRoute
307
+ DotwellKnownOauthProtectedResourceIndexRoute: typeof DotwellKnownOauthProtectedResourceIndexRoute
308
+ DotwellKnownOauthAuthorizationServerApiAuthRoute: typeof DotwellKnownOauthAuthorizationServerApiAuthRoute
309
+ ApiAuthDotwellKnownOpenidConfigurationRoute: typeof ApiAuthDotwellKnownOpenidConfigurationRoute
310
+ }
311
+
312
+ declare module '@tanstack/react-router' {
313
+ interface FileRoutesByPath {
314
+ '/': {
315
+ id: '/'
316
+ path: '/'
317
+ fullPath: '/'
318
+ preLoaderRoute: typeof IndexRouteImport
319
+ parentRoute: typeof rootRouteImport
320
+ }
321
+ '/admin': {
322
+ id: '/admin'
323
+ path: '/admin'
324
+ fullPath: '/admin'
325
+ preLoaderRoute: typeof AdminRouteRouteImport
326
+ parentRoute: typeof rootRouteImport
327
+ }
328
+ '/dashboard': {
329
+ id: '/dashboard'
330
+ path: '/dashboard'
331
+ fullPath: '/dashboard'
332
+ preLoaderRoute: typeof DashboardRouteRouteImport
333
+ parentRoute: typeof rootRouteImport
334
+ }
335
+ '/forgot-password': {
336
+ id: '/forgot-password'
337
+ path: '/forgot-password'
338
+ fullPath: '/forgot-password'
339
+ preLoaderRoute: typeof ForgotPasswordRouteImport
340
+ parentRoute: typeof rootRouteImport
341
+ }
342
+ '/reset-password': {
343
+ id: '/reset-password'
344
+ path: '/reset-password'
345
+ fullPath: '/reset-password'
346
+ preLoaderRoute: typeof ResetPasswordRouteImport
347
+ parentRoute: typeof rootRouteImport
348
+ }
349
+ '/sign-in': {
350
+ id: '/sign-in'
351
+ path: '/sign-in'
352
+ fullPath: '/sign-in'
353
+ preLoaderRoute: typeof SignInRouteImport
354
+ parentRoute: typeof rootRouteImport
355
+ }
356
+ '/sign-up': {
357
+ id: '/sign-up'
358
+ path: '/sign-up'
359
+ fullPath: '/sign-up'
360
+ preLoaderRoute: typeof SignUpRouteImport
361
+ parentRoute: typeof rootRouteImport
362
+ }
363
+ '/two-factor': {
364
+ id: '/two-factor'
365
+ path: '/two-factor'
366
+ fullPath: '/two-factor'
367
+ preLoaderRoute: typeof TwoFactorRouteImport
368
+ parentRoute: typeof rootRouteImport
369
+ }
370
+ '/admin/': {
371
+ id: '/admin/'
372
+ path: '/'
373
+ fullPath: '/admin/'
374
+ preLoaderRoute: typeof AdminIndexRouteImport
375
+ parentRoute: typeof AdminRouteRoute
376
+ }
377
+ '/admin/audit': {
378
+ id: '/admin/audit'
379
+ path: '/audit'
380
+ fullPath: '/admin/audit'
381
+ preLoaderRoute: typeof AdminAuditRouteImport
382
+ parentRoute: typeof AdminRouteRoute
383
+ }
384
+ '/admin/oauth-apps': {
385
+ id: '/admin/oauth-apps'
386
+ path: '/oauth-apps'
387
+ fullPath: '/admin/oauth-apps'
388
+ preLoaderRoute: typeof AdminOauthAppsRouteImport
389
+ parentRoute: typeof AdminRouteRoute
390
+ }
391
+ '/admin/users': {
392
+ id: '/admin/users'
393
+ path: '/users'
394
+ fullPath: '/admin/users'
395
+ preLoaderRoute: typeof AdminUsersRouteImport
396
+ parentRoute: typeof AdminRouteRoute
397
+ }
398
+ '/dashboard/': {
399
+ id: '/dashboard/'
400
+ path: '/'
401
+ fullPath: '/dashboard/'
402
+ preLoaderRoute: typeof DashboardIndexRouteImport
403
+ parentRoute: typeof DashboardRouteRoute
404
+ }
405
+ '/dashboard/account': {
406
+ id: '/dashboard/account'
407
+ path: '/account'
408
+ fullPath: '/dashboard/account'
409
+ preLoaderRoute: typeof DashboardAccountRouteImport
410
+ parentRoute: typeof DashboardRouteRoute
411
+ }
412
+ '/oauth/consent': {
413
+ id: '/oauth/consent'
414
+ path: '/oauth/consent'
415
+ fullPath: '/oauth/consent'
416
+ preLoaderRoute: typeof OauthConsentRouteImport
417
+ parentRoute: typeof rootRouteImport
418
+ }
419
+ '/.well-known/oauth-protected-resource/': {
420
+ id: '/.well-known/oauth-protected-resource/'
421
+ path: '/.well-known/oauth-protected-resource'
422
+ fullPath: '/.well-known/oauth-protected-resource/'
423
+ preLoaderRoute: typeof DotwellKnownOauthProtectedResourceIndexRouteImport
424
+ parentRoute: typeof rootRouteImport
425
+ }
426
+ '/api/auth/$': {
427
+ id: '/api/auth/$'
428
+ path: '/api/auth/$'
429
+ fullPath: '/api/auth/$'
430
+ preLoaderRoute: typeof ApiAuthSplatRouteImport
431
+ parentRoute: typeof rootRouteImport
432
+ }
433
+ '/api/webhooks/creem': {
434
+ id: '/api/webhooks/creem'
435
+ path: '/api/webhooks/creem'
436
+ fullPath: '/api/webhooks/creem'
437
+ preLoaderRoute: typeof ApiWebhooksCreemRouteImport
438
+ parentRoute: typeof rootRouteImport
439
+ }
440
+ '/api/webhooks/nowpayments': {
441
+ id: '/api/webhooks/nowpayments'
442
+ path: '/api/webhooks/nowpayments'
443
+ fullPath: '/api/webhooks/nowpayments'
444
+ preLoaderRoute: typeof ApiWebhooksNowpaymentsRouteImport
445
+ parentRoute: typeof rootRouteImport
446
+ }
447
+ '/api/webhooks/stripe': {
448
+ id: '/api/webhooks/stripe'
449
+ path: '/api/webhooks/stripe'
450
+ fullPath: '/api/webhooks/stripe'
451
+ preLoaderRoute: typeof ApiWebhooksStripeRouteImport
452
+ parentRoute: typeof rootRouteImport
453
+ }
454
+ '/.well-known/oauth-authorization-server/api/auth': {
455
+ id: '/.well-known/oauth-authorization-server/api/auth'
456
+ path: '/.well-known/oauth-authorization-server/api/auth'
457
+ fullPath: '/.well-known/oauth-authorization-server/api/auth'
458
+ preLoaderRoute: typeof DotwellKnownOauthAuthorizationServerApiAuthRouteImport
459
+ parentRoute: typeof rootRouteImport
460
+ }
461
+ '/api/auth/.well-known/openid-configuration': {
462
+ id: '/api/auth/.well-known/openid-configuration'
463
+ path: '/api/auth/.well-known/openid-configuration'
464
+ fullPath: '/api/auth/.well-known/openid-configuration'
465
+ preLoaderRoute: typeof ApiAuthDotwellKnownOpenidConfigurationRouteImport
466
+ parentRoute: typeof rootRouteImport
467
+ }
468
+ }
469
+ }
470
+
471
+ interface AdminRouteRouteChildren {
472
+ AdminAuditRoute: typeof AdminAuditRoute
473
+ AdminOauthAppsRoute: typeof AdminOauthAppsRoute
474
+ AdminUsersRoute: typeof AdminUsersRoute
475
+ AdminIndexRoute: typeof AdminIndexRoute
476
+ }
477
+
478
+ const AdminRouteRouteChildren: AdminRouteRouteChildren = {
479
+ AdminAuditRoute: AdminAuditRoute,
480
+ AdminOauthAppsRoute: AdminOauthAppsRoute,
481
+ AdminUsersRoute: AdminUsersRoute,
482
+ AdminIndexRoute: AdminIndexRoute,
483
+ }
484
+
485
+ const AdminRouteRouteWithChildren = AdminRouteRoute._addFileChildren(
486
+ AdminRouteRouteChildren,
487
+ )
488
+
489
+ interface DashboardRouteRouteChildren {
490
+ DashboardAccountRoute: typeof DashboardAccountRoute
491
+ DashboardIndexRoute: typeof DashboardIndexRoute
492
+ }
493
+
494
+ const DashboardRouteRouteChildren: DashboardRouteRouteChildren = {
495
+ DashboardAccountRoute: DashboardAccountRoute,
496
+ DashboardIndexRoute: DashboardIndexRoute,
497
+ }
498
+
499
+ const DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren(
500
+ DashboardRouteRouteChildren,
501
+ )
502
+
503
+ const rootRouteChildren: RootRouteChildren = {
504
+ IndexRoute: IndexRoute,
505
+ AdminRouteRoute: AdminRouteRouteWithChildren,
506
+ DashboardRouteRoute: DashboardRouteRouteWithChildren,
507
+ ForgotPasswordRoute: ForgotPasswordRoute,
508
+ ResetPasswordRoute: ResetPasswordRoute,
509
+ SignInRoute: SignInRoute,
510
+ SignUpRoute: SignUpRoute,
511
+ TwoFactorRoute: TwoFactorRoute,
512
+ OauthConsentRoute: OauthConsentRoute,
513
+ ApiAuthSplatRoute: ApiAuthSplatRoute,
514
+ ApiWebhooksCreemRoute: ApiWebhooksCreemRoute,
515
+ ApiWebhooksNowpaymentsRoute: ApiWebhooksNowpaymentsRoute,
516
+ ApiWebhooksStripeRoute: ApiWebhooksStripeRoute,
517
+ DotwellKnownOauthProtectedResourceIndexRoute:
518
+ DotwellKnownOauthProtectedResourceIndexRoute,
519
+ DotwellKnownOauthAuthorizationServerApiAuthRoute:
520
+ DotwellKnownOauthAuthorizationServerApiAuthRoute,
521
+ ApiAuthDotwellKnownOpenidConfigurationRoute:
522
+ ApiAuthDotwellKnownOpenidConfigurationRoute,
523
+ }
524
+ export const routeTree = rootRouteImport
525
+ ._addFileChildren(rootRouteChildren)
526
+ ._addFileTypes<FileRouteTypes>()
527
+
528
+ import type { getRouter } from './router.tsx'
529
+ import type { startInstance } from './start.ts'
530
+ declare module '@tanstack/react-start' {
531
+ interface Register {
532
+ ssr: true
533
+ router: Awaited<ReturnType<typeof getRouter>>
534
+ config: Awaited<ReturnType<typeof startInstance.getOptions>>
535
+ }
536
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Router + Paraglide URL rewrite (trailing slash preserve, OAuth search integrity).
3
+ */
4
+ import {
5
+ createRouter as createTanStackRouter,
6
+ defaultParseSearch,
7
+ } from "@tanstack/react-router";
8
+ import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";
9
+ import { RoutePending } from "./components/root/pending";
10
+ import { getContext } from "./integrations/tanstack-query/root-provider";
11
+ import { deLocalizeUrl, localizeUrl } from "./paraglide/runtime";
12
+ import { routeTree } from "./routeTree.gen";
13
+ import { stringifySearch } from "./utils/search-params";
14
+
15
+ export function getRouter() {
16
+ const context = getContext();
17
+
18
+ const router = createTanStackRouter({
19
+ routeTree,
20
+ context,
21
+ scrollRestoration: true,
22
+ defaultPreload: "intent",
23
+ defaultPreloadStaleTime: 0,
24
+ // Slow server functions must provide feedback after the URL changes.
25
+ defaultPendingComponent: RoutePending,
26
+ defaultPendingMs: 150,
27
+ defaultPendingMinMs: 0,
28
+ // Serve both slash forms without 307 so Paraglide trailing-slash
29
+ // urlPatterns and hosts that append `/` stay same-locale.
30
+ trailingSlash: "preserve",
31
+ // Keep multi-value OAuth query keys (Better Auth `ba_param=…&ba_param=…`)
32
+ // as repeated keys. Default JSON-array stringify breaks signature
33
+ // verification on /sign-in and /oauth/consent mid-authorize.
34
+ parseSearch: defaultParseSearch,
35
+ stringifySearch,
36
+ // i18n URL routing: match de-localized paths; Links re-localize.
37
+ // Pairs with paraglideMiddleware in src/server.ts.
38
+ rewrite: {
39
+ input: ({ url }) => deLocalizeUrl(url),
40
+ output: ({ url }) => localizeUrl(url),
41
+ },
42
+ });
43
+
44
+ setupRouterSsrQueryIntegration({ router, queryClient: context.queryClient });
45
+
46
+ return router;
47
+ }
48
+
49
+ declare module "@tanstack/react-router" {
50
+ interface Register {
51
+ router: ReturnType<typeof getRouter>;
52
+ }
53
+ }
@@ -0,0 +1,18 @@
1
+ import { oauthProviderAuthServerMetadata } from "@better-auth/oauth-provider";
2
+ import { createFileRoute } from "@tanstack/react-router";
3
+ import { betterAuthMiddleware } from "@/middlewares/better-auth.ts";
4
+
5
+ // RFC 8414: for an issuer of `${origin}/api/auth`, the authorization server
6
+ // metadata lives at `${origin}/.well-known/oauth-authorization-server/api/auth`
7
+ // (well-known inserted at the root, issuer path appended) — NOT under /api/auth.
8
+ export const Route = createFileRoute(
9
+ "/.well-known/oauth-authorization-server/api/auth",
10
+ )({
11
+ server: {
12
+ middleware: [betterAuthMiddleware],
13
+ handlers: {
14
+ GET: async ({ request, context }) =>
15
+ oauthProviderAuthServerMetadata(context.auth)(request),
16
+ },
17
+ },
18
+ });
@@ -0,0 +1,32 @@
1
+ import { createFileRoute } from "@tanstack/react-router";
2
+ import { env } from "@/env";
3
+ import {
4
+ buildProtectedResourceMetadata,
5
+ issuerFromAuthUrl,
6
+ } from "@/lib/oauth-metadata";
7
+
8
+ // RFC 9728 Protected Resource Metadata. Advertises this app as a resource
9
+ // server and points clients at its authorization server (this same app's
10
+ // better-auth mount). Served at /.well-known/oauth-protected-resource.
11
+ //
12
+ // Does not import the auth factory — keeps this machine route free of
13
+ // cloudflare:workers / betterAuth graph.
14
+ export const Route = createFileRoute("/.well-known/oauth-protected-resource/")({
15
+ server: {
16
+ handlers: {
17
+ GET: async () => {
18
+ const metadata = buildProtectedResourceMetadata({
19
+ resource: env.APP_ORIGIN,
20
+ issuer: issuerFromAuthUrl(env.BETTER_AUTH_URL),
21
+ });
22
+ return new Response(JSON.stringify(metadata), {
23
+ headers: {
24
+ "Content-Type": "application/json",
25
+ "Cache-Control":
26
+ "public, max-age=15, stale-while-revalidate=15, stale-if-error=86400",
27
+ },
28
+ });
29
+ },
30
+ },
31
+ },
32
+ });