Simplify dev setup: one-command start with self-healing admin key#109
Conversation
Eliminates the two-pass start that required manually generating the Convex admin key, copy-pasting it into .env, and restarting. Now `make dev` handles everything in a single run. Key changes: - Two-phase Docker start: db+convex first, then remaining services after admin key is ready - Auto-generate Convex admin key on first run (ensure-admin-key target) - Validate existing admin keys and regenerate if stale - make clean clears the admin key from .env (prevents stale key issues) - install-deps target runs npm install for frontend and backend - validate-dev-env shows all missing keys at once with URLs - Add TinyFish to required env validation - Update README with "How make dev Works" section - Simplify CLAUDE.md setup instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR modernizes local development setup: it reorganizes Sequence DiagramsequenceDiagram
participant User
participant MakeDev as "make dev"
participant Validate as "validate-dev-env"
participant InstallDeps as "install-deps"
participant Docker as "Docker Compose (core services)"
participant Convex as "Convex service"
participant EnsureKey as "ensure-admin-key"
participant ConvexPush as "convex-push/convex-env"
User->>MakeDev: run make dev
MakeDev->>Validate: run validate-dev-env
Validate->>User: report aggregated missing/placeholders
MakeDev->>InstallDeps: run npm installs
MakeDev->>Docker: start core services
Docker->>Convex: wait /version readiness
MakeDev->>EnsureKey: validate CONVEX_SELF_HOSTED_ADMIN_KEY
EnsureKey->>Convex: query with current key
alt key missing or invalid
EnsureKey->>Convex: generate new admin key
EnsureKey->>MakeDev: persist key into root .env
end
MakeDev->>ConvexPush: run convex-env and convex-push
MakeDev->>Docker: start remaining services
MakeDev->>User: stream logs
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@makefiles/Makefile`:
- Line 105: The Makefile uses a non-portable in-place sed invocation (sed -i '')
when updating CONVEX_SELF_HOSTED_ADMIN_KEY which fails on GNU sed; change the
replacement to a portable approach by using sed -i.bak
"s#^CONVEX_SELF_HOSTED_ADMIN_KEY=.*`#CONVEX_SELF_HOSTED_ADMIN_KEY`=$$generated#"
.env && rm -f .env.bak or implement an OS branch (detect via uname) to use sed
-i '' on macOS and sed -i on Linux; update both occurrences around the
CONVEX_SELF_HOSTED_ADMIN_KEY update to use the portable pattern or branching
logic so the Makefile works on both BSD/macOS and GNU/linux.
- Around line 32-39: The Makefile uses Bash-specific syntax (e.g., the check_env
function and validate-dev-env target using [[ ... ]]) but doesn't set the recipe
shell; either set SHELL := /bin/bash at the top of the Makefile to pin recipes
to Bash, or rewrite the Bashisms in the check_env function and all targets that
use [[ ... ]] (e.g., validate-dev-env and the checks at the occurrences you
noted) to POSIX-compatible constructs (use [ ... ] or test, parameter
expansions, and case) so the recipes run on /bin/sh; update references to the
check_env function name in those targets accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3daaf980-fc2b-4e25-87b6-5d6bc1d915c2
⛔ Files ignored due to path filters (1)
backend/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
.env.exampleCLAUDE.mdREADME.mdmakefiles/Makefile
- Add SHELL := /usr/bin/env bash to makefiles/Makefile for explicit bash pinning (was inherited from root Makefile but fragile) - Replace sed -i '' with sed -i.bak + rm pattern for GNU/BSD portability Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
.env, and restarting.make devhandles everything in a single run.What changed
makefiles/Makefileensure-admin-keytarget,install-depstarget, batch env validation with instructions,make cleanclears admin key.env.exampleREADME.mdmake devWorks" section with commands table and troubleshootingCLAUDE.mdHow it works
make devnow runs in phases:Test plan
cp .env.example .env, fill in keys,make dev→ auto-generates admin key, starts everythingmake devagain → detects valid key, skips generationmake cleanthenmake dev→ regenerates admin key from scratchmake dev→ detects stale key, regenerates.env,make dev→ shows all missing keys with URLs.env: delete.env,make dev→ clear error with instructions🤖 Generated with Claude Code