You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@claude , this PR should let you do pnpm run setup which should run convex for you. Please try it out, and then use the playwrite mcp to try to browse the app, and check if the tests work, and please report what works and what doesn't, so we can fix the setup for you
@claude , this PR should let you do pnpm run setup which should run convex for you. Please try it out, and then use the playwrite mcp to try to browse the app, and check if the tests work, and please report what works and what doesn't, so we can fix the setup for you
This PR introduces a new setup script to automate Convex configuration without requiring manual login, addressing a pain point in the existing init workflow. The approach uses a bash script to send automated inputs to convex dev --once.
Code Quality & Best Practices
✅ Strengths:
Clear separation of concerns: init for full initialization with Claude, setup for just Convex configuration
Proper use of set -e to fail fast on errors
Good error handling for the timeout scenario (exit code 124)
Executable permissions correctly set on the script
Updated .claude/settings.json to whitelist the new command
⚠️ Areas for Improvement:
Hardcoded project name in comments (line 6 of setup-convex.sh):
# 3. Accept default name (swapcard8)
This comment references "swapcard8" which appears to be a specific project name. For a template repository, this should either be generic or note that the name will vary.
Script portability: The script command behavior may vary across systems (Linux vs macOS). Consider adding a comment about OS compatibility or testing on both platforms.
Timing dependencies: The hardcoded sleep values (2s, 1s, 1s, 2s) are fragile and may fail on slower systems or under heavy load. Consider:
Adding a comment explaining these are minimum values
Increasing slightly for better reliability
Or using expect for more robust interaction
Potential Bugs & Issues
🔴 Critical:
Race condition with cp .env.example .env.local: If .env.local already exists, this will silently overwrite it, potentially destroying user configuration. Recommend:
Script error handling incomplete: If pnpm install or playwright install fails, the script continues to the Convex setup, which will likely also fail. Consider checking exit codes or using set -e earlier in the pipeline.
⚠️ Moderate:
Timeout value of 90s may be insufficient: On slower CI systems or first-time setups, Convex might need more time. Consider increasing to 120s or making it configurable.
No validation that Convex setup succeeded: The script masks all non-timeout errors as success. After the timeout block, consider adding validation:
if [ !-f"convex.json" ];thenecho"Error: Convex setup failed - convex.json not created"exit 1
fi
Performance Considerations
The 90-second timeout is reasonable for most cases
Sequential sleep commands add ~6 seconds of overhead, which is acceptable for a setup script
Playwright Chromium installation can be large (~400MB) - consider mentioning this in documentation
Security Concerns
✅ No major security issues, but note:
The .env.example contains a test Clerk key, which is fine for a template but should be documented
The script creates a local Convex project without authentication, which is appropriate for development
Consider adding a check to prevent running in production environments
Test Coverage
❓ Missing:
No automated tests for the setup script
Recommend adding a test that runs the script in a clean environment
Could add smoke tests to verify the setup creates expected files/directories
Manual Testing Recommendations:
Test on a clean checkout (no existing .env.local or convex.json)
Test with pre-existing configuration files
Test the timeout behavior
Verify the script works on both Linux and macOS
Test the complete workflow: pnpm run setup → pnpm dev
Additional Suggestions
Add progress indicators to help users understand what's happening:
echo"📦 Installing dependencies..."
pnpm install
echo"🎭 Installing Playwright..."# etc.
Consider idempotency: Make the script safe to run multiple times without breaking existing setups.
Documentation: Update README.md to explain the difference between pnpm run init and pnpm run setup.
Alternative approach: Instead of automating inputs with sleep/script, consider using Convex CLI environment variables or flags if available (check convex dev --help).
Conclusion
Overall Assessment: Good foundation, needs refinement before merge ✨
The PR successfully addresses the pain point of interactive Convex setup, but needs improvements in:
Error handling and validation
Protection against overwriting existing configs
More robust timing/interaction handling
Better documentation and testing
Recommendation: Request changes to address the critical issues (#1 and #2), then merge after testing on clean environments.
Review generated following the project's CLAUDE.md guidelines for code quality, testing, and Convex best practices.
Alternative: Make auth config optional for local dev
Modify convex/auth.config.ts to only require the env var when it's actually set
This would allow the setup to work without Clerk credentials for initial testing
Update setup script documentation
Clarify that after running pnpm run setup, users may need to set CLERK_JWT_ISSUER_DOMAIN manually
Or provide instructions for running without auth initially
📊 Summary
The setup script itself works great! It successfully automates the Convex initialization. However, the app can't actually run because of the missing CLERK_JWT_ISSUER_DOMAIN environment variable. This needs to be either:
Added to .env.example (simplest fix)
Made optional in the auth config for local development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(don't merge yet)
@claude , this PR should let you do
pnpm run setupwhich should run convex for you. Please try it out, and then use the playwrite mcp to try to browse the app, and check if the tests work, and please report what works and what doesn't, so we can fix the setup for you