Skip to content
prod 352bb92
Browse

8 · Dev tooling

Objective — adopt local-development power-ups only where they fill a real gap: Atlas schema management, a database GUI (Bytebase), Redis caching via Herd Pro, and a right-sized debug-tools stack. None block launch; each has a free fallback.

Steps at a glance:

  1. Atlas — schema management — Atlas gives clean schema exports and cross-environment diffs (it’s the preferred exporter on page 5).
  2. Bytebase — database GUI & review workflow — Bytebase adds a web UI for schema management, SQL review, and approval workflows across staging/production.
  3. Redis cache via Herd Pro — Redis replaces file-based cache/sessions/queues — 2–3× faster page loads, instant sessions. Not required for launch, and easy to add post-deploy.
  4. Debug tools — install only what fills a gap — Shipping without a request/query inspector is guesswork — but many CodeCanyon apps already ship barryvdh/laravel-debugbar.

After Shared-hosting readiness is clean, decide which dev tools earn a place in this project. Adopt what you need, and prefer the free fallback when a paid service does not clearly help.

Atlas gives clean schema exports and cross-environment diffs (it’s the preferred exporter on page 5). The CLI is free; Atlas Cloud’s visual diffs and CI checks need a license.

  1. Install the CLI and sign in. The CLI install is terminal-runnable; the atlas login browser sign-in is a 👤 step if you want Cloud features.

    Terminal window
    atlas version 2>/dev/null || brew install ariga/tap/atlas
    atlas login && atlas whoami
    # Expected: a version, then your Atlas identity after the browser login
    • ✅ The Atlas CLI is installed (and signed in if you use Cloud).
  2. Point it at the local DB via an env var — keep secrets out of atlas.hcl — and gitignore the env files.

    Terminal window
    echo 'ATLAS_LOCAL_URL="mysql://root:@127.0.0.1:3306/[PROJECT_NAME]_local"' > .env.atlas
    grep -q '^\.env\.atlas$' .gitignore || printf '.env.atlas\n' >> .gitignore
    grep -q '^\.envrc$' .gitignore || printf '.envrc\n' >> .gitignore
    # Expected: .env.atlas written and both env files added to .gitignore
    • ✅ Atlas reads the DB URL from a gitignored env file.

2. Bytebase — database GUI & review workflow

Section titled “2. Bytebase — database GUI & review workflow”

Bytebase adds a web UI for schema management, SQL review, and approval workflows across staging/production. It’s a heavier setup (~60–90 min) and only worth it for teams running frequent reviewed schema changes.

  1. Stand up the workspace and connect your instances.
    • Create a free workspace at hub.bytebase.com.

    • Add your staging and production instances (whitelist Bytebase’s egress IP in Remote MySQL first).

    • Create a project, transfer the databases in, sync schemas, and attach an SQL-review policy.

    • ✅ Bytebase is connected to your instances with a review policy attached.

Redis replaces file-based cache/sessions/queues — 2–3× faster page loads, instant sessions. Not required for launch, and easy to add post-deploy. Local dev uses Herd Pro’s built-in Redis; staging/production use Upstash (configured in Phase 4/5).

  1. Start the Herd Redis service, then confirm it answers.

    Terminal window
    redis-cli ping # expect PONG
    # Expected: PONG
    • redis-cli ping returns PONG.
  2. Require Predis, or record a named carry-forward — install only after the Phase 3 PHP-drift check is clean. If PHP drift is unresolved, do not mutate composer.lock here; record the package decision for Phase 5 after Phase 4 confirms the deploy PHP, then skip the Redis wiring below for now.

    Terminal window
    INSTALL_PREDIS="${INSTALL_PREDIS:-1}" # set to 0 when PHP drift is unresolved
    if [ "$INSTALL_PREDIS" = "1" ]; then
    composer require predis/predis
    else
    grep -q '| redis-predis-package |' Zaj-BACKLOG.md 2>/dev/null || printf '%s\n' \
    "| $(date +%Y-%m-%d) | redis-predis-package | 🟢 carry-forward non-blocker | Predis install waits for confirmed deploy PHP + Phase 5 Composer pin | Phase 5 page 1 | Predis resolves under the deploy PHP and Redis checks pass |" \
    >> Zaj-BACKLOG.md
    echo "Predis carry-forward recorded in Zaj-BACKLOG.md"
    fi
    # Expected: Predis resolves and installs without changing the PHP platform decision,
    # or a named Phase 5 carry-forward is already recorded.
    • ✅ Predis is installed, or Zaj-BACKLOG.md names a Phase 5 carry-forward to install it after Phase 4 confirms the deploy PHP and before the first live deploy.
  3. Wire local .env to the Herd Redis (no password, localhost). Skip this Step when Predis was carried forward instead of installed.

    CACHE_DRIVER=redis
    SESSION_DRIVER=redis
    QUEUE_CONNECTION=redis
    REDIS_CLIENT=predis
    REDIS_HOST=127.0.0.1
    REDIS_PASSWORD=null # leave unquoted — null is a literal token; "null" breaks auth (exception to the double-quote-secrets rule)
    REDIS_PORT=6379
    REDIS_PREFIX=[PROJECT_NAME]_local_
    • .env points cache/session/queue at the local Redis.
  4. Verify through tinker, then commit the lock-file change. Skip this Step when Predis was carried forward instead of installed.

    Terminal window
    php artisan config:clear && php artisan cache:clear
    php artisan tinker --execute="Cache::put('t','Redis works!',60); echo Cache::get('t');"
    git add composer.json composer.lock && git commit -m "Add Redis cache support via Predis"
    # Expected: "Redis works!" prints, then the lock-file commit is created
    • ✅ Tinker returns Redis works! and the lock change is committed.

Prepare (don’t populate) the Upstash placeholders in your .env.staging / .env.production templates for the deploy phase. If Predis was carried forward, leave local cache/session/queue on file/sync drivers and record the reopen trigger in Zaj-BACKLOG.md.

If you’re not on Herd Pro, any of these gives you the same local Redis:

4. Debug tools — install only what fills a gap

Section titled “4. Debug tools — install only what fills a gap”

Shipping without a request/query inspector is guesswork — but many CodeCanyon apps already ship barryvdh/laravel-debugbar. Installing Telescope on top creates competing toolbars and double-captures queries. Check first.

  1. Check what’s already present.

    Terminal window
    grep -c '"name": "barryvdh/laravel-debugbar"' composer.lock
    grep -c '"name": "laravel/telescope"' composer.lock
    # Expected: a 0/1 count for each — tells you what's already installed
    • ✅ The inspectors already in composer.lock are known.
  2. Add at most one, based on what’s present.

    Already presentAction
    debugbar onlyKeep it — you have request/query visibility. Don’t add Telescope.
    Telescope onlyKeep it.
    NeitherAdd one — debugbar for a quick bottom-bar, Telescope for a richer dashboard.
    • ✅ Exactly one request/query inspector is active — no duplicates.

Do not mark this step done until every box below is checked.

  • 🔀 Per-tool decision made — installed where it adds value, or marked N/A with evidence and the free fallback noted.
  • 🔀 Redis (if added)redis-cli pingPONG and tinker returns "Redis works!".
  • 🤖 No duplicate inspectors — not both debugbar and Telescope.
  • 🤖 Phase 3 complete — local environment installed, verified, committed, and secured.