Deploy Supabase Backend Service
Learn how to configure Supabase backend service
Why Choose Supabase Cloud Functions?
Using Supabase Cloud Functions as a middleware layer for AI services has the following significant advantages:
Cost Savings
No additional server maintenance costs, pay-as-you-go model
API Security
API Keys are securely stored on the server side, avoiding client-side packet capture risks
User Management
Easy access to user information, facilitating permission control and data management
Introduction
The EasyAppSupabase template, as the backend/server-side template for EasyAppSwiftUI, has already integrated Supabase Cloud Functions. This guide will show you how to integrate, develop, test, and deploy Edge Functions in your EasyAppSupabase project.
The Supabase Cloud Functions project is located in the EasyAppSupabase repository.
Similarly, you can follow the EasyAppSwiftUI approach to download the project. First fork the repository, then clone the project to your computer.
This template provides very convenient deployment features, database migration features, and Edge Function development, testing, and deployment features.
Project Structure
The EasyAppSupabase project is already configured with Supabase and has the following structure:
EasyApp has built-in all the required tables, storage buckets, and APIs for the EasyAppSwiftUI App. You can directly execute the following command to deploy to production. Before that, you need to install Supabase CLI.
cd EasyAppSupabase
npm run deploy1. Environment Setup
Install Supabase CLI
We recommend using Supabase CLI to manage Supabase services.
npm install supabase --save-devFor more Supabase CLI usage, please refer to Supabase CLI documentation.
Verify Installation
npx supabase --versionLogin to Supabase
npx supabase loginPlease follow the prompts during the login process.
View Project List
npx supabase projects listConnect to Project
npx supabase link --project-ref YOUR_PROJECT_IDYOUR_PROJECT_ID is your project ID on the Supabase Dashboard, which can be found here

If you are not familiar with Supabase Cloud Functions, we strongly recommend deploying directly to production and testing in the online environment. This way you can avoid the complexity of local development and test directly in production.
2. Deploy to Production (Recommended)
- Automatic Deployment (Recommended)
In EasyAppSupabase, we have built-in deployment scripts. You just need to execute the following command to deploy the Supabase template features to production.
cd EasyAppSupabase
npm run deploynpm run deploy will automatically deploy all Edge Functions and database to production.
We also provide other deployment commands you can refer to:
"migrate": "supabase db push", // Migrate database
"functions:deploy": "supabase functions deploy", // Deploy functions
"functions:logs": "supabase functions logs", // View function logs
"start": "supabase start", // Start local service (if not started)
"stop": "supabase stop", // Stop local service
"reset": "supabase db reset", // Reset database
"status": "supabase status" // View service statusWhenever you modify tables or database, you need to execute the following command to migrate the database.
npm run migrateWhenever you modify/add Edge Functions, you need to execute the following command to deploy functions.
npm run functions:deployOr you can directly execute npm run deploy to deploy both the database and functions at the same time.
After successful deployment, you also need to add environment variables in Edge Functions.

How to obtain them, see below:
- Get Supabase URL. Click the "Connect" button in the top navigation bar. In the popup, select Mobile Framework, select Swift in Framework. Copy supabaseURL.


- Get Supabase API key. Click the "Project Settings" button in the sidebar, click the "API Keys" button. Click the "Copy" button.
Copy service_role.

After obtaining url and service_role, fill in the corresponding SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY.
At this point, you have started the backend service in your Supabase project. You don't need to read the following content. Next, we need to configure Apple login and user registration/login process.
Last updated on