Skip to content

allow setting apiUri in instant.config.ts (#2793) [bump v1.0.52] - #2793

Merged
drew-harris merged 4 commits into
mainfrom
drewh/ict-set-baseurl
Jul 22, 2026
Merged

allow setting apiUri in instant.config.ts (#2793) [bump v1.0.52]#2793
drew-harris merged 4 commits into
mainfrom
drewh/ict-set-baseurl

Conversation

@drew-harris

@drew-harris drew-harris commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Allows you to set apiURI in the instant.config.ts file to make it easier to use self hosted installations of instantdb

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 134db6a4-960b-4745-b290-a9ce47002f1b

📥 Commits

Reviewing files that changed from the base of the PR and between d32536c and 7a81d76.

📒 Files selected for processing (1)
  • client/packages/version/src/version.ts

📝 Walkthrough

Walkthrough

The CLI now reads apiURI from shared instant configuration, validates and resolves the HTTP base URL, and passes it through schema indexing-status requests. Self-hosting documentation describes the new configuration option, and the package version is updated.

Changes

CLI API origin resolution

Layer / File(s) Summary
Centralize instant configuration loading
client/packages/cli/src/util/instantConfig.ts, client/packages/cli/src/old.js, client/packages/cli/src/context/currentApp.ts, client/www/app/docs/self-hosting/page.md, client/packages/version/src/version.ts
A shared instant configuration loader is added, existing callers switch to it, the legacy export is removed, documentation adds the apiURI example, and the package version is incremented.
Resolve the CLI base URL
client/packages/cli/src/lib/http.ts
The CLI checks INSTANT_CLI_API_URI, validates configured HTTP(S) URLs, and otherwise uses the existing development or production default.
Pass the API origin to indexing polling
client/packages/cli/src/lib/pushSchema.ts, client/packages/cli/src/old.js
Schema indexing polling receives the resolved API URI, and fetchJson builds requests from that origin.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: stopachka, nezaj

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding apiURI support in instant.config.ts for instant-cli.
Description check ✅ Passed The description is directly related to the change and explains the self-hosted apiURI configuration use case.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch drewh/ict-set-baseurl

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/packages/cli/src/lib/http.ts`:
- Around line 136-145: Update the instantConfig.apiURI handling in the HTTP
configuration flow to accept only non-empty string values, ignoring null,
numbers, and empty strings. Before returning a valid explicit origin, normalize
it by removing trailing slashes so downstream path concatenation does not
produce double slashes; preserve the existing setEnv and dev/default fallback
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ccfb6858-6a82-40e3-9824-3eb7e25bb7b8

📥 Commits

Reviewing files that changed from the base of the PR and between 319ec69 and bebcd82.

📒 Files selected for processing (5)
  • client/packages/cli/src/context/currentApp.ts
  • client/packages/cli/src/lib/http.ts
  • client/packages/cli/src/lib/pushSchema.ts
  • client/packages/cli/src/old.js
  • client/packages/cli/src/util/instantConfig.ts

Comment thread client/packages/cli/src/lib/http.ts
@github-actions

Copy link
Copy Markdown
Contributor

View Vercel preview at instant-www-js-drewh-ict-set-baseurl-jsv.vercel.app.

@stopachka stopachka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! Maybe we should update docs to explain this?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/www/app/docs/self-hosting/page.md`:
- Around line 183-190: Update the apiURI example in the instant.config.ts
snippet to use the documented local self-hosting endpoint http://localhost:8888,
unless the surrounding documentation explicitly establishes when port 18987 is
required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6af93fbb-66da-440a-9f13-ef1aa06c919d

📥 Commits

Reviewing files that changed from the base of the PR and between 27e2d11 and d01119b.

📒 Files selected for processing (1)
  • client/www/app/docs/self-hosting/page.md

Comment thread client/www/app/docs/self-hosting/page.md
@drew-harris drew-harris changed the title allow setting apiUri in instant.config.ts for instant-cli allow setting apiUri in instant.config.ts (#2793) [bump v1.0.52] Jul 22, 2026
@drew-harris
drew-harris merged commit b5d4674 into main Jul 22, 2026
30 checks passed
@drew-harris
drew-harris deleted the drewh/ict-set-baseurl branch July 22, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants