@supabase/supabase-js vs firebase vs aws-amplify vs parse-server
后端即服务 (BaaS) 解决方案
@supabase/supabase-jsfirebaseaws-amplifyparse-server类似的npm包:

后端即服务 (BaaS) 解决方案

后端即服务 (BaaS) 解决方案为开发者提供了构建和管理应用程序后端所需的工具和服务。这些库简化了数据存储、身份验证、实时功能和其他后端服务的实现,使开发者能够专注于前端开发和用户体验,而无需担心后端基础设施的复杂性。通过使用这些库,开发者可以快速构建和扩展应用程序,同时利用云服务的优势。

npm下载趋势

3 年

GitHub Stars 排名

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
@supabase/supabase-js14,135,4164,338387 kB16810 天前MIT
firebase5,595,3505,08331.1 MB8099 天前Apache-2.0
aws-amplify1,268,2849,591170 kB4771 个月前Apache-2.0
parse-server42,37821,3855.72 MB4741 天前Apache-2.0

功能对比: @supabase/supabase-js vs firebase vs aws-amplify vs parse-server

实时功能

  • @supabase/supabase-js:

    Supabase 提供内置的实时功能,允许开发者轻松实现实时数据更新和订阅。通过 WebSocket,应用程序可以即时接收数据更改,提升用户体验。

  • firebase:

    Firebase 的实时数据库和 Firestore 提供强大的实时数据同步功能,使得应用程序能够在多个客户端之间即时更新数据,适合需要实时交互的应用。

  • aws-amplify:

    AWS Amplify 支持 GraphQL 订阅,允许开发者实现实时数据更新,但需要更多的配置和理解 GraphQL 的工作原理。

  • parse-server:

    Parse Server 本身不提供内置的实时功能,但可以通过 WebSocket 或其他第三方服务实现。这需要额外的开发工作。

数据存储

  • @supabase/supabase-js:

    Supabase 使用 PostgreSQL 作为其数据库,提供强大的关系型数据存储能力,支持复杂查询和事务处理。

  • firebase:

    Firebase 提供两种数据存储选项:实时数据库和 Firestore,前者适合简单的 JSON 数据存储,后者则支持更复杂的数据结构和查询。

  • aws-amplify:

    AWS Amplify 支持多种数据存储选项,包括 DynamoDB 和 Aurora,适合需要高可扩展性的应用。

  • parse-server:

    Parse Server 提供灵活的数据模型,支持关系型和非关系型数据存储,适合需要自定义数据结构的应用。

身份验证

  • @supabase/supabase-js:

    Supabase 提供简单易用的身份验证功能,支持邮箱、社交登录等多种方式,开发者可以快速集成用户管理。

  • firebase:

    Firebase 提供简单的身份验证功能,支持多种登录方式,包括邮箱、Google、Facebook 等,适合快速开发。

  • aws-amplify:

    AWS Amplify 提供全面的身份验证解决方案,支持多种身份提供者(如 Cognito),适合需要复杂身份管理的应用。

  • parse-server:

    Parse Server 提供灵活的身份验证机制,支持自定义用户登录和社交登录,但需要更多的配置和开发工作。

学习曲线

  • @supabase/supabase-js:

    Supabase 的学习曲线相对较平缓,开发者可以快速上手,尤其是熟悉 SQL 的开发者。

  • firebase:

    Firebase 的学习曲线较平缓,提供了丰富的文档和示例,适合初学者和快速开发。

  • aws-amplify:

    AWS Amplify 的学习曲线较陡,尤其是对于不熟悉 AWS 生态系统的开发者,理解其服务和配置可能需要时间。

  • parse-server:

    Parse Server 的学习曲线适中,开发者需要理解其数据模型和 API,但提供了灵活性和自定义能力。

社区支持

  • @supabase/supabase-js:

    Supabase 拥有快速增长的社区和文档,提供了大量的示例和支持,适合初学者。

  • firebase:

    Firebase 拥有庞大的用户基础和活跃的社区,提供了丰富的资源和支持,适合初创企业和开发者。

  • aws-amplify:

    AWS Amplify 拥有强大的社区支持和丰富的文档,适合企业级开发者。

  • parse-server:

    Parse Server 作为开源项目,社区支持相对较小,但仍然有一些活跃的开发者和资源可供参考。

如何选择: @supabase/supabase-js vs firebase vs aws-amplify vs parse-server

  • @supabase/supabase-js:

    选择 Supabase 如果您需要一个开源的后端解决方案,支持 PostgreSQL 数据库,并且希望利用实时功能和简单的 RESTful API。它适合快速开发和原型设计。

  • firebase:

    选择 Firebase 如果您需要快速开发移动和 Web 应用,特别是需要实时数据库和简单的身份验证功能。Firebase 提供了丰富的功能和强大的社区支持,非常适合初创企业和小型项目。

  • aws-amplify:

    选择 AWS Amplify 如果您希望与 AWS 生态系统紧密集成,利用其强大的云服务和功能,如存储、身份验证和分析。它适合需要高可扩展性和企业级功能的应用。

  • parse-server:

    选择 Parse Server 如果您希望使用开源解决方案并能够自托管,Parse 提供了灵活的 API 和强大的数据管理功能,适合需要自定义后端逻辑的开发者。

@supabase/supabase-js的README


Supabase Logo

Supabase JS SDK

Isomorphic JavaScript SDK for Supabase - combining Auth, Database, Storage, Functions, and Realtime.

