create-better-t-stack 3.4.2 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +1 -1
- package/dist/{src-BmqgKPgS.js → src-C46pe-uS.js} +92 -436
- package/package.json +1 -1
- package/templates/api/orpc/server/package.json.hbs +1 -5
- package/templates/api/orpc/server/tsconfig.json.hbs +1 -4
- package/templates/api/trpc/server/package.json.hbs +1 -5
- package/templates/api/trpc/server/tsconfig.json.hbs +1 -4
- package/templates/auth/better-auth/server/base/package.json.hbs +1 -5
- package/templates/auth/better-auth/server/base/tsconfig.json.hbs +1 -4
- package/templates/db/base/package.json.hbs +1 -5
- package/templates/db/base/tsconfig.json.hbs +1 -4
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +0 -7
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +1 -1
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +8 -12
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +17 -14
- package/templates/db/prisma/mysql/src/index.ts.hbs +46 -4
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +1 -5
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +9 -6
- package/templates/db/prisma/postgres/src/index.ts.hbs +46 -1
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +1 -12
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +16 -9
- package/templates/db/prisma/sqlite/src/index.ts.hbs +15 -15
- package/templates/deploy/alchemy/alchemy.run.ts.hbs +67 -5
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +2 -2
- package/templates/extras/_npmrc.hbs +2 -2
- package/templates/frontend/native/uniwind/app/(drawer)/_layout.tsx.hbs +21 -13
- package/templates/frontend/react/next/next.config.ts.hbs +5 -2
- package/templates/frontend/react/next/tsconfig.json.hbs +0 -3
- package/templates/packages/config/tsconfig.base.json.hbs +1 -1
- package/templates/api/orpc/server/tsdown.config.ts.hbs +0 -7
- package/templates/api/trpc/server/tsdown.config.ts.hbs +0 -7
- package/templates/auth/better-auth/server/base/tsdown.config.ts.hbs +0 -7
- package/templates/db/base/tsdown.config.ts.hbs +0 -7
- package/templates/deploy/wrangler/server/wrangler.jsonc.hbs +0 -39
- package/templates/deploy/wrangler/web/nuxt/wrangler.jsonc.hbs +0 -51
- package/templates/deploy/wrangler/web/react/next/open-next.config.ts +0 -6
- package/templates/deploy/wrangler/web/react/next/wrangler.jsonc.hbs +0 -22
- package/templates/deploy/wrangler/web/react/react-router/wrangler.jsonc.hbs +0 -8
- package/templates/deploy/wrangler/web/react/tanstack-router/wrangler.jsonc.hbs +0 -8
- package/templates/deploy/wrangler/web/react/tanstack-start/wrangler.jsonc.hbs +0 -20
- package/templates/deploy/wrangler/web/solid/wrangler.jsonc.hbs +0 -8
- package/templates/deploy/wrangler/web/svelte/wrangler.jsonc.hbs +0 -51
package/package.json
CHANGED
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/api",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/api",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -2,18 +2,14 @@
|
|
|
2
2
|
"name": "@{{projectName}}/auth",
|
|
3
3
|
"exports": {
|
|
4
4
|
".": {
|
|
5
|
-
"types": "./dist/index.d.ts",
|
|
6
5
|
"default": "./src/index.ts"
|
|
7
6
|
},
|
|
8
7
|
"./*": {
|
|
9
|
-
"types": "./dist/*.d.ts",
|
|
10
8
|
"default": "./src/*.ts"
|
|
11
9
|
}
|
|
12
10
|
},
|
|
13
11
|
"type": "module",
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -3,17 +3,13 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
|
-
"types": "./dist/index.d.ts",
|
|
7
6
|
"default": "./src/index.ts"
|
|
8
7
|
},
|
|
9
8
|
"./*": {
|
|
10
|
-
"types": "./dist/*.d.ts",
|
|
11
9
|
"default": "./src/*.ts"
|
|
12
10
|
}
|
|
13
11
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsdown"
|
|
16
|
-
},
|
|
12
|
+
"scripts": {},
|
|
17
13
|
"devDependencies": {},
|
|
18
14
|
"peerDependencies": {
|
|
19
15
|
"typescript": "^5"
|
|
@@ -16,13 +16,6 @@ export default defineConfig({
|
|
|
16
16
|
// DOCS: https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
|
|
17
17
|
dialect: "sqlite",
|
|
18
18
|
driver: "d1-http",
|
|
19
|
-
{{#if (eq serverDeploy "wrangler")}}
|
|
20
|
-
dbCredentials: {
|
|
21
|
-
accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
|
|
22
|
-
databaseId: process.env.CLOUDFLARE_DATABASE_ID!,
|
|
23
|
-
token: process.env.CLOUDFLARE_D1_TOKEN!,
|
|
24
|
-
},
|
|
25
|
-
{{/if}}
|
|
26
19
|
{{else}}
|
|
27
20
|
dialect: "turso",
|
|
28
21
|
dbCredentials: {
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
generator client {
|
|
2
|
-
provider
|
|
3
|
-
output
|
|
4
|
-
moduleFormat
|
|
2
|
+
provider = "prisma-client"
|
|
3
|
+
output = "../generated"
|
|
4
|
+
moduleFormat = "esm"
|
|
5
5
|
{{#if (eq runtime "bun")}}
|
|
6
|
-
runtime
|
|
6
|
+
runtime = "bun"
|
|
7
7
|
{{/if}}
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
|
-
runtime
|
|
9
|
+
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
12
|
-
runtime
|
|
13
|
-
{{/if}}
|
|
14
|
-
{{#if (eq dbSetup "planetscale")}}
|
|
15
|
-
previewFeatures = ["driverAdapters"]
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
|
+
runtime = "workerd"
|
|
16
13
|
{{/if}}
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
datasource db {
|
|
20
17
|
provider = "mysql"
|
|
21
|
-
url = env("DATABASE_URL")
|
|
22
18
|
{{#if (eq dbSetup "planetscale")}}
|
|
23
19
|
relationMode = "prisma"
|
|
24
20
|
{{/if}}
|
|
25
|
-
}
|
|
21
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
3
|
-
import dotenv from
|
|
2
|
+
import { defineConfig, env } from 'prisma/config'
|
|
3
|
+
import dotenv from 'dotenv'
|
|
4
4
|
|
|
5
5
|
dotenv.config({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})
|
|
6
|
+
{{#if (eq backend "self")}}
|
|
7
|
+
path: "../../apps/web/.env",
|
|
8
|
+
{{else}}
|
|
9
|
+
path: "../../apps/server/.env",
|
|
10
|
+
{{/if}}
|
|
11
|
+
})
|
|
12
12
|
|
|
13
|
-
export default {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
schema: path.join("prisma", "schema"),
|
|
15
|
+
migrations: {
|
|
16
|
+
path: path.join("prisma", "migrations"),
|
|
17
|
+
},
|
|
18
|
+
datasource: {
|
|
19
|
+
url: env('DATABASE_URL'),
|
|
20
|
+
},
|
|
21
|
+
})
|
|
@@ -1,12 +1,54 @@
|
|
|
1
|
+
{{#if (eq runtime "workers")}}
|
|
1
2
|
import { PrismaClient } from "../prisma/generated/client";
|
|
3
|
+
import { env } from "cloudflare:workers";
|
|
4
|
+
|
|
2
5
|
{{#if (eq dbSetup "planetscale")}}
|
|
3
|
-
import { PrismaPlanetScale } from
|
|
6
|
+
import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
|
|
7
|
+
|
|
8
|
+
const adapter = new PrismaPlanetScale({ url: env.DATABASE_URL || "" });
|
|
9
|
+
const prisma = new PrismaClient({ adapter });
|
|
10
|
+
{{else}}
|
|
11
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
4
12
|
|
|
5
|
-
const
|
|
13
|
+
const databaseUrl: string = env.DATABASE_URL || "";
|
|
14
|
+
const url: URL = new URL(databaseUrl);
|
|
15
|
+
const connectionConfig = {
|
|
16
|
+
host: url.hostname,
|
|
17
|
+
port: parseInt(url.port || "3306"),
|
|
18
|
+
user: url.username,
|
|
19
|
+
password: url.password,
|
|
20
|
+
database: url.pathname.slice(1),
|
|
21
|
+
};
|
|
6
22
|
|
|
7
|
-
const
|
|
23
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
24
|
+
const prisma = new PrismaClient({ adapter });
|
|
25
|
+
{{/if}}
|
|
26
|
+
|
|
27
|
+
export default prisma;
|
|
8
28
|
{{else}}
|
|
9
|
-
|
|
29
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
30
|
+
|
|
31
|
+
{{#if (eq dbSetup "planetscale")}}
|
|
32
|
+
import { PrismaPlanetScale } from "@prisma/adapter-planetscale";
|
|
33
|
+
|
|
34
|
+
const adapter = new PrismaPlanetScale({ url: process.env.DATABASE_URL || "" });
|
|
35
|
+
const prisma = new PrismaClient({ adapter });
|
|
36
|
+
{{else}}
|
|
37
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
38
|
+
|
|
39
|
+
const databaseUrl: string = process.env.DATABASE_URL || "";
|
|
40
|
+
const url: URL = new URL(databaseUrl);
|
|
41
|
+
const connectionConfig = {
|
|
42
|
+
host: url.hostname,
|
|
43
|
+
port: parseInt(url.port || "3306"),
|
|
44
|
+
user: url.username,
|
|
45
|
+
password: url.password,
|
|
46
|
+
database: url.pathname.slice(1),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const adapter = new PrismaMariaDb(connectionConfig);
|
|
50
|
+
const prisma = new PrismaClient({ adapter });
|
|
10
51
|
{{/if}}
|
|
11
52
|
|
|
12
53
|
export default prisma;
|
|
54
|
+
{{/if}}
|
|
@@ -8,17 +8,13 @@ generator client {
|
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
9
|
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
12
|
runtime = "workerd"
|
|
13
13
|
{{/if}}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
datasource db {
|
|
17
17
|
provider = "postgresql"
|
|
18
|
-
url = env("DATABASE_URL")
|
|
19
|
-
{{#if (eq dbSetup "supabase")}}
|
|
20
|
-
directUrl = env("DIRECT_URL")
|
|
21
|
-
{{/if}}
|
|
22
18
|
{{#if (eq dbSetup "planetscale")}}
|
|
23
19
|
relationMode = "prisma"
|
|
24
20
|
{{/if}}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import { defineConfig, env } from 'prisma/config'
|
|
3
3
|
{{#unless (eq dbSetup "prisma-postgres")}}
|
|
4
|
-
import dotenv from
|
|
4
|
+
import dotenv from 'dotenv'
|
|
5
5
|
|
|
6
6
|
dotenv.config({
|
|
7
7
|
{{#if (eq backend "self")}}
|
|
@@ -9,12 +9,15 @@ dotenv.config({
|
|
|
9
9
|
{{else}}
|
|
10
10
|
path: "../../apps/server/.env",
|
|
11
11
|
{{/if}}
|
|
12
|
-
})
|
|
12
|
+
})
|
|
13
13
|
{{/unless}}
|
|
14
14
|
|
|
15
|
-
export default {
|
|
15
|
+
export default defineConfig({
|
|
16
16
|
schema: path.join("prisma", "schema"),
|
|
17
17
|
migrations: {
|
|
18
18
|
path: path.join("prisma", "migrations"),
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
},
|
|
20
|
+
datasource: {
|
|
21
|
+
url: env('DATABASE_URL'),
|
|
22
|
+
},
|
|
23
|
+
})
|
|
@@ -1,5 +1,50 @@
|
|
|
1
|
+
{{#if (eq runtime "workers")}}
|
|
1
2
|
import { PrismaClient } from "../prisma/generated/client";
|
|
3
|
+
import { env } from "cloudflare:workers";
|
|
4
|
+
{{#if (eq dbSetup "neon")}}
|
|
5
|
+
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
6
|
+
import { neonConfig } from "@neondatabase/serverless";
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
neonConfig.poolQueryViaFetch = true;
|
|
9
|
+
|
|
10
|
+
const prisma = new PrismaClient({
|
|
11
|
+
adapter: new PrismaNeon({
|
|
12
|
+
connectionString: env.DATABASE_URL || "",
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
{{else}}
|
|
17
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
18
|
+
|
|
19
|
+
const adapter = new PrismaPg({ connectionString: env.DATABASE_URL || "" });
|
|
20
|
+
const prisma = new PrismaClient({ adapter });
|
|
21
|
+
|
|
22
|
+
{{/if}}
|
|
23
|
+
|
|
24
|
+
export default prisma;
|
|
25
|
+
{{else}}
|
|
26
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
27
|
+
{{#if (eq dbSetup "neon")}}
|
|
28
|
+
import { PrismaNeon } from "@prisma/adapter-neon";
|
|
29
|
+
import { neonConfig } from "@neondatabase/serverless";
|
|
30
|
+
import ws from "ws";
|
|
31
|
+
|
|
32
|
+
neonConfig.webSocketConstructor = ws;
|
|
33
|
+
neonConfig.poolQueryViaFetch = true;
|
|
34
|
+
|
|
35
|
+
const adapter = new PrismaNeon({
|
|
36
|
+
connectionString: process.env.DATABASE_URL || "",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const prisma = new PrismaClient({ adapter });
|
|
40
|
+
|
|
41
|
+
{{else}}
|
|
42
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
43
|
+
|
|
44
|
+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL || "" });
|
|
45
|
+
const prisma = new PrismaClient({ adapter });
|
|
46
|
+
|
|
47
|
+
{{/if}}
|
|
4
48
|
|
|
5
49
|
export default prisma;
|
|
50
|
+
{{/if}}
|
|
@@ -8,22 +8,11 @@ generator client {
|
|
|
8
8
|
{{#if (eq runtime "node")}}
|
|
9
9
|
runtime = "nodejs"
|
|
10
10
|
{{/if}}
|
|
11
|
-
{{#if (eq runtime "workers")}}
|
|
11
|
+
{{#if (or (eq runtime "workers") (and (eq backend "self") (eq webDeploy "alchemy")))}}
|
|
12
12
|
runtime = "workerd"
|
|
13
|
-
{{#if (eq dbSetup "d1")}}
|
|
14
|
-
previewFeatures = ["driverAdapters"]
|
|
15
|
-
{{/if}}
|
|
16
|
-
{{/if}}
|
|
17
|
-
{{#if (eq dbSetup "turso")}}
|
|
18
|
-
previewFeatures = ["driverAdapters"]
|
|
19
13
|
{{/if}}
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
datasource db {
|
|
23
17
|
provider = "sqlite"
|
|
24
|
-
{{#if (eq dbSetup "turso")}}
|
|
25
|
-
url = "file:./local.db"
|
|
26
|
-
{{else}}
|
|
27
|
-
url = env("DATABASE_URL")
|
|
28
|
-
{{/if}}
|
|
29
18
|
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
2
|
+
import { defineConfig, env } from "prisma/config";
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
4
|
|
|
5
5
|
dotenv.config({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
{{#if (eq backend "self")}}
|
|
7
|
+
path: "../../apps/web/.env",
|
|
8
|
+
{{else}}
|
|
9
|
+
path: "../../apps/server/.env",
|
|
10
|
+
{{/if}}
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
export default {
|
|
13
|
+
export default defineConfig({
|
|
14
14
|
schema: path.join("prisma", "schema"),
|
|
15
15
|
migrations: {
|
|
16
16
|
path: path.join("prisma", "migrations"),
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
},
|
|
18
|
+
datasource: {
|
|
19
|
+
{{#if (eq dbSetup "turso")}}
|
|
20
|
+
url: "file:./dev.db",
|
|
21
|
+
{{else}}
|
|
22
|
+
url: env("DATABASE_URL"),
|
|
23
|
+
{{/if}}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
+
import { PrismaClient } from "../prisma/generated/client";
|
|
2
|
+
|
|
1
3
|
{{#if (eq dbSetup "d1")}}
|
|
2
|
-
import { env } from "cloudflare:workers";
|
|
3
4
|
import { PrismaD1 } from "@prisma/adapter-d1";
|
|
4
|
-
import {
|
|
5
|
+
import { env } from "cloudflare:workers";
|
|
5
6
|
|
|
6
7
|
const adapter = new PrismaD1(env.DB);
|
|
7
8
|
const prisma = new PrismaClient({ adapter });
|
|
8
9
|
|
|
9
10
|
export default prisma;
|
|
10
|
-
{{else
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
{{else}}
|
|
12
|
+
import { PrismaLibSql } from "@prisma/adapter-libsql";
|
|
13
|
+
{{#if (eq runtime "workers")}}
|
|
14
|
+
import { env } from "cloudflare:workers";
|
|
15
|
+
{{/if}}
|
|
13
16
|
|
|
14
|
-
const adapter = new
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const adapter = new PrismaLibSql({
|
|
18
|
+
url: {{#if (eq runtime "workers")}}env.DATABASE_URL || ""{{else}}process.env.DATABASE_URL || ""{{/if}},
|
|
19
|
+
{{#if (eq dbSetup "turso")}}
|
|
20
|
+
authToken: {{#if (eq runtime "workers")}}env.DATABASE_AUTH_TOKEN || ""{{else}}process.env.DATABASE_AUTH_TOKEN ||
|
|
21
|
+
""{{/if}},
|
|
22
|
+
{{/if}}
|
|
17
23
|
});
|
|
18
24
|
|
|
19
25
|
const prisma = new PrismaClient({ adapter });
|
|
20
26
|
|
|
21
27
|
export default prisma;
|
|
22
|
-
{{
|
|
23
|
-
import { PrismaClient } from "../prisma/generated/client";
|
|
24
|
-
|
|
25
|
-
const prisma = new PrismaClient();
|
|
26
|
-
|
|
27
|
-
export default prisma;
|
|
28
|
-
{{/if}}
|
|
28
|
+
{{/if}}
|
|
@@ -18,11 +18,9 @@ import { Vite } from "alchemy/cloudflare";
|
|
|
18
18
|
{{/if}}
|
|
19
19
|
{{#if (eq serverDeploy "alchemy")}}
|
|
20
20
|
import { Worker } from "alchemy/cloudflare";
|
|
21
|
-
{{#if (eq dbSetup "d1")}}
|
|
22
|
-
import { D1Database } from "alchemy/cloudflare";
|
|
23
|
-
{{/if}}
|
|
24
21
|
{{/if}}
|
|
25
|
-
{{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
|
|
22
|
+
{{#if (and (or (eq serverDeploy "alchemy") (and (eq webDeploy "alchemy") (eq backend "self"))) (eq dbSetup "d1"))}}
|
|
23
|
+
import { D1Database } from "alchemy/cloudflare";
|
|
26
24
|
import { Exec } from "alchemy/os";
|
|
27
25
|
{{/if}}
|
|
28
26
|
import { config } from "dotenv";
|
|
@@ -37,7 +35,7 @@ config({ path: "./.env" });
|
|
|
37
35
|
|
|
38
36
|
const app = await alchemy("{{projectName}}");
|
|
39
37
|
|
|
40
|
-
{{#if (and (eq serverDeploy "alchemy") (eq dbSetup "d1"))}}
|
|
38
|
+
{{#if (and (or (eq serverDeploy "alchemy") (and (eq webDeploy "alchemy") (eq backend "self"))) (eq dbSetup "d1"))}}
|
|
41
39
|
await Exec("db-generate", {
|
|
42
40
|
{{#if (and (eq webDeploy "alchemy") (eq serverDeploy "alchemy"))}}cwd: "packages/db",{{/if}}
|
|
43
41
|
command: "{{packageManager}} run db:generate",
|
|
@@ -62,6 +60,38 @@ export const web = await Nextjs("web", {
|
|
|
62
60
|
{{else if (ne backend "self")}}
|
|
63
61
|
NEXT_PUBLIC_SERVER_URL: process.env.NEXT_PUBLIC_SERVER_URL || "",
|
|
64
62
|
{{/if}}
|
|
63
|
+
{{#if (eq backend "self")}}
|
|
64
|
+
{{#if (eq dbSetup "d1")}}
|
|
65
|
+
DB: db,
|
|
66
|
+
{{else if (and (ne database "none") (ne dbSetup "none"))}}
|
|
67
|
+
DATABASE_URL: alchemy.secret(process.env.DATABASE_URL),
|
|
68
|
+
{{/if}}
|
|
69
|
+
CORS_ORIGIN: process.env.CORS_ORIGIN || "",
|
|
70
|
+
{{#if (eq auth "better-auth")}}
|
|
71
|
+
BETTER_AUTH_SECRET: alchemy.secret(process.env.BETTER_AUTH_SECRET),
|
|
72
|
+
BETTER_AUTH_URL: process.env.BETTER_AUTH_URL || "",
|
|
73
|
+
{{/if}}
|
|
74
|
+
{{#if (eq auth "clerk")}}
|
|
75
|
+
CLERK_SECRET_KEY: alchemy.secret(process.env.CLERK_SECRET_KEY),
|
|
76
|
+
{{/if}}
|
|
77
|
+
{{#if (includes examples "ai")}}
|
|
78
|
+
GOOGLE_GENERATIVE_AI_API_KEY: alchemy.secret(process.env.GOOGLE_GENERATIVE_AI_API_KEY),
|
|
79
|
+
{{/if}}
|
|
80
|
+
{{#if (eq payments "polar")}}
|
|
81
|
+
POLAR_ACCESS_TOKEN: alchemy.secret(process.env.POLAR_ACCESS_TOKEN),
|
|
82
|
+
POLAR_SUCCESS_URL: process.env.POLAR_SUCCESS_URL || "",
|
|
83
|
+
{{/if}}
|
|
84
|
+
{{#if (eq dbSetup "turso")}}
|
|
85
|
+
DATABASE_AUTH_TOKEN: alchemy.secret(process.env.DATABASE_AUTH_TOKEN),
|
|
86
|
+
{{/if}}
|
|
87
|
+
{{#if (eq database "mysql")}}
|
|
88
|
+
{{#if (eq orm "drizzle")}}
|
|
89
|
+
DATABASE_HOST: process.env.DATABASE_HOST || "",
|
|
90
|
+
DATABASE_USERNAME: process.env.DATABASE_USERNAME || "",
|
|
91
|
+
DATABASE_PASSWORD: process.env.DATABASE_PASSWORD || "",
|
|
92
|
+
{{/if}}
|
|
93
|
+
{{/if}}
|
|
94
|
+
{{/if}}
|
|
65
95
|
},
|
|
66
96
|
dev: {
|
|
67
97
|
command: "{{packageManager}} run dev"
|
|
@@ -104,6 +134,38 @@ export const web = await TanStackStart("web", {
|
|
|
104
134
|
{{else if (ne backend "self")}}
|
|
105
135
|
VITE_SERVER_URL: process.env.VITE_SERVER_URL || "",
|
|
106
136
|
{{/if}}
|
|
137
|
+
{{#if (eq backend "self")}}
|
|
138
|
+
{{#if (eq dbSetup "d1")}}
|
|
139
|
+
DB: db,
|
|
140
|
+
{{else if (and (ne database "none") (ne dbSetup "none"))}}
|
|
141
|
+
DATABASE_URL: alchemy.secret(process.env.DATABASE_URL),
|
|
142
|
+
{{/if}}
|
|
143
|
+
CORS_ORIGIN: process.env.CORS_ORIGIN || "",
|
|
144
|
+
{{#if (eq auth "better-auth")}}
|
|
145
|
+
BETTER_AUTH_SECRET: alchemy.secret(process.env.BETTER_AUTH_SECRET),
|
|
146
|
+
BETTER_AUTH_URL: process.env.BETTER_AUTH_URL || "",
|
|
147
|
+
{{/if}}
|
|
148
|
+
{{#if (eq auth "clerk")}}
|
|
149
|
+
CLERK_SECRET_KEY: alchemy.secret(process.env.CLERK_SECRET_KEY),
|
|
150
|
+
{{/if}}
|
|
151
|
+
{{#if (includes examples "ai")}}
|
|
152
|
+
GOOGLE_GENERATIVE_AI_API_KEY: alchemy.secret(process.env.GOOGLE_GENERATIVE_AI_API_KEY),
|
|
153
|
+
{{/if}}
|
|
154
|
+
{{#if (eq payments "polar")}}
|
|
155
|
+
POLAR_ACCESS_TOKEN: alchemy.secret(process.env.POLAR_ACCESS_TOKEN),
|
|
156
|
+
POLAR_SUCCESS_URL: process.env.POLAR_SUCCESS_URL || "",
|
|
157
|
+
{{/if}}
|
|
158
|
+
{{#if (eq dbSetup "turso")}}
|
|
159
|
+
DATABASE_AUTH_TOKEN: alchemy.secret(process.env.DATABASE_AUTH_TOKEN),
|
|
160
|
+
{{/if}}
|
|
161
|
+
{{#if (eq database "mysql")}}
|
|
162
|
+
{{#if (eq orm "drizzle")}}
|
|
163
|
+
DATABASE_HOST: process.env.DATABASE_HOST || "",
|
|
164
|
+
DATABASE_USERNAME: process.env.DATABASE_USERNAME || "",
|
|
165
|
+
DATABASE_PASSWORD: process.env.DATABASE_PASSWORD || "",
|
|
166
|
+
{{/if}}
|
|
167
|
+
{{/if}}
|
|
168
|
+
{{/if}}
|
|
107
169
|
},
|
|
108
170
|
dev: {
|
|
109
171
|
command: "{{packageManager}} run dev"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useChat } from "@ai-sdk/react";
|
|
4
4
|
import { DefaultChatTransport } from "ai";
|
|
5
5
|
import { Send } from "lucide-react";
|
|
6
|
-
{{#if (
|
|
6
|
+
{{#if (eq webDeploy "alchemy")}}
|
|
7
7
|
import dynamic from "next/dynamic";
|
|
8
8
|
{{else}}
|
|
9
9
|
import { Response } from "@/components/response";
|
|
@@ -12,7 +12,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
12
12
|
import { Button } from "@/components/ui/button";
|
|
13
13
|
import { Input } from "@/components/ui/input";
|
|
14
14
|
|
|
15
|
-
{{#if (
|
|
15
|
+
{{#if (eq webDeploy "alchemy")}}
|
|
16
16
|
const Response = dynamic(
|
|
17
17
|
() =>
|
|
18
18
|
import("@/components/response").then((mod) => ({ default: mod.Response })),
|