Skip to content

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Jan 20, 2026

TL;DR

Added Vercel-compatible versions of examples with a script to generate them automatically.

What changed?

  • Added a script (scripts/vercel-examples/generate-vercel-examples.ts) that automatically creates Vercel-compatible versions of examples
  • Created Vercel-specific examples for all compatible examples with -vercel suffix
  • Updated CLAUDE.md with guidance about maintaining parity between local and Vercel examples
  • Removed standalone vercel.json files from original examples
  • Updated website template page to show Vercel deploy buttons when available

How to test?

  1. Run the script to generate or update Vercel examples:

    npx tsx scripts/vercel-examples/generate-vercel-examples.ts
    
  2. Test specific examples:

    npx tsx scripts/vercel-examples/generate-vercel-examples.ts --example hello-world
    
  3. Force regeneration of all examples:

    npx tsx scripts/vercel-examples/generate-vercel-examples.ts --force
    

Why make this change?

This change streamlines the process of maintaining Vercel-compatible versions of examples, ensuring parity between local and Vercel deployments. It makes it easier for users to deploy examples directly to Vercel with proper configuration, while keeping the original examples clean and focused on local development.

@railway-app
Copy link

railway-app bot commented Jan 20, 2026

🚅 Deployed to the rivet-pr-3985 environment in rivet-frontend

Service Status Web Updated (UTC)
website 😴 Sleeping (View Logs) Web Jan 20, 2026 at 8:43 pm
frontend-inspector 😴 Sleeping (View Logs) Web Jan 20, 2026 at 8:42 pm
frontend-cloud 😴 Sleeping (View Logs) Web Jan 20, 2026 at 8:40 pm

Copy link
Contributor Author

jog1t commented Jan 20, 2026


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jog1t jog1t requested a review from NathanFlurry January 20, 2026 20:33
@jog1t jog1t self-assigned this Jan 20, 2026
@jog1t jog1t marked this pull request as ready for review January 20, 2026 20:33
@claude
Copy link

claude bot commented Jan 20, 2026

PR Review: Add Vercel Examples

Summary

This PR adds Vercel-optimized versions of examples to the repository. It creates ~30 new -vercel examples by duplicating and adapting existing examples for Vercel deployment using the hono/vercel adapter.

Changes:

  • 390 files changed (+22,996, -353 lines)
  • ~30 new examples/*-vercel/ directories created
  • Documentation updates to CLAUDE.md and new examples/CLAUDE.md
  • Removal of vercel.json from origin examples

✅ Strengths

1. Documentation Quality

The examples/CLAUDE.md is comprehensive and well-structured:

  • Clear directory layout patterns
  • Detailed configuration file templates
  • ESM import requirements documented
  • Best practices for Vercel examples

2. Consistent Structure

All Vercel examples follow a consistent pattern:

  • api/index.ts - Entry point with handle(app) from hono/vercel
  • vercel.json - Proper configuration
  • READMEs with Vercel-specific notes and deploy buttons
  • Appropriate package.json scripts

3. Code Quality

Examples reviewed show:

  • Proper TypeScript usage with strict mode
  • Type-safe actor definitions
  • Good test coverage (e.g., actor-actions-vercel/tests/)
  • ESM-compliant imports with .ts extensions

🔍 Potential Issues

1. Documentation Accuracy Issues

README.md Inconsistencies
In examples/actor-actions-vercel/README.md:

  • Lines 13-16 reference the wrong example directory:
    cd rivet/examples/actor-actions  # Should be actor-actions-vercel
  • Line 31 references wrong path:
    src/backend/registry.ts  # Should be src/actors.ts
    

Recommendation: All Vercel example READMEs should reference their own directory and correct file paths. Consider adding a validation step to the generation script.

2. Missing Test Configuration

vitest.config.ts Port Conflict
In examples/actor-actions-vercel/vitest.config.ts:

export default defineConfig({
  server: {
    port: 5173,  // Same as Vite dev server
  },
  // ...
});

Issue: The test server uses port 5173, which conflicts with the Vite dev server. For Vercel examples using vercel dev, this might cause issues.

Recommendation: Either:

  • Use a different port (e.g., 5174)
  • Document that tests shouldn't run while dev server is active
  • Remove the port configuration if not needed

3. Vercel Configuration Questions

Framework Detection
In examples/actor-actions-vercel/vercel.json:

{
  "framework": "vite",
  "rewrites": [...]
}

According to examples/CLAUDE.md lines 257-262, the framework should be set to "hono" to prevent Vercel from auto-detecting Vite and ignoring Hono. However, this example has frontend and sets "framework": "vite".

Questions:

  • Is this intentional for examples with frontends?
  • Does Vercel correctly handle the /api/ routes with "framework": "vite"?
  • Should the documentation be updated to clarify when to use "vite" vs "hono"?

4. Package.json Concerns

Missing Test Script
examples/actor-actions-vercel/package.json has vitest as a dependency but no test script:

{
  "scripts": {
    "dev": "vercel dev",
    "build": "vite build",
    "check-types": "tsc --noEmit"
    // Missing: "test": "vitest run"
  }
}

Recommendation: Add test scripts to all Vercel examples with tests, or remove vitest dependency if tests aren't meant to run in Vercel examples.

5. tsconfig.json API Directory

In examples/actor-actions-vercel/tsconfig.json:

{
  "include": [
    "src/**/*",
    "api/**/*",      // New for Vercel
    "frontend/**/*"
  ]
}

