Using Supabase with Bolt to add a database, authentication, or edge functions to your app.
If you’re new to setting up databases and authentication, check out the New to … sections: New to databases, New to authentication, and New to edge functions.
Bolt by default connects to Supabase for database service, authentication method, and edge functions.
Supabase provides:
Explore Supabase’s website and documentation for full details of Supabase’s features.
With your Bolt project open:
If you tell Bolt to add authentication with Supabase, users will be able to sign up for your application and log in using Supabase’s user management service.
Make sure you’ve connected your Supabase account as described above. Prompt Bolt to add authentication with Supabase, including adding a signup and login screen to you application.
Once everything is working in your application, you can confirm users are being added correctly in Supabase:
Edge functions in Bolt rely on Supabase. Before you begin, make sure you have connected your Supabase account as described above. To get started, prompt Bolt to create the edge function you are interested in. For example: Create an edge function to handle a conversation with an AI Bot (OpenAI)
. From here, Bolt generates the edge function.
Edge functions can be complex, as they connect up services and involve authentication steps. For help with common errors, check out Integrations issues | Supabase edge functions.
A database stores and organizes all the information your app needs to remember. Databases store things like user information, settings, preferences, user activity (such as purchase history), and so on.
Traditionally, setting up databases is a complex task: you need to manage the database server, set up backups, keep it secure, and handle scaling as the amount of data grows.
Supabase simplifies this by handling a lot of the management tasks for you, including: instant automatic setup, server management, automatic backups, and automatic scaling. Supabase also provides a visual interface for you to explore and configure your database.
Allowing users to log in to your application, and protecting their data, is a common requirement. This topic can get very complicated: there are many types of authentication available, and a lot of security concerns to think about.
Supabase makes a lot of this easier: you can set up a basic signup and login process by connecting your Supabase account and prompting Bolt to do the setup. You can then add other types of authentication, such as social login.
When thinking about access to your application, it’s helpful to be aware of two key concepts:
Supabase can help with both: their authentication service handles login (authentication), and features like row level security allow you to control what data your users can access and what they can change.
It’s a good idea to explore Supabase’s documentation, and read up on best practices, to make sure you’re protecting user data.
Unlike databases and authentication, you may not have even heard the term “edge functions” before.
In simplified terms: edge functions are small pieces of code that run automatically when something happens in your application. They’re called “edge” functions because they run on servers positioned at the “edge” of the internet, meaning they’re geographically close to wherever your users are located.
When you build an application in Bolt, most of it runs in the user’s web browser. But sometimes you need things to happen behind the scenes that the user can’t see or control. That’s where edge functions come in.
Example use cases for edge functions:
Edge functions have a couple of key benefits: