gist.ly

Why I Might Not Use Superbase Anymore

11/7/2024Updated 7/19/2025

Excerpt

Discover the challenges of using Superbase for web development, from writing complex Postgres SQL to the struggle of managing TypeScript and Postgres syntax. Explore alternative solutions to improve team workflow and code readability. ... One of the primary challenges with Supabase arises when integrating it deeply into TypeScript projects. My initial attraction to Supabase was its seamless client-library integration for straightforward operations. For example, inserting a record using the Supabase client in TypeScript is quite intuitive: ``` const { data, error } = await supabase .from('table') .insert([{ column: 'value' }]); ``` This snippet demonstrates a simple insert operation, which most developers can easily follow. However, complications arise when the requirements go beyond basic CRUD operations. ### The Complexity of Advanced Operations When more complex database interactions are required, such as inserting records into multiple tables within a single function, the limitations become evident. Executing multiple insert operations sequentially can lead to performance bottlenecks due to the necessity of making multiple round trips to the server. To circumvent this, developers often resort to creating RPC (Remote Procedure Call) functions. This necessitates writing Postgres functions, which introduces a new layer of complexity. ### Transitioning Between TypeScript and SQL The need to write SQL within Supabase's environment, often switching from a TypeScript editor to Supabase Studio, disrupts the development workflow. The following example illustrates how an RPC function must be created in SQL, not TypeScript: ``` CREATE OR REPLACE FUNCTION insert_into_multiple_tables() RETURNS void LANGUAGE plpgsql AS $$ BEGIN INSERT INTO table1 (column) VALUES ('value1'); INSERT INTO table2 (column) VALUES ('value2'); END; $$; ``` This function resides outside the main codebase, making it harder to trace the full application logic, especially when working within a team. The transition between TypeScript and SQL creates a fragmented development process, complicating debugging and maintenance. ### Team Workflow and Readability Issues Working within a team exacerbates these issues. Team members are not only required to be proficient in TypeScript but also in SQL, particularly the specialized SQL dialect used by Postgres. This dual knowledge requirement can be a significant obstacle for teams whose primary expertise lies in TypeScript. The implementation details of database interactions become obscured, residing in the depths of SQL functions rather than in the more familiar TypeScript codebase. This lack of transparency can lead to confusion and inefficiencies. ### Effective Use of Policies Another pain point is managing row-level security policies. Understanding whether an insert operation complies with these policies often requires diving into the Supabase dashboard, which can distance developers from the core TypeScript code. Managing these policies via the dashboard is not as intuitive as having them within the main codebase, thus complicating access control management. ### The Search for Alternatives Given these challenges, some developers resort to using two client libraries, one for basic operations and another for more complex transaction management. Libraries like Drizzle or Kysely offer alternatives, albeit at the cost of increasing the project’s complexity by including multiple libraries. ### Reflections on Supabase Despite these challenges, I initially enjoyed the learning curve associated with writing raw SQL queries and delving into Postgres’ capabilities. This experience has been enriching; however, it is not sustainable for a team environment. The tool's steep learning curve for new team members and the fragmented workflow have overshadowed the benefits. … ### Conclusion While Supabase offers a robust platform with significant capabilities, its current implementation poses challenges that cannot be overlooked, particularly in team settings. The necessity to jump between TypeScript and SQL environments, along with the additional management of security policies and RPC functions, can disrupt the development workflow and obscure the codebase's transparency. These issues have led me to reconsider my use of Supabase, seeking alternative solutions that better align with my development philosophy and team dynamics.

Source URL

https://gist.ly/youtube-summarizer/why-i-might-not-use-superbase-anymore

Related Pain Points