Skip to content

Conversation

@NathanFlurry
Copy link
Member

No description provided.

@vercel
Copy link

vercel bot commented Dec 2, 2025

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

Project Deployment Preview Comments Updated (UTC)
rivet-inspector Ready Ready Preview Comment Dec 6, 2025 8:43am
rivet-site Ready Ready Preview Comment Dec 6, 2025 8:43am
rivetkit-serverless Error Error Dec 6, 2025 8:43am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Dec 6, 2025 8:43am

Copy link
Member Author

NathanFlurry commented Dec 2, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


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.

@claude
Copy link

claude bot commented Dec 2, 2025

Pull Request Review: Add Templates Feature

Overview

This PR adds a templates/examples registry feature to the website, creating a centralized system for managing and displaying RivetKit examples. The implementation includes:

  • A new @rivet-gg/example-registry package that generates template metadata from example directories
  • New website pages for browsing and viewing templates
  • Template metadata added to all example package.json files

Code Quality & Architecture ✅

Strengths

  1. Clean separation of concerns: The example registry is properly separated as its own package
  2. Auto-generation approach: Using a build script to generate _gen.ts from source data is a solid pattern
  3. Type-safe implementation: Good use of TypeScript interfaces and type exports
  4. DRY principle: Centralizing template metadata in package.json files eliminates duplication

Areas for Improvement

1. Error Handling - Build Script ⚠️

Location: frontend/packages/example-registry/scripts/build.ts:91-93

The build script catches errors but continues silently. The script requires template metadata (line 47-50 throws if missing) but catches and ignores the error. This could lead to incomplete data generation without clear feedback.

Recommendation:

  • Track failed examples and report them at the end
  • Consider failing the build if required examples are missing metadata

2. Inconsistent Technology Handling 🤔

Location: frontend/packages/example-registry/scripts/build.ts:79-82

The build script adds "rivet" if not present, but remove-rivet-tech.ts removes it. Should "rivet" be automatically added or not? This seems circular.

Recommendation:

  • If "rivet" should always be implied, remove it from all package.json files and only add it in the build script
  • If it's metadata, keep it in package.json and remove the auto-add logic
  • Document the decision

3. Missing Package.json Fields ℹ️

Location: frontend/packages/example-registry/package.json

The package has "exports" pointing to source files rather than built files. The main and module fields point to dist/ but exports points to src/.

Recommendation: Update exports to match build output or add a build step (currently missing in package.json scripts).

Potential Bugs 🐛

1. Race Condition in Parallel Updates

Location: website/src/app/(v2)/(marketing)/templates/components/TemplatesSidebar.tsx:76-79

The clear all button calls state setters in a loop, which could lead to stale state. Add a onClearAll callback from parent component instead.

2. Potential Undefined Behavior

Location: frontend/packages/example-registry/scripts/build.ts:64-65

No validation that the title isn't empty after trimming. Edge case: a README with just # would set displayName to empty string.

Performance Considerations ⚡

Efficient Implementation ✅

The fuzzy search implementation is well optimized:

  • Fuse instance is correctly memoized ✅
  • Search only runs when query is non-empty ✅
  • Filtering logic is properly memoized ✅

Security Concerns 🔒

No Issues Found ✅

  • No user-generated content rendered without sanitization
  • Package.json parsing is from trusted sources
  • Markdown rendering uses proper component

Test Coverage 📊

Missing Tests ⚠️

No test files were added for:

  • @rivet-gg/example-registry package
  • Build script validation
  • Template page components
  • Filtering/search logic

Recommendations:

  1. Add tests for build script (valid/invalid package.json, missing README, etc.)
  2. Add tests for React components (filtering, search, tag selection)
  3. Add integration test to verify all examples have required metadata

Code Style & Best Practices 📝

Follows Repository Standards ✅

  • Uses TypeScript correctly
  • Proper use of async/await
  • Clean component structure

Suggestions:

  1. Add JSDoc Comments for the public API
  2. Consider Adding Validation - The build script could validate that technology/tag names match the constants to catch typos early

Additional Observations

Migration Scripts ℹ️

The PR includes migration scripts (migrate-templates.ts, remove-rivet-tech.ts) that appear to be one-time utilities. Consider moving them to a scripts/migrations/ directory or removing them if no longer needed.

Deleted File ✅

website/scripts/generateExamples.mjs was removed - good, it's replaced by the new registry system.

Summary

Overall Assessment: Strong Implementation

This PR introduces a well-architected template system with clean separation of concerns.

Must Fix Before Merge:

  • None (all issues are minor)

Should Fix:

  1. Clarify and document the "rivet" technology handling strategy
  2. Improve error handling in build script to fail loudly on missing metadata
  3. Fix package.json exports field

Nice to Have:

  1. Add test coverage
  2. Add JSDoc documentation
  3. Add validation for technology/tag names
  4. Clean up migration scripts

Recommendations:

  • Consider adding a validate script that checks all examples have required metadata
  • Add the registry build to CI to catch metadata issues early
  • Document the template metadata schema in a README within the example-registry package

Great work on this feature! The foundation is solid and extensible. 🎉

@NathanFlurry NathanFlurry force-pushed the 11-30-feat_site_add_templates branch from 735dd6f to d7f4e0d Compare December 2, 2025 10:01
@NathanFlurry NathanFlurry force-pushed the 11-30-feat_examples_add_user-generated-actors_example branch from 59757d7 to cc69285 Compare December 2, 2025 10:01
@vercel vercel bot temporarily deployed to Preview – rivetkit-serverless December 2, 2025 10:01 Inactive
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 2, 2025

More templates

@rivetkit/cloudflare-workers

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

@rivetkit/db

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

@rivetkit/framework-base

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

@rivetkit/next-js

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

@rivetkit/react

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

rivetkit

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

@rivetkit/sql-loader

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

@rivetkit/engine-runner

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

@rivetkit/engine-runner-protocol

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

commit: 3082543

@NathanFlurry NathanFlurry force-pushed the 11-30-feat_examples_add_user-generated-actors_example branch from cc69285 to 093ba9b Compare December 3, 2025 02:00
@NathanFlurry NathanFlurry force-pushed the 11-30-feat_site_add_templates branch from d7f4e0d to f111198 Compare December 3, 2025 02:00
@graphite-app graphite-app bot force-pushed the 11-30-feat_examples_add_user-generated-actors_example branch 2 times, most recently from 91028de to eb81abd Compare December 3, 2025 08:09
@graphite-app graphite-app bot force-pushed the 11-30-feat_site_add_templates branch from f111198 to 1add7bd Compare December 3, 2025 08:09
@NathanFlurry NathanFlurry changed the base branch from 11-30-feat_examples_add_user-generated-actors_example to graphite-base/3567 December 3, 2025 08:32
@NathanFlurry NathanFlurry force-pushed the 11-30-feat_site_add_templates branch from 1add7bd to 80590eb Compare December 4, 2025 23:32
@NathanFlurry NathanFlurry changed the base branch from graphite-base/3567 to main December 4, 2025 23:32
@NathanFlurry NathanFlurry marked this pull request as ready for review December 4, 2025 23:32
@vercel vercel bot temporarily deployed to Preview – rivetkit-serverless December 4, 2025 23:32 Inactive
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