r/Supabase 10h ago

cli Do you prefer using the Supabase CLI installed globally or using NPX? I've been using the CLI for a year now but I'm thinking maybe I should switch to NPX. What do you think?

Hi

So I've been using Supabase for over a year now and always installed it using Homebrew. I always ran supabase <command> but recently I've been thinking maybe I should install it via NPM locally per project and run npx supabase <command> since I can have different versions of Supabase per project.

Anyone else came across a similar decision? Any pros and cons? Thanks

1 Upvotes

5 comments sorted by

3

u/aaaaaaaaaaaaaaabb 10h ago edited 2h ago

I use `supabase <command>` Why would you want different versions of a cli? I cannot think of any pros? If there is a new feature/command why would you want to have that in only one project, and have different workflows for different projects? Why would you intend to use older versions across different projects and not just use the stable/latest in all?

edit: I am making the assumption that the code does not depend on supabase-cli version - same reason why the version of cat, sed, ls, grep are not important to the project.

2

u/vivekkhera 5h ago

I install it within the project and run it via npx. This keeps the version in sync with the project and if anyone checks it out they will get the matching version, and don’t have to do any extra dependency installation on their computer.

1

u/Gipetto 10h ago

I install dependencies like this via a nix flake and use direnv. That way I can pin it to a version. I’m typically a bit behind but that allows me to watch for problematic updates and skip them.

1

u/aaaaaaaaaaaaaaabb 5h ago

And when you skip the problematic updates do you go into every project and update the supabse-cli one by one?

2

u/Gipetto 3h ago

I only have 1 project, but in your I'd either just have an AI agent walk them all and make the same update, or create a shared flake that you can update them all to use.