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.
- package/dist/chunk-Dt3mZKp0.mjs +24 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +40 -60
- package/dist/index.mjs +2 -2
- package/dist/{src-Dc2OdxbP.mjs → src-DBVnwTkj.mjs} +644 -609
- package/package.json +2 -2
- package/templates/addons/turborepo/turbo.json.hbs +8 -0
- package/templates/api/orpc/native/utils/orpc.ts.hbs +21 -20
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +3 -5
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +73 -67
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +15 -14
- package/templates/api/trpc/native/utils/trpc.ts.hbs +8 -7
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +59 -57
- package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +10 -9
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-server.ts.hbs +10 -9
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/lib/auth-client.ts.hbs +5 -4
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-server.ts.hbs +8 -7
- package/templates/auth/better-auth/native/base/lib/auth-client.ts.hbs +9 -8
- package/templates/auth/better-auth/server/base/src/index.ts.hbs +239 -235
- package/templates/auth/better-auth/web/nuxt/app/plugins/auth-client.ts.hbs +2 -3
- package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +9 -11
- package/templates/auth/better-auth/web/solid/src/lib/auth-client.ts.hbs +3 -2
- package/templates/backend/server/elysia/src/index.ts.hbs +71 -71
- package/templates/backend/server/express/src/index.ts.hbs +57 -57
- package/templates/backend/server/fastify/src/index.ts.hbs +107 -107
- package/templates/backend/server/hono/src/index.ts.hbs +75 -85
- package/templates/base/tsconfig.json.hbs +3 -0
- package/templates/db/drizzle/mysql/src/index.ts.hbs +23 -30
- package/templates/db/drizzle/postgres/src/index.ts.hbs +6 -13
- package/templates/db/drizzle/sqlite/src/index.ts.hbs +11 -18
- package/templates/db/mongoose/mongodb/src/index.ts.hbs +3 -2
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +16 -16
- package/templates/db/prisma/mysql/src/index.ts.hbs +16 -15
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/postgres/src/index.ts.hbs +10 -9
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/sqlite/src/index.ts.hbs +4 -7
- package/templates/examples/ai/native/bare/app/(drawer)/ai.tsx.hbs +2 -1
- package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +2 -1
- package/templates/examples/ai/native/uniwind/app/(drawer)/ai.tsx.hbs +2 -1
- package/templates/examples/ai/web/nuxt/app/pages/ai.vue.hbs +1 -3
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +4 -3
- package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx.hbs +2 -1
- package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx.hbs +4 -1
- package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx.hbs +4 -1
- package/templates/frontend/native/bare/app/_layout.tsx.hbs +4 -2
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +4 -2
- package/templates/frontend/native/uniwind/app/_layout.tsx.hbs +4 -3
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +6 -3
- package/templates/frontend/react/next/next.config.ts.hbs +9 -8
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +4 -1
- package/templates/frontend/react/next/tsconfig.json.hbs +2 -2
- package/templates/frontend/react/react-router/src/root.tsx.hbs +3 -4
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +3 -2
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +97 -93
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +23 -3
- package/templates/packages/config/tsconfig.base.json.hbs +1 -1
- package/templates/{deploy/alchemy → packages/env}/env.d.ts.hbs +6 -4
- package/templates/packages/env/package.json.hbs +7 -0
- package/templates/packages/env/src/native.ts.hbs +21 -0
- package/templates/packages/env/src/server.ts.hbs +38 -0
- package/templates/packages/env/src/web.ts.hbs +89 -0
- package/templates/packages/env/tsconfig.json.hbs +3 -0
- package/templates/{deploy/alchemy → packages/infra}/alchemy.run.ts.hbs +84 -80
- package/templates/packages/infra/package.json.hbs +10 -0
- 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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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((
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
8
|
+
baseURL: env.VITE_SERVER_URL,
|
|
8
9
|
{{#if (eq payments "polar")}}
|
|
9
|
-
|
|
10
|
+
plugins: [polarClient()]
|
|
10
11
|
{{/if}}
|
|
11
12
|
});
|