架构
Supabase 是开源的。我们选择可扩展的开源工具,并让它们更容易上手。
🌐 Supabase is open source. We choose open source tools which are scalable and make them approachable.
Supabase 并不是 Firebase 的一对一对应。虽然我们正在构建许多 Firebase 提供的功能,但我们的做法并不相同:我们的技术选择有很大不同;我们使用的一切都是开源的;并且在可能的情况下,我们会使用并支持现有工具,而不是从零开发。
🌐 Supabase is not a 1-to-1 mapping of Firebase. While we are building many of the features that Firebase offers, we are not going about it the same way: our technological choices are quite different; everything we use is open source; and wherever possible, we use and support existing tools rather than developing from scratch.
最值得注意的是,我们使用的是 Postgres,而不是 NoSQL 存储。这是经过深思熟虑的选择。我们认为,没有其他数据库能够在提供与 Firebase 竞争所需功能的同时,还保持超越它所需的可扩展性。
🌐 Most notably, we use Postgres rather than a NoSQL store. This choice was deliberate. We believe that no other database offers the functionality required to compete with Firebase, while maintaining the scalability required to go beyond it.
选择你的舒适度 #
🌐 Choose your comfort level
我们在 Supabase 的目标是让 所有 的 Postgres 都易于使用。这并不意味着你必须全部使用它。如果你是 Postgres 老手,你可能会喜欢我们提供的工具。如果你以前从未使用过 Postgres,那就先从小做起,然后逐渐深入。如果你只想把 Postgres 当作一个基础的表存储,那也完全没问题。
🌐 Our goal at Supabase is to make all of Postgres easy to use. That doesn’t mean you have to use all of it. If you’re a Postgres veteran, you’ll probably love the tools that we offer. If you’ve never used Postgres before, then start smaller and grow into it. If you want to treat Postgres like a basic table-store, that’s perfectly fine.
架构 #
🌐 Architecture
每个 Supabase 项目都包含几个工具:
🌐 Each Supabase project consists of several tools:
Postgres(数据库) #
🌐 Postgres (database)
Postgres 是 Supabase 的核心。我们不会对 Postgres 数据库做抽象——你可以完全访问它并使用所有权限。我们提供的工具让使用 Postgres 就像用 Firebase 一样简单。
🌐 Postgres is the core of Supabase. We do not abstract the Postgres database—you can access it and use it with full privileges. We provide tools which make Postgres as easy to use as Firebase.
- 官方文档:postgresql.org/docs
- 源代码:github.com/postgres/postgres(镜像)
- 许可证:PostgreSQL 许可证 - 语言:C
工作室(仪表板) #
🌐 Studio (dashboard)
一个开源的仪表板,用于管理你的数据库和服务。
🌐 An open source Dashboard for managing your database and services.
- 官方文档:Supabase 文档
- 源代码:github.com/supabase/supabase
- 许可证: Apache 2
- 语言:TypeScript
GoTrue(认证) #
🌐 GoTrue (Auth)
一个基于 JWT 的 API,用于管理用户和发放访问令牌。它可以和 Postgres 的行级安全以及 API 服务器集成。
🌐 A JWT-based API for managing users and issuing access tokens. This integrates with Postgres's Row Level Security and the API servers.
- 官方文档:Supabase Auth 参考文档
- 源代码:github.com/supabase/gotrue
- 许可证:MIT
- 语言:Go
PostgREST(API) #
🌐 PostgREST (API)
一个独立的网页服务器,可以直接将你的 Postgres 数据库变成 RESTful API。我们配合使用 pg_graphql 扩展来提供 GraphQL API。
🌐 A standalone web server that turns your Postgres database directly into a RESTful API.
We use this with our pg_graphql extension to provide a GraphQL API.
- 官方文档:postgrest.org
- 源代码:github.com/PostgREST/postgrest
- 许可证:MIT
- 语言:Haskell
实时(API & 多人游戏) #
🌐 Realtime (API & multiplayer)
一个可扩展的 WebSocket 引擎,用于管理用户在线状态、广播消息和流式传输数据库变更。
🌐 A scalable WebSocket engine for managing user Presence, broadcasting messages, and streaming database changes.
- 官方文档:Supabase Realtime 文档
- 源代码:github.com/supabase/realtime
- 许可证:Apache 2
- 语言:Elixir
存储 API(大文件存储) #
🌐 Storage API (large file storage)
一个兼容 S3 的对象存储服务,它将元数据存储在 Postgres 中。
🌐 An S3-compatible object storage service that stores metadata in Postgres.
- 官方文档:Supabase Storage 参考文档
- 源代码:github.com/supabase/storage-api
- 许可: Apache 2.0
- 语言:Node.js / TypeScript
Deno(边缘函数) #
🌐 Deno (Edge Functions)
一个现代的 JavaScript 和 TypeScript 运行时。
🌐 A modern runtime for JavaScript and TypeScript.
postgres-meta#
🌐 postgres-meta (database management)
一个用于管理你的 Postgres 的 RESTful API。获取表格、添加角色并执行查询。
🌐 A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries.
- 官方文档:supabase.github.io/postgres-meta
- 源代码:github.com/supabase/postgres-meta
- 许可: Apache 2.0
- 语言:Node.js / TypeScript
主管 #
🌐 Supavisor
一个云原生的多租户 Postgres 连接池器。
🌐 A cloud-native, multi-tenant Postgres connection pooler.
- 官方文档:Supavisor GitHub 页面
- 源代码:
supabase/supavisor - 许可: Apache 2.0
- 语言:Elixir
Envoy(API 网关) #
🌐 Envoy (API gateway)
一个云原生的高性能边缘和服务代理。
🌐 A cloud-native, high-performance edge and service proxy.
- 官方文档:envoyproxy.io
- 源代码:github.com/envoyproxy/envoy
- 许可: Apache 2.0
- 语言:C++
产品原则 #
🌐 Product principles
我们的目标是提供一种任何大型公司都会为自己设计的架构,然后围绕这个架构提供一些对独立开发者和小团队易于使用的工具。
🌐 It is our goal to provide an architecture that any large-scale company would design for themselves, and then provide tooling around that architecture that is easy-to-use for indie-developers and small teams.
我们使用一系列原则来确保可扩展性和可用性从不互相排斥:
🌐 We use a series of principles to ensure that scalability and usability are never mutually exclusive:
一切都各自运作 #
🌐 Everything works in isolation
每个系统都必须作为独立工具运行,尽量减少可移动部件。检验标准是:“用户是否只用一个Postgres数据库就能运行这个产品?”
🌐 Each system must work as a standalone tool with as few moving parts as possible. The litmus test for this is: "Can a user run this product with nothing but a Postgres database?"
一切都整合在一起 #
🌐 Everything is integrated
Supabase 是可组合的。尽管每个产品都可以独立工作,但平台上的每个产品都需要让其他产品的价值提升十倍。为了集成,每个工具都应该提供 API 和 Webhooks。
🌐 Supabase is composable. Even though every product works in isolation, each product on the platform needs to 10x the other products. For integration, each tool should expose an API and Webhooks.
一切都是可扩展的 #
🌐 Everything is extensible
我们在新增工具时会很慎重,更倾向于扩展现有的工具。这和许多云服务提供商正好相反,他们的产品会扩展到一些小众的使用场景。我们为开发者提供的是_基础功能_,让他们能够实现任何目标。少而精,更好。
🌐 We're deliberate about adding a new tool, and prefer instead to extend an existing one. This is the opposite of many cloud providers whose product offering expands into niche use-cases. We provide primitives for developers, which allow them to achieve any goal. Less, but better.
一切都是便携的 #
🌐 Everything is portable
为了避免被锁定,我们让迁移进出变得很容易。我们的云服务与自托管产品兼容。我们使用现有标准来提高可移植性(比如 pg_dump 和 CSV 文件)。如果出现了一个新的标准,与“Supabase”方式竞争,我们会放弃这种方式,转而支持标准。这迫使我们在用户体验上竞争。我们的目标是成为最好的 Postgres 托管服务。
🌐 To avoid lock-in, we make it easy to migrate in and out. Our cloud offering is compatible with our self-hosted product.
We use existing standards to increase portability (like pg_dump and CSV files). If a new standard emerges which competes with a "Supabase" approach, we will deprecate the approach in favor of the standard.
This forces us to compete on user experience. We aim to be the best Postgres hosting service.
玩长远的策略 #
🌐 Play the long game
我们会为长期收益牺牲短期的胜利。例如,可能很诱人去运行一个带有额外功能的 Postgres 分支,这些功能只有我们的客户需要。但我们更倾向于支持将缺失功能上游发布的努力,这样整个社区都能受益。这还有一个额外的好处,就是确保可移植性和长期性。
🌐 We sacrifice short-term wins for long-term gains. For example, it is tempting to run a fork of Postgres with additional functionality which only our customers need. Instead, we prefer to support efforts to upstream missing functionality so that the entire community benefits. This has the additional benefit of ensuring portability and longevity.
为开发者打造 #
🌐 Build for developers
“开发者”是一类特定的用户:他们是 构建者。 在评估影响与付出之间的关系时,开发者由于能够构建的产品和系统类型,效率通常很高。 随着开发者的角色随着时间发生变化,Supabase 将持续改进产品以适应这种不断变化的角色。
支持现有工具 #
🌐 Support existing tools
Supabase 尽可能支持现有的工具和社区。Supabase 更像是一个“社区的社区”——每个工具通常都有自己的社区,我们会与之合作。开源是我们以协作方式推进的事情:我们雇佣维护者、赞助项目、投资企业,并开发我们自己的开源工具。
🌐 Supabase supports existing tools and communities wherever possible. Supabase is more like a "community of communities" - each tool typically has its own community which we work with. Open source is something we approach collaboratively: we employ maintainers, sponsor projects, invest in businesses, and develop our own open source tools.