Guides · Reference Docs · TypeDoc

Build Package License: MIT pkg.pr.new

Usage

First of all, you need to install the library:

npm install @supabase/supabase-js

Then you're able to import the library and establish the connection with the database:

import { createClient } from '@supabase/supabase-js'

// Create a single supabase client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

UMD

You can use plain <script>s to import supabase-js from CDNs, like:

<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>

or even:

<script src="https://unpkg.com/@supabase/supabase-js@2"></script>

Then you can use it from a global supabase variable:

<script>
  const { createClient } = supabase
  const _supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

  console.log('Supabase Instance: ', _supabase)
  // ...
</script>

ESM

You can use <script type="module"> to import supabase-js from CDNs, like:

<script type="module">
  import { createClient } from 'https://cdn.jsdelivr.net/npm/@supabase/supabase-js/+esm'
  const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')

  console.log('Supabase Instance: ', supabase)
  // ...
</script>

Deno

You can use supabase-js in the Deno runtime via JSR:

import { createClient } from 'jsr:@supabase/supabase-js@2'

Custom fetch implementation

supabase-js uses the cross-fetch library to make HTTP requests, but an alternative fetch implementation can be provided as an option. This is most useful in environments where cross-fetch is not compatible, for instance Cloudflare Workers:

import { createClient } from '@supabase/supabase-js'

// Provide a custom `fetch` implementation as an option
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {
  global: {
    fetch: (...args) => fetch(...args),
  },
})

Support Policy

This section outlines the scope of support for various runtime environments in Supabase JavaScript client.

Node.js

We only support Node.js versions that are in Active LTS or Maintenance status as defined by the official Node.js release schedule. This means we support versions that are currently receiving long-term support and critical bug fixes.

When a Node.js version reaches end-of-life and is no longer in Active LTS or Maintenance status, Supabase will drop it in a minor release, and this won't be considered a breaking change.

⚠️ Node.js 18 Deprecation Notice

Node.js 18 reached end-of-life on April 30, 2025. As announced in our deprecation notice, support for Node.js 18 was dropped in version 2.79.0.

If you must use Node.js 18, please use version 2.78.0, which is the last version that supported Node.js 18.

Deno

We support Deno versions that are currently receiving active development and security updates. We follow the official Deno release schedule and only support versions from the stable and lts release channels.

When a Deno version reaches end-of-life and is no longer receiving security updates, Supabase will drop it in a minor release, and this won't be considered a breaking change.

Browsers

All modern browsers are supported. We support browsers that provide native fetch API. For Realtime features, browsers must also support native WebSocket API.

Bun

We support Bun runtime environments. Bun provides native fetch support and is compatible with Node.js APIs. Since Bun does not follow a structured release schedule like Node.js or Deno, we support current stable versions of Bun and may drop support for older versions in minor releases without considering it a breaking change.

React Native

We support React Native environments with fetch polyfills provided by the framework. Since React Native does not follow a structured release schedule, we support current stable versions and may drop support for older versions in minor releases without considering it a breaking change.

Cloudflare Workers

We support Cloudflare Workers runtime environments. Cloudflare Workers provides native fetch support. Since Cloudflare Workers does not follow a structured release schedule, we support current stable versions and may drop support for older versions in minor releases without considering it a breaking change.

Important Notes

  • Experimental features: Features marked as experimental may be removed or changed without notice

Known Build Warnings

UNUSED_EXTERNAL_IMPORT in Vite / Rollup / Nuxt

When bundling your app, you may see warnings like:

"PostgrestError" is imported from external module "@supabase/postgrest-js" but never used in "...supabase-js/dist/index.mjs".
"FunctionRegion", "FunctionsError", "FunctionsFetchError", "FunctionsHttpError" and "FunctionsRelayError" are imported from external module "@supabase/functions-js" but never used in "...".

This is a false positive — your bundle is fine. Here is why it happens:

@supabase/supabase-js re-exports PostgrestError, FunctionsError, and related symbols so you can import them directly from @supabase/supabase-js. However, our build tool merges all imports from the same package into a single import statement in the built output:

// dist/index.mjs (simplified)
import { PostgrestClient, PostgrestError } from '@supabase/postgrest-js'
//       ^ used internally    ^ re-exported for you

Your bundler checks which names from that import are used in the code body, and flags PostgrestError as unused because it only appears in an export statement — not called or assigned. The export itself is the usage, but downstream bundlers don't track this correctly. This is a known Rollup/Vite limitation with re-exported external imports.

Nothing is broken. Tree-shaking and bundle size are unaffected.

To suppress the warning:

Vite / Rollup (vite.config.js or rollup.config.js):

export default {
  build: {
    rollupOptions: {
      onwarn(warning, warn) {
        if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/'))
          return
        warn(warning)
      },
    },
  },
}

Nuxt (nuxt.config.ts):

export default defineNuxtConfig({
  vite: {
    build: {
      rollupOptions: {
        onwarn(warning, warn) {
          if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/'))
            return
          warn(warning)
        },
      },
    },
  },
})

Contributing

We welcome contributions! Please see our Contributing Guide for details on how to get started.

For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.

Building

# From the monorepo root
npx nx build supabase-js

# Or with watch mode for development
npx nx build supabase-js --watch

Testing

There's a complete guide on how to set up your environment for running locally the supabase-js integration tests. Please refer to TESTING.md.

Badges

Coverage Status