create-better-t-stack 3.11.1 → 3.12.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 (68) hide show
  1. package/dist/chunk-Dt3mZKp0.mjs +24 -0
  2. package/dist/cli.mjs +1 -1
  3. package/dist/index.d.mts +40 -60
  4. package/dist/index.mjs +2 -2
  5. package/dist/{src-Dc2OdxbP.mjs → src-DBVnwTkj.mjs} +644 -609
  6. package/package.json +2 -2
  7. package/templates/addons/turborepo/turbo.json.hbs +8 -0
  8. package/templates/api/orpc/native/utils/orpc.ts.hbs +21 -20
  9. package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +3 -5
  10. package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +73 -67
  11. package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +15 -14
  12. package/templates/api/trpc/native/utils/trpc.ts.hbs +8 -7
  13. package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +59 -57
  14. package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +10 -9
  15. package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-server.ts.hbs +10 -9
  16. package/templates/auth/better-auth/convex/web/react/tanstack-router/src/lib/auth-client.ts.hbs +5 -4
  17. package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-server.ts.hbs +8 -7
  18. package/templates/auth/better-auth/native/base/lib/auth-client.ts.hbs +9 -8
  19. package/templates/auth/better-auth/server/base/src/index.ts.hbs +239 -235
  20. package/templates/auth/better-auth/web/nuxt/app/plugins/auth-client.ts.hbs +2 -3
  21. package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +9 -11
  22. package/templates/auth/better-auth/web/solid/src/lib/auth-client.ts.hbs +3 -2
  23. package/templates/backend/server/elysia/src/index.ts.hbs +71 -71
  24. package/templates/backend/server/express/src/index.ts.hbs +57 -57
  25. package/templates/backend/server/fastify/src/index.ts.hbs +107 -107
  26. package/templates/backend/server/hono/src/index.ts.hbs +75 -85
  27. package/templates/base/tsconfig.json.hbs +3 -0
  28. package/templates/db/drizzle/mysql/src/index.ts.hbs +23 -30
  29. package/templates/db/drizzle/postgres/src/index.ts.hbs +6 -13
  30. package/templates/db/drizzle/sqlite/src/index.ts.hbs +11 -18
  31. package/templates/db/mongoose/mongodb/src/index.ts.hbs +3 -2
  32. package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +1 -1
  33. package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +1 -1
  34. package/templates/db/prisma/mysql/prisma.config.ts.hbs +16 -16
  35. package/templates/db/prisma/mysql/src/index.ts.hbs +16 -15
  36. package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +1 -1
  37. package/templates/db/prisma/postgres/src/index.ts.hbs +10 -9
  38. package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +1 -1
  39. package/templates/db/prisma/sqlite/src/index.ts.hbs +4 -7
  40. package/templates/examples/ai/native/bare/app/(drawer)/ai.tsx.hbs +2 -1
  41. package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +2 -1
  42. package/templates/examples/ai/native/uniwind/app/(drawer)/ai.tsx.hbs +2 -1
  43. package/templates/examples/ai/web/nuxt/app/pages/ai.vue.hbs +1 -3
  44. package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +4 -3
  45. package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx.hbs +2 -1
  46. package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx.hbs +4 -1
  47. package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx.hbs +4 -1
  48. package/templates/frontend/native/bare/app/_layout.tsx.hbs +4 -2
  49. package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +4 -2
  50. package/templates/frontend/native/uniwind/app/_layout.tsx.hbs +4 -3
  51. package/templates/frontend/nuxt/nuxt.config.ts.hbs +6 -3
  52. package/templates/frontend/react/next/next.config.ts.hbs +9 -8
  53. package/templates/frontend/react/next/src/components/providers.tsx.hbs +4 -1
  54. package/templates/frontend/react/next/tsconfig.json.hbs +2 -2
  55. package/templates/frontend/react/react-router/src/root.tsx.hbs +3 -4
  56. package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +3 -2
  57. package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +97 -93
  58. package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +23 -3
  59. package/templates/packages/config/tsconfig.base.json.hbs +1 -1
  60. package/templates/{deploy/alchemy → packages/env}/env.d.ts.hbs +6 -4
  61. package/templates/packages/env/package.json.hbs +7 -0
  62. package/templates/packages/env/src/native.ts.hbs +21 -0
  63. package/templates/packages/env/src/server.ts.hbs +38 -0
  64. package/templates/packages/env/src/web.ts.hbs +89 -0
  65. package/templates/packages/env/tsconfig.json.hbs +3 -0
  66. package/templates/{deploy/alchemy → packages/infra}/alchemy.run.ts.hbs +84 -80
  67. package/templates/packages/infra/package.json.hbs +10 -0
  68. package/templates/payments/polar/server/base/src/lib/payments.ts.hbs +3 -2