Good: The api/ directory is included.

Consideration: The api/index.ts file is minimal (4 lines) and just re-exports. Ensure this doesn't cause any type resolution issues when the actual types are in src/.


🔒 Security Review

No Major Concerns

  • No hardcoded credentials or secrets
  • No unsafe dependencies
  • Actor state management looks secure
  • Input validation in actor actions is appropriate

Minor Note

The ai-agent-vercel example uses OpenAI API which requires an API key. The example properly doesn't include any keys, but ensure documentation reminds users to set environment variables.


⚡ Performance Considerations

Duplication vs Generation

Observation: The PR adds ~23k lines of mostly duplicated code.

Pros:

  • Examples are self-contained
  • Users can clone and deploy immediately
  • No build step confusion

Cons:

  • Maintenance burden (updates need to happen in 2 places)
  • Repository size increase

Current Mitigation: The generation script at scripts/vercel-examples/generate-vercel-examples.ts helps, but requires manual running.

Recommendation: Consider adding this to CI/CD:

  • Pre-commit hook validation
  • GitHub Actions to verify Vercel examples are in sync
  • Or auto-generate on push

Vercel Deployment Efficiency

The examples use appropriate patterns for Vercel:

  • Edge-compatible code
  • Proper adapter usage
  • Static asset handling

🧪 Test Coverage

Positive

Examples include good test coverage:

  • actor-actions-vercel/tests/actions.test.ts has 8 comprehensive tests
  • Tests use proper setupTest patterns
  • Good coverage of actor lifecycle and state

Concern

Without test scripts in package.json, it's unclear:

  • How users should run tests in Vercel examples
  • Whether tests are meant for local development only
  • If Vercel should run tests in CI

📋 Checklist Against CLAUDE.md

✅ Examples follow the documented structure
✅ ESM imports use .ts extensions
✅ tsconfig includes required options
✅ Registry exported as registry
✅ Server exports default Hono app
✅ Comments use complete sentences
❌ README paths reference wrong directories (see issue #1)
❌ vercel.json framework setting inconsistent with docs (see issue #3)
❌ Missing test scripts in package.json (see issue #4)


🎯 Recommendations

High Priority

  1. Fix README paths - Update all Vercel example READMEs to reference correct directories
  2. Clarify vercel.json framework setting - Update examples/CLAUDE.md to document when to use "vite" vs "hono"
  3. Add test scripts - Either add test scripts or document why they're not needed

Medium Priority

  1. Fix vitest port conflicts - Use different port or remove server config
  2. Add generation to CI - Automate verification that Vercel examples stay in sync
  3. Document environment variables - Especially for examples like ai-agent-vercel

Low Priority

  1. Consider symlinks for shared files - For files that are identical (like src/actors.ts), symlinks could reduce duplication
  2. Add integration tests - Test that Vercel deployment actually works

✅ Overall Assessment

This is a well-structured PR that successfully adds Vercel deployment support. The code quality is high, the structure is consistent, and the documentation is comprehensive.

The main issues are:

  • Documentation inconsistencies that could confuse users
  • Missing test scripts in package.json
  • Need for clarity on Vercel configuration best practices

Recommendation: Approve with minor revisions to fix the documentation paths and clarify the framework configuration strategy.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 20, 2026

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@3985

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 2154542

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