CLI Services & Advanced Dev Environment

CLI Services: Advanced Dev Environment Setup

Keep this page open while you work. It shows the daily loop and deeper commands when you need them.


Daily Workflow Snapshot

git pull
supabase db diff   # if schema changed
npm run dev        # or vercel dev
# build feature with Cursor
git add .
git commit -m "feat: ..."
git push
vercel --prod      # when ready for prod

Git Essentials

  • git pull — sync before you touch code
  • git status — check what changed
  • git add . + git commit -m "..." — save grouped work
  • git push — share with GitHub / trigger Vercel

Common fixes

SituationCommand
Merge conflictgit pull, resolve files, git add ., git commit
Undo uncommitted filegit restore path/to/file
Fix last commit messagegit commit --amend -m "new message"
Need first-time repo setup?
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/yourusername/your-repo.git
git push -u origin main

Supabase CLI

  • supabase login (one-time) → supabase link --project-ref <ref>
  • supabase migration new <name> — scaffold SQL file
  • supabase db push — apply migrations to remote
  • supabase db pull — sync remote schema back to files
  • supabase db diff — compare local vs. remote (requires Docker for full local diff)
  • supabase db shell — run ad-hoc SQL queries

Quick workflow

supabase migration new add_tasks_table
# edit the generated SQL
supabase db push
git add supabase/migrations
git commit -m "Add tasks table"
Local development commands
supabase start     # spins up local stack (needs Docker)
supabase db reset  # apply migrations locally
supabase stop      # shut down local services

Vercel CLI

  • npm install -g vercel (once) → vercel login
  • vercel — link project + deploy preview
  • vercel --prod — push to production manually
  • vercel dev — run Next.js locally with Vercel settings
  • vercel logs <deployment-url> — view production/runtime errors
Environment variables & settings
  • Pull config locally: vercel pull
  • Manage env vars: vercel env pull .env.production
  • List projects: vercel ls

Cursor IDE Tips

  • Open terminal: `Cmd/Ctrl + “
  • Launch project from shell: cursor .
  • Quick commands: Cmd/Ctrl + K (inline chat), Cmd/Ctrl + L (side panel chat), Cmd/Ctrl + Shift + P (command palette)
  • When Cursor writes code:
    1. Read the diff
    2. Reject if off-track
    3. Re-prompt with clarifications or paste existing context

Practice Loop

  1. git pull
  2. supabase migration new add_example
  3. Add a column in the SQL file
  4. supabase db push
  5. git add supabase/migrations
  6. git commit -m "Add example column"
  7. git push
  8. vercel --prod

If any step fails, capture the error and jump to Troubleshooting & Logs.

© 2025 Building with AI Course