Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions apps/cli/bunfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ timeout = 180000
coverageSkipTestFiles = true

# Exclude patterns from coverage
coveragePathIgnorePatterns = [
"test/**",
"dist/**",
"templates/**",
"node_modules/**",
]
coveragePathIgnorePatterns = ["test/**", "dist/**", "templates/**", "node_modules/**"]
3 changes: 2 additions & 1 deletion apps/cli/src/prompts/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const FULLSTACK_FRONTENDS: readonly Frontend[] = [
"next",
"tanstack-start",
"nuxt",
"astro",
// "svelte", // TODO: Add support in future update
] as const;

Expand All @@ -18,7 +19,7 @@ export async function getBackendFrameworkChoice(
) {
if (backendFramework !== undefined) return backendFramework;

const hasIncompatibleFrontend = frontends?.some((f) => f === "solid");
const hasIncompatibleFrontend = frontends?.some((f) => f === "solid" || f === "astro");
const hasFullstackFrontend = frontends?.some((f) => FULLSTACK_FRONTENDS.includes(f));

const backendOptions: Array<{
Expand Down
5 changes: 5 additions & 0 deletions apps/cli/src/prompts/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ export async function getFrontendChoice(
label: "Solid",
hint: "Simple and performant reactivity for building user interfaces",
},
{
value: "astro" as const,
label: "Astro",
hint: "The web framework for content-driven websites",
},
{
value: "tanstack-start" as const,
label: "TanStack Start",
Expand Down
20 changes: 12 additions & 8 deletions apps/cli/src/utils/compatibility-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const FULLSTACK_FRONTENDS: readonly Frontend[] = [
"next",
"tanstack-start",
"nuxt",
"astro",
// "svelte", // TODO: Add support in future update
] as const;

Expand All @@ -66,7 +67,7 @@ export function validateSelfBackendCompatibility(

if (!hasSupportedWeb) {
exitWithError(
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, and Nuxt frontends. Please use --frontend next, --frontend tanstack-start, or --frontend nuxt. Support for SvelteKit will be added in a future update.",
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, Nuxt, and Astro frontends. Please use --frontend next, --frontend tanstack-start, --frontend nuxt, or --frontend astro. Support for SvelteKit will be added in a future update.",
);
}

Expand All @@ -80,7 +81,7 @@ export function validateSelfBackendCompatibility(
const hasFullstackFrontend = frontends.some((f) => FULLSTACK_FRONTENDS.includes(f));
if (providedFlags.has("backend") && !hasFullstackFrontend && backend === "self") {
exitWithError(
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, and Nuxt frontends. Please use --frontend next, --frontend tanstack-start, --frontend nuxt, or choose a different backend. Support for SvelteKit will be added in a future update.",
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, Nuxt, and Astro frontends. Please use --frontend next, --frontend tanstack-start, --frontend nuxt, --frontend astro, or choose a different backend. Support for SvelteKit will be added in a future update.",
);
}
}
Expand Down Expand Up @@ -147,9 +148,10 @@ export function validateApiFrontendCompatibility(api: API | undefined, frontends
const includesNuxt = frontends.includes("nuxt");
const includesSvelte = frontends.includes("svelte");
const includesSolid = frontends.includes("solid");
if ((includesNuxt || includesSvelte || includesSolid) && api === "trpc") {
const includesAstro = frontends.includes("astro");
if ((includesNuxt || includesSvelte || includesSolid || includesAstro) && api === "trpc") {
exitWithError(
`tRPC API is not supported with '${includesNuxt ? "nuxt" : includesSvelte ? "svelte" : "solid"}' frontend. Please use --api orpc or --api none or remove '${includesNuxt ? "nuxt" : includesSvelte ? "svelte" : "solid"}' from --frontend.`,
`tRPC API is not supported with '${includesNuxt ? "nuxt" : includesSvelte ? "svelte" : includesSolid ? "solid" : "astro"}' frontend. Please use --api orpc or --api none or remove '${includesNuxt ? "nuxt" : includesSvelte ? "svelte" : includesSolid ? "solid" : "astro"}' from --frontend.`,
);
}
}
Expand All @@ -159,10 +161,10 @@ export function isFrontendAllowedWithBackend(
backend?: ProjectConfig["backend"],
auth?: string,
) {
if (backend === "convex" && frontend === "solid") return false;
if (backend === "convex" && (frontend === "solid" || frontend === "astro")) return false;

if (auth === "clerk" && backend === "convex") {
const incompatibleFrontends = ["nuxt", "svelte", "solid"];
const incompatibleFrontends = ["nuxt", "svelte", "solid", "astro"];
if (incompatibleFrontends.includes(frontend)) return false;
}

Expand All @@ -173,8 +175,9 @@ export function allowedApisForFrontends(frontends: Frontend[] = []) {
const includesNuxt = frontends.includes("nuxt");
const includesSvelte = frontends.includes("svelte");
const includesSolid = frontends.includes("solid");
const includesAstro = frontends.includes("astro");
const base: API[] = ["trpc", "orpc", "none"];
if (includesNuxt || includesSvelte || includesSolid) {
if (includesNuxt || includesSvelte || includesSolid || includesAstro) {
return ["orpc", "none"];
}
return base;
Expand All @@ -194,7 +197,8 @@ export function isExampleTodoAllowed(

export function isExampleAIAllowed(backend?: ProjectConfig["backend"], frontends: Frontend[] = []) {
const includesSolid = frontends.includes("solid");
if (includesSolid) return false;
const includesAstro = frontends.includes("astro");
if (includesSolid || includesAstro) return false;

// Convex AI example only supports React-based frontends (not Svelte or Nuxt)
if (backend === "convex") {
Expand Down
1 change: 1 addition & 0 deletions apps/cli/src/utils/compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export const WEB_FRAMEWORKS: readonly Frontend[] = [
"nuxt",
"svelte",
"solid",
"astro",
] as const;
2 changes: 1 addition & 1 deletion apps/cli/src/utils/config-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export function validateBackendConstraints(
}

if (backend === "convex" && providedFlags.has("frontend") && options.frontend) {
const incompatibleFrontends = options.frontend.filter((f) => f === "solid");
const incompatibleFrontends = options.frontend.filter((f) => f === "solid" || f === "astro");
if (incompatibleFrontends.length > 0) {
exitWithError(
`The following frontends are not compatible with '--backend convex': ${incompatibleFrontends.join(
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/test/addons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { expectError, expectSuccess, runTRPCTest, type TestConfig } from "./test

describe("Addon Configurations", () => {
describe("Universal Addons (no frontend restrictions)", () => {
const universalAddons = ["biome", "lefthook", "husky", "turborepo", "oxlint"];
const universalAddons = ["biome", "lefthook", "husky", "turborepo"];
Comment thread
AmanVarshney01 marked this conversation as resolved.
Resolved

for (const addon of universalAddons) {
it(`should work with ${addon} addon on any frontend`, async () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/test/backend-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ describe("Backend and Runtime Combinations", () => {

expectError(
result,
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, and Nuxt frontends. Please use --frontend next, --frontend tanstack-start, or --frontend nuxt. Support for SvelteKit will be added in a future update.",
"Backend 'self' (fullstack) currently only supports Next.js, TanStack Start, Nuxt, and Astro frontends. Please use --frontend next, --frontend tanstack-start, --frontend nuxt, or --frontend astro. Support for SvelteKit will be added in a future update.",
);
});

Expand Down
106 changes: 105 additions & 1 deletion apps/cli/test/frontend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe("Frontend Configurations", () => {
"native-unistyles",
"svelte",
"solid",
"astro",
] satisfies ReadonlyArray<
| "tanstack-router"
| "react-router"
Expand All @@ -26,6 +27,7 @@ describe("Frontend Configurations", () => {
| "native-unistyles"
| "svelte"
| "solid"
| "astro"
>;

for (const frontend of singleFrontends) {
Expand Down Expand Up @@ -75,6 +77,19 @@ describe("Frontend Configurations", () => {
config.dbSetup = "none";
config.webDeploy = "none";
config.serverDeploy = "none";
} else if (frontend === "astro") {
// Astro uses oRPC, not Convex compatible
config.backend = "hono";
config.runtime = "bun";
config.database = "sqlite";
config.orm = "drizzle";
config.auth = "none";
config.api = "orpc"; // tRPC not supported with astro
config.addons = ["none"];
config.examples = ["none"];
config.dbSetup = "none";
config.webDeploy = "none";
config.serverDeploy = "none";
} else {
config.backend = "hono";
config.runtime = "bun";
Expand Down Expand Up @@ -180,7 +195,28 @@ describe("Frontend Configurations", () => {
expectError(result, "tRPC API is not supported with 'solid' frontend");
});

const frontends = ["nuxt", "svelte", "solid"] as const;
it("should fail with Astro + tRPC", async () => {
const result = await runTRPCTest({
projectName: "astro-trpc-fail",
frontend: ["astro"],
api: "trpc",
backend: "hono",
runtime: "bun",
database: "sqlite",
orm: "drizzle",
auth: "none",
addons: ["none"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
expectError: true,
});

expectError(result, "tRPC API is not supported with 'astro' frontend");
});

const frontends = ["nuxt", "svelte", "solid", "astro"] as const;
for (const frontend of frontends) {
it(`should work with ${frontend} + oRPC`, async () => {
const result = await runTRPCTest({
Expand Down Expand Up @@ -230,6 +266,30 @@ describe("Frontend Configurations", () => {
);
});

it("should fail Astro + Convex", async () => {
const result = await runTRPCTest({
projectName: "astro-convex-fail",
frontend: ["astro"],
backend: "convex",
runtime: "none",
database: "none",
orm: "none",
auth: "none",
api: "none",
addons: ["none"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
expectError: true,
});

expectError(
result,
"The following frontends are not compatible with '--backend convex': astro. Please choose a different frontend or backend.",
);
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

it("should work with React frontends + Convex", async () => {
const result = await runTRPCTest({
projectName: "react-convex",
Expand Down Expand Up @@ -504,6 +564,50 @@ describe("Frontend Configurations", () => {
});
});

describe("Astro with Self Backend", () => {
it("should work with Astro and self backend", async () => {
const result = await runTRPCTest({
projectName: "astro-self-backend",
frontend: ["astro"],
backend: "self",
runtime: "none",
database: "sqlite",
orm: "drizzle",
auth: "better-auth",
api: "orpc",
addons: ["none"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
install: false,
});

expectSuccess(result);
});

it("should work with Astro and traditional backend", async () => {
const result = await runTRPCTest({
projectName: "astro-traditional-backend",
frontend: ["astro"],
backend: "hono",
runtime: "bun",
database: "sqlite",
orm: "drizzle",
auth: "none",
api: "orpc",
addons: ["none"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
install: false,
});

expectSuccess(result);
});
});

describe("Web Deploy Constraints", () => {
it("should work with web frontend + web deploy", async () => {
const result = await runTRPCTest({
Expand Down
35 changes: 5 additions & 30 deletions apps/web/content/docs/analytics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,11 @@ Not collected:

Telemetry is enabled by default. To disable:

<Tabs groupId="installtab" defaultValue="npm" persist>
<TabsList>
<TabsTrigger value="npm">
npm
</TabsTrigger>
<TabsTrigger value="pnpm">
pnpm
</TabsTrigger>
<TabsTrigger value="bun">
bun
</TabsTrigger>
</TabsList>
<TabsContent value="npm">
```bash
BTS_TELEMETRY_DISABLED=1 npx create-better-t-stack@latest
```
</TabsContent>
<TabsContent value="pnpm">
```bash
BTS_TELEMETRY_DISABLED=1 pnpm create better-t-stack@latest
```
</TabsContent>
<TabsContent value="bun">
```bash
BTS_TELEMETRY_DISABLED=1 bun create better-t-stack@latest
```
</TabsContent>
</Tabs>

<Callout title="Note">The above commands disable it for a single run.</Callout>
```bash
BTS_TELEMETRY_DISABLED=1 npx create-better-t-stack@latest
```

<Callout title="Note">The above command disables it for a single run.</Callout>

Add `export BTS_TELEMETRY_DISABLED=1` to your shell profile to make it permanent.

Expand Down
2 changes: 1 addition & 1 deletion apps/web/content/docs/bts-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The file is JSONC with comments enabled and includes a `$schema` URL for tooling
"examples": [],
"dbSetup": "none",
"webDeploy": "none",
"packageManager": "bun"
"packageManager": "bun",
}
```

Expand Down
Loading