Skip to content
Closed
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- App visibility: `base44 visibility <public|private|workspace>` sets it on the server directly (accepts `--app-id` to target any app). Also configurable via `"visibility"` in `config.jsonc`, which `base44 deploy` applies. New projects scaffold `"visibility": "public"`.

### Fixed

- Newly scaffolded apps talk to the local dev backend under `base44 dev`: the generated client reads the `VITE_BASE44_APP_BASE_URL` env var the dev server injects, falling back to the production server when unset (e.g. plain `npm run dev`).

## [0.0.51] - 2026-04-28

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:<port>) 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,
});
28 changes: 28 additions & 0 deletions packages/cli/tests/cli/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,34 @@ describe("create command", () => {
expect(config).toContain('"visibility": "public"');
});

it("scaffolds a client that targets the dev server URL injected by base44 dev", async () => {
await t.givenLoggedIn({ email: "test@example.com", name: "Test User" });
t.api.mockCreateApp({ id: "dev-url-app-id", name: "Dev Url App" });

const projectPath = join(t.getTempDir(), "dev-url-app");

const result = await t.run(
"create",
"Dev Url App",
"--path",
projectPath,
"--template",
"backend-and-client",
"--no-skills",
);

t.expectResult(result).toSucceed();

const client = await readFile(
join(projectPath, "src", "api", "base44Client.js"),
"utf-8",
);
expect(client).toContain("dev-url-app-id");
expect(client).toContain(
"serverUrl: import.meta.env.VITE_BASE44_APP_BASE_URL || undefined",
);
});

it("infers path from name when --path is not provided", async () => {
await t.givenLoggedIn({ email: "test@example.com", name: "Test User" });
t.api.mockCreateApp({ id: "inferred-path-id", name: "My App" });
Expand Down
Loading