From 8e6eea55f5fe487438605746a0b4573c2e4ef966 Mon Sep 17 00:00:00 2001 From: David Susskind Date: Mon, 20 Jul 2026 15:35:03 +0300 Subject: [PATCH] fix(dev): scaffold apps with the injected local dev server URL `base44 dev` injects VITE_BASE44_APP_BASE_URL so the app's SDK targets the local dev backend, but the scaffolded base44Client only passed { appId }, so the browser hit the remote backend instead of localhost. Pass serverUrl from the injected env var; it is unset in prod builds, so the SDK falls back to its default server. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../templates/backend-and-client/src/api/base44Client.js.ejs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/cli/templates/backend-and-client/src/api/base44Client.js.ejs b/packages/cli/templates/backend-and-client/src/api/base44Client.js.ejs index c4c0d5967..4eed3f28a 100644 --- a/packages/cli/templates/backend-and-client/src/api/base44Client.js.ejs +++ b/packages/cli/templates/backend-and-client/src/api/base44Client.js.ejs @@ -2,4 +2,8 @@ import { createClient } from '@base44/sdk'; export const base44 = createClient({ appId: '<%= projectId %>', + // `base44 dev` injects VITE_BASE44_APP_BASE_URL (http://localhost:) so the + // SDK targets the local dev backend; unset in prod builds, so it falls back to + // the SDK's default server. + serverUrl: import.meta.env.VITE_BASE44_APP_BASE_URL || undefined, });