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-site Ready Ready Preview Comment Dec 2, 2025 10:05am
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
rivet-cloud Ignored Ignored Dec 2, 2025 10:05am
rivet-inspector Ignored Ignored Preview Dec 2, 2025 10:05am
rivetkit-serverless Skipped Skipped Dec 2, 2025 10:05am

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

PR Review: Templates Page Implementation

Overview

This PR adds a comprehensive templates browsing system to the website with search, filtering, and detail pages. The implementation is solid but there are several improvements to consider.


✅ Strengths

  1. Good Component Structure: Clean separation between client and server components following Next.js 13+ patterns
  2. Type Safety: Excellent use of TypeScript with strict types for technologies and tags
  3. Fuzzy Search: Good UX with Fuse.js integration for flexible searching
  4. Responsive Design: Mobile-friendly layout with proper breakpoints
  5. SEO Optimization: Proper metadata generation and canonical URLs

🔍 Issues & Recommendations

Critical Issues

1. Hardcoded File Paths (Security & Reliability Risk)

Location: website/src/app/(v2)/(marketing)/templates/[slug]/page.tsx:38-45

The README loading uses a brittle relative path:

const readmePath = path.join(process.cwd(), "..", "examples", templateName, "README.md");

Issues:

  • Assumes specific directory structure that may not exist in all deployment environments
  • No validation that the path does not escape intended boundaries (directory traversal risk)
  • Silent failure with generic error message

Recommendation: Add input validation and path normalization:

const EXAMPLES_BASE_PATH = path.join(process.cwd(), "..", "examples");

async function getReadmeContent(templateName: string): Promise<string> {
  // Validate template name to prevent directory traversal
  if (!/^[a-z0-9-]+$/.test(templateName)) {
    return "# Invalid Template\n\nTemplate name contains invalid characters.";
  }
  
  try {
    const readmePath = path.join(EXAMPLES_BASE_PATH, templateName, "README.md");
    const normalizedPath = path.normalize(readmePath);
    
    // Verify path is within expected directory
    if (!normalizedPath.startsWith(path.normalize(EXAMPLES_BASE_PATH))) {
      throw new Error("Invalid path");
    }
    
    const content = await fs.readFile(readmePath, "utf-8");
    return content;
  } catch (error) {
    console.error(`Failed to read README for ${templateName}:`, error);
    return `# README Not Available\n\nView it on [GitHub](https://github.com/rivet-dev/rivetkit/tree/main/examples/${templateName}).`;
  }
}

Code Quality Issues

2. Inline Styles Instead of Tailwind Classes

Location: website/src/app/(v2)/(marketing)/templates/TemplatesPageClient.tsx:93,99

style={{ color: "#FAFAFA" }}

Issue: Mixing inline styles with Tailwind breaks consistency and makes theme changes harder.

Recommendation: Use Tailwind classes like text-zinc-50 instead of inline styles.


3. useMemo Dependency Arrays

Location: website/src/app/(v2)/(marketing)/templates/TemplatesPageClient.tsx:16-44

Empty dependency arrays [] when using templates imported value. Since templates is a static import, this is acceptable, but for future-proofing consider adding it to deps.


4. Magic Numbers in UI

Values like h-[400px], max-w-[1500px], max-w-[1400px] are repeated. Consider extracting to theme config.


Accessibility Issues

5. Missing ARIA Labels on Search Input

Location: website/src/app/(v2)/(marketing)/templates/TemplatesPageClient.tsx:112-118

Recommendation: Add aria-label="Search templates" to the search input.


User Experience Enhancements

6. Clear All Filters Performance

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

The clear button triggers multiple state updates sequentially:

onClick={() => {
  selectedTags.forEach((tag) => onTagToggle(tag));
  selectedTechnologies.forEach((tech) => onTechnologyToggle(tech));
}}

Recommendation: Expose a single clearFilters function in parent that clears both states at once to avoid multiple re-renders.


7. Template Data Completeness

Many templates have empty tags: [] which reduces discoverability. Consider adding at least one tag to each template.


8. Related Templates Algorithm

Location: website/src/app/(v2)/(marketing)/templates/[slug]/TemplateDetailClient.tsx:20-34

Falls back to first 3 templates if no shared tags. Consider prioritizing templates with shared technologies or randomizing for better exposure.


📋 Testing Recommendations

  1. Test path traversal: Try accessing /templates/../../../etc/passwd (should 404)
  2. Test missing READMEs: Ensure graceful degradation
  3. Keyboard navigation: Tab through filters to ensure accessibility
  4. Mobile responsiveness: Test filter sidebar on mobile

🎯 Summary

Overall Assessment: Well-structured feature following React and Next.js best practices. The main concerns are around file path security, accessibility, and minor performance optimizations.

Priority:

Great work on this feature! The templates page will be a valuable resource for users. 🚀

@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: d7f4e0d

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