@@ -1,6 +1,7 @@
1
1
  {{#if (eq orm "prisma")}}
2
2
  import { betterAuth } from "better-auth";
3
3
  import { prismaAdapter } from "better-auth/adapters/prisma";
4
+ import { env } from "@{{projectName}}/env/server";
4
5
  {{#if (eq payments "polar")}}
5
6
  import { polar, checkout, portal } from "@polar-sh/better-auth";
6
7
  import { polarClient } from "./lib/payments";
@@ -8,52 +9,52 @@ import { polarClient } from "./lib/payments";
8
9
  import prisma from "@{{projectName}}/db";
9
10
 
10
11
  export const auth = betterAuth({
11
- database: prismaAdapter(prisma, {
12
- {{#if (eq database "postgres")}}provider: "postgresql",{{/if}}
13
- {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
14
- {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
15
- {{#if (eq database "mongodb")}}provider: "mongodb",{{/if}}
16
- }),
17
- trustedOrigins: [
18
- process.env.CORS_ORIGIN || "",
19
- {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
20
- "mybettertapp://", "exp://"
21
- {{/if}}
22
- ],
23
- emailAndPassword: {
24
- enabled: true,
25
- },
26
- {{#if (ne backend "self")}}
27
- advanced: {
28
- defaultCookieAttributes: {
29
- sameSite: "none",
30
- secure: true,
31
- httpOnly: true,
32
- },
33
- },
34
- {{/if}}
35
- {{#if (eq payments "polar")}}
36
- plugins: [
37
- polar({
38
- client: polarClient,
39
- createCustomerOnSignUp: true,
40
- enableCustomerPortal: true,
41
- use: [
42
- checkout({
43
- products: [
44
- {
45
- productId: "your-product-id",
46
- slug: "pro",
47
- },
48
- ],
49
- successUrl: process.env.POLAR_SUCCESS_URL,
50
- authenticatedUsersOnly: true,
51
- }),
52
- portal(),
53
- ],
54
- }),
55
- ],
56
- {{/if}}
12
+ database: prismaAdapter(prisma, {
13
+ {{#if (eq database "postgres")}}provider: "postgresql",{{/if}}
14
+ {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
15
+ {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
16
+ {{#if (eq database "mongodb")}}provider: "mongodb",{{/if}}
17
+ }),
18
+ trustedOrigins: [
19
+ env.CORS_ORIGIN,
20
+ {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
21
+ "mybettertapp://", "exp://"
22
+ {{/if}}
23
+ ],
24
+ emailAndPassword: {
25
+ enabled: true,
26
+ },
27
+ {{#if (ne backend "self")}}
28
+ advanced: {
29
+ defaultCookieAttributes: {
30
+ sameSite: "none",
31
+ secure: true,
32
+ httpOnly: true,
33
+ },
34
+ },
35
+ {{/if}}
36
+ {{#if (eq payments "polar")}}
37
+ plugins: [
38
+ polar({
39
+ client: polarClient,
40
+ createCustomerOnSignUp: true,
41
+ enableCustomerPortal: true,
42
+ use: [
43
+ checkout({
44
+ products: [
45
+ {
46
+ productId: "your-product-id",
47
+ slug: "pro",
48
+ },
49
+ ],
50
+ successUrl: env.POLAR_SUCCESS_URL,
51
+ authenticatedUsersOnly: true,
52
+ }),
53
+ portal(),
54
+ ],
55
+ }),
56
+ ],
57
+ {{/if}}
57
58
  });
58
59
  {{/if}}
59
60
 
@@ -61,6 +62,7 @@ export const auth = betterAuth({
61
62
  {{#if (or (eq runtime "bun") (eq runtime "node") (eq runtime "none"))}}
62
63
  import { betterAuth } from "better-auth";
63
64
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
65
+ import { env } from "@{{projectName}}/env/server";
64
66
  {{#if (eq payments "polar")}}
65
67
  import { polar, checkout, portal } from "@polar-sh/better-auth";
66
68
  import { polarClient } from "./lib/payments";
@@ -69,133 +71,134 @@ import { db } from "@{{projectName}}/db";
69
71
  import * as schema from "@{{projectName}}/db/schema/auth";
70
72
 
71
73
  export const auth = betterAuth({
72
- database: drizzleAdapter(db, {
73
- {{#if (eq database "postgres")}}provider: "pg",{{/if}}
74
- {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
75
- {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
76
- schema: schema,
77
- }),
78
- trustedOrigins: [
79
- process.env.CORS_ORIGIN || "",
80
- {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
81
- "mybettertapp://", "exp://"
82
- {{/if}}
83
- ],
84
- emailAndPassword: {
85
- enabled: true,
86
- },
87
- {{#if (ne backend "self")}}
88
- advanced: {
89
- defaultCookieAttributes: {
90
- sameSite: "none",
91
- secure: true,
92
- httpOnly: true,
93
- },
94
- },
95
- {{/if}}
96
- {{#if (eq payments "polar")}}
97
- plugins: [
98
- polar({
99
- client: polarClient,
100
- createCustomerOnSignUp: true,
101
- enableCustomerPortal: true,
102
- use: [
103
- checkout({
104
- products: [
105
- {
106
- productId: "your-product-id",
107
- slug: "pro",
108
- },
109
- ],
110
- successUrl: process.env.POLAR_SUCCESS_URL,
111
- authenticatedUsersOnly: true,
112
- }),
113
- portal(),
114
- ],
115
- }),
116
- ],
117
- {{/if}}
74
+ database: drizzleAdapter(db, {
75
+ {{#if (eq database "postgres")}}provider: "pg",{{/if}}
76
+ {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
77
+ {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
78
+ schema: schema,
79
+ }),
80
+ trustedOrigins: [
81
+ env.CORS_ORIGIN,
82
+ {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
83
+ "mybettertapp://", "exp://"
84
+ {{/if}}
85
+ ],
86
+ emailAndPassword: {
87
+ enabled: true,
88
+ },
89
+ {{#if (ne backend "self")}}
90
+ advanced: {
91
+ defaultCookieAttributes: {
92
+ sameSite: "none",
93
+ secure: true,
94
+ httpOnly: true,
95
+ },
96
+ },
97
+ {{/if}}
98
+ {{#if (eq payments "polar")}}
99
+ plugins: [
100
+ polar({
101
+ client: polarClient,
102
+ createCustomerOnSignUp: true,
103
+ enableCustomerPortal: true,
104
+ use: [
105
+ checkout({
106
+ products: [
107
+ {
108
+ productId: "your-product-id",
109
+ slug: "pro",
110
+ },
111
+ ],
112
+ successUrl: env.POLAR_SUCCESS_URL,
113
+ authenticatedUsersOnly: true,
114
+ }),
115
+ portal(),
116
+ ],
117
+ }),
118
+ ],
119
+ {{/if}}
118
120
  });
119
121
  {{/if}}
120
122
 
121
123
  {{#if (eq runtime "workers")}}
122
124
  import { betterAuth } from "better-auth";
123
125
  import { drizzleAdapter } from "better-auth/adapters/drizzle";
126
+ import { env } from "@{{projectName}}/env/server";
124
127
  {{#if (eq payments "polar")}}
125
128
  import { polar, checkout, portal } from "@polar-sh/better-auth";
126
129
  import { polarClient } from "./lib/payments";
127
130
  {{/if}}
128
131
  import { db } from "@{{projectName}}/db";
129
132
  import * as schema from "@{{projectName}}/db/schema/auth";
130
- import { env } from "cloudflare:workers";
131
133
 
132
134
  export const auth = betterAuth({
133
- database: drizzleAdapter(db, {
134
- {{#if (eq database "postgres")}}provider: "pg",{{/if}}
135
- {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
136
- {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
137
- schema: schema,
138
- }),
139
- trustedOrigins: [
140
- env.CORS_ORIGIN,
141
- {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
142
- "mybettertapp://", "exp://"
143
- {{/if}}
144
- ],
145
- emailAndPassword: {
146
- enabled: true,
147
- },
148
- // uncomment cookieCache setting when ready to deploy to Cloudflare using *.workers.dev domains
149
- // session: {
150
- // cookieCache: {
151
- // enabled: true,
152
- // maxAge: 60,
153
- // },
154
- // },
155
- secret: env.BETTER_AUTH_SECRET,
156
- baseURL: env.BETTER_AUTH_URL,
157
- advanced: {
158
- defaultCookieAttributes: {
159
- sameSite: "none",
160
- secure: true,
161
- httpOnly: true,
162
- },
163
- // uncomment crossSubDomainCookies setting when ready to deploy and replace <your-workers-subdomain> with your actual workers subdomain
164
- // https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
165
- // crossSubDomainCookies: {
166
- // enabled: true,
167
- // domain: "<your-workers-subdomain>",
168
- // },
169
- },
170
- {{#if (eq payments "polar")}}
171
- plugins: [
172
- polar({
173
- client: polarClient,
174
- createCustomerOnSignUp: true,
175
- enableCustomerPortal: true,
176
- use: [
177
- checkout({
178
- products: [
179
- {
180
- productId: "your-product-id",
181
- slug: "pro",
182
- },
183
- ],
184
- successUrl: env.POLAR_SUCCESS_URL,
185
- authenticatedUsersOnly: true,
186
- }),
187
- portal(),
188
- ],
189
- }),
190
- ],
191
- {{/if}}
135
+ database: drizzleAdapter(db, {
136
+ {{#if (eq database "postgres")}}provider: "pg",{{/if}}
137
+ {{#if (eq database "sqlite")}}provider: "sqlite",{{/if}}
138
+ {{#if (eq database "mysql")}}provider: "mysql",{{/if}}
139
+ schema: schema,
140
+ }),
141
+ trustedOrigins: [
142
+ env.CORS_ORIGIN,
143
+ {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
144
+ "mybettertapp://", "exp://"
145
+ {{/if}}
146
+ ],
147
+ emailAndPassword: {
148
+ enabled: true,
149
+ },
150
+ // uncomment cookieCache setting when ready to deploy to Cloudflare using *.workers.dev domains
151
+ // session: {
152
+ // cookieCache: {
153
+ // enabled: true,
154
+ // maxAge: 60,
155
+ // },
156
+ // },
157
+ secret: env.BETTER_AUTH_SECRET,
158
+ baseURL: env.BETTER_AUTH_URL,
159
+ advanced: {
160
+ defaultCookieAttributes: {
161
+ sameSite: "none",
162
+ secure: true,
163
+ httpOnly: true,
164
+ },
165
+ // uncomment crossSubDomainCookies setting when ready to deploy and replace <your-workers-subdomain> with your actual workers subdomain
166
+ // https://developers.cloudflare.com/workers/wrangler/configuration/#workersdev
167
+ // crossSubDomainCookies: {
168
+ // enabled: true,
169
+ // domain: "<your-workers-subdomain>",
170
+ // },
171
+ },
172
+ {{#if (eq payments "polar")}}
173
+ plugins: [
174
+ polar({
175
+ client: polarClient,
176
+ createCustomerOnSignUp: true,
177
+ enableCustomerPortal: true,
178
+ use: [
179
+ checkout({
180
+ products: [
181
+ {
182
+ productId: "your-product-id",
183
+ slug: "pro",
184
+ },
185
+ ],
186
+ successUrl: env.POLAR_SUCCESS_URL,
187
+ authenticatedUsersOnly: true,
188
+ }),
189
+ portal(),
190
+ ],
191
+ }),
192
+ ],
193
+ {{/if}}
192
194
  });
193
- {{/if}}
195
+ {{/if}}
194
196
  {{/if}}
195
197
 
196
198
  {{#if (eq orm "mongoose")}}
197
199
  import { betterAuth } from "better-auth";
198
200
  import { mongodbAdapter } from "better-auth/adapters/mongodb";
201
+ import { env } from "@{{projectName}}/env/server";
199
202
  {{#if (eq payments "polar")}}
200
203
  import { polar, checkout, portal } from "@polar-sh/better-auth";
201
204
  import { polarClient } from "./lib/payments";
@@ -203,98 +206,99 @@ import { polarClient } from "./lib/payments";
203
206
  import { client } from "@{{projectName}}/db";
204
207
 
205
208
  export const auth = betterAuth({
206
- database: mongodbAdapter(client),
207
- trustedOrigins: [
208
- process.env.CORS_ORIGIN || "",
209
- {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
210
- "mybettertapp://", "exp://"
211
- {{/if}}
212
- ],
213
- emailAndPassword: {
214
- enabled: true,
215
- },
216
- {{#if (ne backend "self")}}
217
- advanced: {
218
- defaultCookieAttributes: {
219
- sameSite: "none",
220
- secure: true,
221
- httpOnly: true,
222
- },
223
- },
224
- {{/if}}
225
- {{#if (eq payments "polar")}}
226
- plugins: [
227
- polar({
228
- client: polarClient,
229
- createCustomerOnSignUp: true,
230
- enableCustomerPortal: true,
231
- use: [
232
- checkout({
233
- products: [
234
- {
235
- productId: "your-product-id",
236
- slug: "pro",
237
- },
238
- ],
239
- successUrl: process.env.POLAR_SUCCESS_URL,
240
- authenticatedUsersOnly: true,
241
- }),
242
- portal(),
243
- ],
244
- }),
245
- ],
246
- {{/if}}
209
+ database: mongodbAdapter(client),
210
+ trustedOrigins: [
211
+ env.CORS_ORIGIN,
212
+ {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
213
+ "mybettertapp://", "exp://"
214
+ {{/if}}
215
+ ],
216
+ emailAndPassword: {
217
+ enabled: true,
218
+ },
219
+ {{#if (ne backend "self")}}
220
+ advanced: {
221
+ defaultCookieAttributes: {
222
+ sameSite: "none",
223
+ secure: true,
224
+ httpOnly: true,
225
+ },
226
+ },
227
+ {{/if}}
228
+ {{#if (eq payments "polar")}}
229
+ plugins: [
230
+ polar({
231
+ client: polarClient,
232
+ createCustomerOnSignUp: true,
233
+ enableCustomerPortal: true,
234
+ use: [
235
+ checkout({
236
+ products: [
237
+ {
238
+ productId: "your-product-id",
239
+ slug: "pro",
240
+ },
241
+ ],
242
+ successUrl: env.POLAR_SUCCESS_URL,
243
+ authenticatedUsersOnly: true,
244
+ }),
245
+ portal(),
246
+ ],
247
+ }),
248
+ ],
249
+ {{/if}}
247
250
  });
248
251
  {{/if}}
249
252
 
250
253
  {{#if (eq orm "none")}}
251
254
  import { betterAuth } from "better-auth";
255
+ import { env } from "@{{projectName}}/env/server";
252
256
  {{#if (eq payments "polar")}}
253
257
  import { polar, checkout, portal } from "@polar-sh/better-auth";
254
258
  import { polarClient } from "./lib/payments";
255
259
  {{/if}}
256
260
 
257
261
  export const auth = betterAuth({
258
- database: "", // Invalid configuration
259
- trustedOrigins: [
260
- process.env.CORS_ORIGIN || "",
261
- {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
262
- "mybettertapp://", "exp://"
263
- {{/if}}
264
- ],
265
- emailAndPassword: {
266
- enabled: true,
267
- },
268
- {{#if (ne backend "self")}}
269
- advanced: {
270
- defaultCookieAttributes: {
271
- sameSite: "none",
272
- secure: true,
273
- httpOnly: true,
274
- },
275
- },
276
- {{/if}}
277
- {{#if (eq payments "polar")}}
278
- plugins: [
279
- polar({
280
- client: polarClient,
281
- createCustomerOnSignUp: true,
282
- enableCustomerPortal: true,
283
- use: [
284
- checkout({
285
- products: [
286
- {
287
- productId: "your-product-id",
288
- slug: "pro",
289
- },
290
- ],
291
- successUrl: process.env.POLAR_SUCCESS_URL,
292
- authenticatedUsersOnly: true,
293
- }),
294
- portal(),
295
- ],
296
- }),
297
- ],
298
- {{/if}}
262
+ database: "", // Invalid configuration
263
+ trustedOrigins: [
264
+ env.CORS_ORIGIN,
265
+ {{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
266
+ "mybettertapp://", "exp://"
267
+ {{/if}}
268
+ ],
269
+ emailAndPassword: {
270
+ enabled: true,
271
+ },
272
+ {{#if (ne backend "self")}}
273
+ advanced: {
274
+ defaultCookieAttributes: {
275
+ sameSite: "none",
276
+ secure: true,
277
+ httpOnly: true,
278
+ },
279
+ },
280
+ {{/if}}
281
+ {{#if (eq payments "polar")}}
282
+ plugins: [
283
+ polar({
284
+ client: polarClient,
285
+ createCustomerOnSignUp: true,
286
+ enableCustomerPortal: true,
287
+ use: [
288
+ checkout({
289
+ products: [
290
+ {
291
+ productId: "your-product-id",
292
+ slug: "pro",
293
+ },
294
+ ],
295
+ successUrl: env.POLAR_SUCCESS_URL,
296
+ authenticatedUsersOnly: true,
297
+ }),
298
+ portal(),
299
+ ],
300
+ }),
301
+ ],
302
+ {{/if}}
299
303
  });
300
304
  {{/if}}
@@ -3,12 +3,11 @@ import { createAuthClient } from "better-auth/vue";
3
3
  import { polarClient } from "@polar-sh/better-auth";
4
4
  {{/if}}
5
5
 
6
- export default defineNuxtPlugin((nuxtApp) => {
6
+ export default defineNuxtPlugin(() => {
7
7
  const config = useRuntimeConfig();
8
- const serverUrl = config.public.serverURL;
9
8
 
10
9
  const authClient = createAuthClient({
11
- baseURL: serverUrl,
10
+ baseURL: config.public.serverUrl,
12
11
  {{#if (eq payments "polar")}}
13
12
  plugins: [polarClient()],
14
13
  {{/if}}
@@ -2,17 +2,15 @@ import { createAuthClient } from "better-auth/react";
2
2
  {{#if (eq payments "polar")}}
3
3
  import { polarClient } from "@polar-sh/better-auth";
4
4
  {{/if}}
5
+ {{#unless (eq backend "self")}}
6
+ import { env } from "@{{projectName}}/env/web";
7
+ {{/unless}}
5
8
 
6
9
  export const authClient = createAuthClient({
7
- {{#unless (eq backend "self")}}
8
- baseURL:
9
- {{#if (includes frontend "next")}}
10
- process.env.NEXT_PUBLIC_SERVER_URL,
11
- {{else}}
12
- import.meta.env.VITE_SERVER_URL,
13
- {{/if}}
14
- {{/unless}}
15
- {{#if (eq payments "polar")}}
16
- plugins: [polarClient()]
17
- {{/if}}
10
+ {{#unless (eq backend "self")}}
11
+ baseURL: env.{{#if (includes frontend "next")}}NEXT_PUBLIC_SERVER_URL{{else}}VITE_SERVER_URL{{/if}},
12
+ {{/unless}}
13
+ {{#if (eq payments "polar")}}
14
+ plugins: [polarClient()]
15
+ {{/if}}
18
16
  });
@@ -2,10 +2,11 @@ import { createAuthClient } from "better-auth/solid";
2
2
  {{#if (eq payments "polar")}}
3
3
  import { polarClient } from "@polar-sh/better-auth";
4
4
  {{/if}}
5
+ import { env } from "@{{projectName}}/env/web";
5
6
 
6
7
  export const authClient = createAuthClient({
7
- baseURL: import.meta.env.VITE_SERVER_URL,
8
+ baseURL: env.VITE_SERVER_URL,
8
9
  {{#if (eq payments "polar")}}
9
- plugins: [polarClient()]
10
+ plugins: [polarClient()]
10
11
  {{/if}}
11
12
  });