Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
rivetkit-serverless Error Error Jan 2, 2026 11:34pm
3 Skipped Deployments
Project Deployment Review Updated (UTC)
rivet-cloud Ignored Ignored Jan 2, 2026 11:34pm
rivet-inspector Ignored Ignored Preview Jan 2, 2026 11:34pm
rivet-site Ignored Ignored Preview Jan 2, 2026 11:34pm

Copy link
Member Author

NathanFlurry commented Dec 23, 2025

@claude
Copy link

claude bot commented Dec 23, 2025

PR Review: Allow providing no args to createRivetKit

Summary

This PR allows createRivetKit to be called without arguments by adding a default value of undefined to the clientInput parameter. This enables developers to rely on environment variables for configuration.


Code Quality ✅

Positive aspects:

  • The change is minimal and focused - exactly what's needed
  • TypeScript typing is preserved correctly using Parameters<typeof createClient>[0]
  • The default value of undefined matches the existing behavior of createClient (rivetkit-typescript/packages/rivetkit/src/client/mod.ts:51-52)

Code style:

  • Follows the existing code pattern in the file
  • No formatting issues

Functionality Analysis ✅

How this works:

  1. When clientInput is undefined, it's passed to createClient (line 23)
  2. createClient already handles undefined by defaulting to an empty object {} (rivetkit-typescript/packages/rivetkit/src/client/mod.ts:56-60)
  3. The config schema then falls back to environment variables like RIVET_ENGINE, RIVET_ENDPOINT, RIVET_TOKEN, and RIVET_NAMESPACE (rivetkit-typescript/packages/rivetkit/src/client/config.ts:66-103)

Use case enabled:

// Now possible - relies on environment variables
const { useActor } = createRivetKit<typeof registry>();

This is particularly useful in server-side environments where configuration is typically provided via environment variables.


Potential Issues ⚠️

Type safety consideration:
While the change is functionally correct, there's a minor type inconsistency to be aware of:

The parameter type is Parameters<typeof createClient>[0], which is string | ClientConfigInput | undefined. However, the default value is specifically undefined. This is fine, but it means TypeScript won't prevent someone from explicitly passing undefined:

// All equivalent now
createRivetKit<R>();
createRivetKit<R>(undefined);

This is not a bug - just an observation that the API now has two ways to express "use defaults".


Testing Considerations 🧪

Recommended testing:

  1. Test that createRivetKit() works with environment variables set
  2. Test that it gracefully handles missing environment variables
  3. Verify existing examples still work (they all pass explicit endpoints)

Existing examples analysis:
All current examples in the codebase pass explicit endpoints:

  • examples/state/src/frontend/App.tsx:5 - passes "http://localhost:6420"
  • examples/cursors/src/frontend/App.tsx:9 - passes "http://localhost:6420"

So this change is purely additive and won't affect existing usage.


Security ✅

No security concerns. The change doesn't introduce any new attack vectors.


Performance ✅

No performance impact - this is a compile-time type change only.


Recommendations

  1. The change is good to merge as-is
  2. 📝 Consider adding a code example in documentation showing the environment variable usage pattern
  3. 🧪 Add a test case verifying createRivetKit() works without arguments

Verdict: Approved

This is a clean, minimal change that improves developer experience by supporting environment-based configuration. The implementation correctly leverages the existing createClient behavior.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 23, 2025

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@3667

@rivetkit/db

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/db@3667

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@3667

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@3667

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@3667

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@3667

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@3667

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@3667

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@3667

commit: a2d24db

@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from a2d24db to 258b84d Compare January 2, 2026 22:30
@jog1t jog1t force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 258b84d to 53631b6 Compare January 2, 2026 23:33
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 53631b6 to 258b84d Compare January 2, 2026 23:59
@jog1t jog1t force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 258b84d to 53631b6 Compare January 3, 2026 00:05
@NathanFlurry NathanFlurry force-pushed the 12-22-fix_rivetkit_allow_providing_no_args_to_createrivetkit branch from 53631b6 to 258b84d Compare January 5, 2026 02:45
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