Supabase Auth Testing: Don't Forget Your Plugs and LiveView Hooks

The elixir supabase library is community developed (Thank you!), but not quite as easy to work with as the javascript or Python variants. I hit a tricky issue today. I wanted to test some of my live views. In my routerI have pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {DreamersdashWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_current_user plug :fetch_current_profile end pipeline :admin_browser do plug :browser plug :require_admin_profile end pipeline :photo_manager_browser do plug :browser plug :require_photo_manager_profile end # ... more scope "/", DreamersdashWeb do pipe_through :photo_manager_browser live_session :authenticated_photo_manager, on_mount: [ {DreamersdashWeb.Auth, :mount_current_user}, {DreamersdashWeb.Auth, :ensure_authenticated}, {DreamersdashWeb.Auth, :load_current_profile}, {DreamersdashWeb.Auth, :require_photo_manager_profile} ] do live "/admin/photos", PhotoReviewLive.Index, :index end end Then In my Dreamersdash.Auth module I have: ...

June 30, 2025 · 2 min · 321 words

Back up remote supabase project to local supabase

To get a full copy of your remote/prod supabase setup in local do the following after first signing in, linking a project, starting supabase locally via the cli; # reset migrations supabase db reset # pull latest schema supabase db pull # apply migrations supabase migration up # Dump data from remote supabase db dump --db-url 'REMOTE CONNECTION_STRING' -f data.sql --use-copy --data-only # apply data to local psql --single-transaction --variable ON_ERROR_STOP=1 --command 'SET session_replication_role = replica' --file data.sql -h 127.0.0.1 -p 54322 -U postgres

June 13, 2025 · 1 min · 84 words