---
title: "supabase-js v2"
description: "supabase-js v2 brings incremental quality-of-life changes over v1."
url: "https://swe.quest/articles/supabase-js-v2-f87cba2e3b41f9e9"
canonical: "https://supabase.com/blog/supabase-js-v2"
source: "Supabase"
published: "2022-08-16"
difficulty: "medium"
kind: "Release"
reading_minutes: 5
tags: ["javascript","typescript","api-design","identity-auth","postgres"]
---

# supabase-js v2

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2022-08-16, 5 min read, Release. Original: [https://supabase.com/blog/supabase-js-v2](https://supabase.com/blog/supabase-js-v2)

## Summary

supabase-js v2 brings incremental quality-of-life changes over v1. Types are now generated from the database via the CLI and set once on the client. signIn() is split into signInWithPassword() and signInWithOtp(), server-side auth moves to auth.admin, and the auth library is now async to fix a multi-tab token refresh race condition that logged users out. insert/update/upsert no longer return data unless select() is appended, which avoids surprise failures under Row Level Security. Constructor config is scoped per sub-library, each sub-library gets typed errors, Edge Function invocations auto-detect content type, and a new channel() API replaces from().on() for realtime and Postgres change subscriptions. v1 gets security and maintenance patches for three months.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- JavaScript async/await ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- Supabase basics

## Keywords

supabase-js, Supabase, Row Level Security, Edge Functions, gotrue-js, postgrest-js, realtime-js

## Related posts

- [Introducing @supabase/server](https://swe.quest/articles/introducing-supabase-server-014f7e505754650d.md): Supabase · 2026-05-06 · Medium · 8 min read · Identity & auth, Serverless, TypeScript, Developer tools
  @supabase/server, now in public beta, replaces the repeated setup code found across 25,000 analyzed Edge Functions: client creation, JWT verification, claims parsing, CORS and auth wiring.
- [Supabase Auth: SSO, Mobile, and Server-side support](https://swe.quest/articles/supabase-auth-sso-mobile-and-server-side-support-6a2bc9b0f4a5ef26.md): Supabase · 2023-04-13 · Medium · 7 min read · Identity & auth, PostgreSQL, Multi-tenancy, Mobile
  Supabase Auth adds SAML 2.0 single sign-on, a PKCE authorization flow for server-side rendering and mobile apps, and native Sign in with Apple on iOS.
- [Supabase Middleware: composable, reusable middleware for Web Fetch handlers](https://swe.quest/articles/supabase-middleware-composable-reusable-middleware-for-web-fetch-handlers-136b7931628c402b.md): Supabase · 2026-10-15 · Medium · 8 min read · TypeScript, Serverless, Identity & auth, API design, AI agents
  \`@supabase/middleware\` is an MIT-licensed, type-safe middleware engine for Web Fetch handlers.
- [Supabase is now compatible with Next.js 14](https://swe.quest/articles/supabase-is-now-compatible-with-next-js-14-76a3d4ceac89740e.md): Supabase · 2023-11-01 · Medium · 4 min read · React, Frontend, Identity & auth, JavaScript
  Supabase works across every Next.js 14 rendering context, including App Router Client and Server Components, Route Handlers, Server Actions and Middleware, plus the Pages Router data-fetching functions.
- [Supabase CLI v1 and Management API Beta](https://swe.quest/articles/supabase-cli-v1-and-management-api-beta-40e0f641270aa760.md): Supabase · 2022-08-15 · Medium · 4 min read · Schema migrations, Developer tools, PostgreSQL, CI/CD, API design
  Supabase CLI v1 leaves beta with commands to manage organizations, projects and Edge Functions, plus database migration tooling, CI/CD workflows and TypeScript type generation.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
