Supabase self host
Supabase is a Backend-as-a-Service (BaaS) platform that is almost entirely open source, which provides flexibility for developers. While their hosted service is what most people use, you have the freedom to self-host the entire stack. This open-source nature is a key differentiator when comparing it to other solutions like a custom stack with Hasura.
What is Open Source in Supabase?
The vast majority of Supabase is open source. The platform is not a single monolith but a collection of integrated open-source tools. Supabase's core principle is to build on and support existing open-source projects rather than creating proprietary software from scratch.
The main components that are open source are:
- PostgreSQL: The database itself is a completely open-source project. Supabase uses a standard, un-forked version of Postgres.
- PostgREST: This is the engine that instantly turns your PostgreSQL database into a RESTful API. It is an open-source tool written in Haskell.
- GoTrue: The user authentication service that handles sign-ups, logins, and JWTs. It's an open-source project written in Go.
- Realtime: The WebSocket server that provides real-time data sync. This is a separate open-source project written in Elixir.
- Studio: The Supabase Dashboard, which is the user interface for managing your database and services, is an open-source project written in TypeScript.
- Storage: An S3-compatible object storage service, which is also an open-source project.
- Supavisor: A cloud-native connection pooler for Postgres, also open source.
The only parts that are not open source are the specific integrations and services that connect these components in the hosted platform, such as the internal monitoring, billing, and cloud infrastructure management. However, the core developer-facing tools are all available to the public.
Self-Hosting the Supabase Stack
Yes, you can self-host the entire Supabase stack using Docker Compose or other containerization tools. The open-source nature of all the core components makes this possible. However, there's a distinction between self-hosting and using the managed features of the hosted platform.
Self-Hosting: Pros & Cons
- Pros: Complete control over your data, infrastructure, and security. No vendor lock-in. You can customize every part of the stack. It can be more cost-effective at a very large scale if you have the DevOps expertise.
- Cons: You lose the benefits of the managed service. You are responsible for all maintenance, including backups, security patches, database upgrades, and scaling. The self-hosted dashboard may also lack some of the advanced features and polished UI of the hosted version, especially for configuration and monitoring. This can be a significant time commitment for a small team or an individual developer.
Essentially, by self-hosting, you get the open-source software, but you trade the convenience of a fully managed platform for complete control.
Supabase vs. Custom Postgres + Hasura
Choosing between Supabase and a custom stack (e.g., PostgreSQL on DigitalOcean/AWS + Hasura) comes down to a trade-off between convenience and control.
Feature | Supabase (Managed) | Custom Stack (Postgres + Hasura) |
---|---|---|
Setup & Integration | All-in-one platform. All services (DB, Auth, Storage, APIs) are pre-configured and work out of the box with one account. You get an instant API as soon as you create a table. | Manual setup. You need to provision a database, configure Hasura to connect to it, and then set up a separate auth service (e.g., Auth0) and storage (e.g., S3) and manually integrate them. |
API | SQL-centric. Provides a RESTful API via PostgREST and a GraphQL API via pg_graphql which are both tightly coupled to the underlying Postgres. You can write custom logic in SQL functions. | GraphQL-centric. Hasura's primary focus is to give you a powerful GraphQL API on top of your database. While it's great for complex queries, the initial setup can be more involved. |
Authentication | Built-in. The authentication service (GoTrue) is deeply integrated with PostgreSQL's Row-Level Security (RLS), making it a seamless security layer. | External. You must integrate an external auth provider (e.g., Clerk, Auth0) and configure Hasura's permission system to work with the JWTs from that provider. This adds an extra layer of complexity. |
Vendor Lock-in | Minimal. The use of open-source tools means you can export your schema and data and self-host or migrate elsewhere. | Minimal. You own the database and can switch to a different GraphQL layer or a custom backend at any time. The challenge is the time and effort required to set it all up initially. |
Pricing & Cost | Predictable. The pricing is a flat fee based on project size, compute, and usage tiers, making it easier to budget. | Variable. Costs can be more complex, as you're paying for multiple services (DB, server, storage) with separate billing, which may become cheaper at a very large scale if you have the expertise to optimize it. |
In summary: Supabase is a fantastic choice for developers who want a single, cohesive platform that provides everything they need to get started quickly, without sacrificing the power of a real SQL database. The managed services and tight integrations save a huge amount of time. The custom stack with Hasura is for teams that want more granular control over each part of their infrastructure and are willing to handle the manual setup and maintenance for the sake of a highly customized and potentially cheaper solution at a massive scale.