Storage Setup and Configuration

Set up a file system for your project in the Oracle Backend with Supabase APIs Console. Choose BASE storage to store file content in the project database, or link an Oracle Cloud Infrastructure (OCI) Object Storage bucket. Then use Oracle Deep Data Security (DDS) Data Grants to authorize storage operations.

Enabling Storage in the Console

In the Oracle Backend with Supabase APIs Console, select a project and then select Storage. Click Set up file system to choose where the project stores files.

Description of the illustration storage-console-setup-button.png

The setup panel offers two options. Create base file system stores file content in the project database. Link to OCI Object Storage connects an existing OCI bucket and stores file content there. Both options use a bucket name to identify the file system.

Using BASE Storage

BASE storage keeps uploaded files in the project’s database. To use it, create a file system in the Console and give its bucket a name.

Create a BASE File System in the Console

To create a BASE file system for the selected project, follow these steps:

  1. In the project navigation, select Storage.

  2. Click Set up file system.

  3. In the setup panel, select Create base file system.

  4. In Bucket name, enter a name for the file system, such as app-files.

    Description of the illustration storage-console-base-setup.png

  5. Click Save.

Using OCI Object Storage

OCI Object Storage keeps files in a bucket that you already created in OCI. Link that bucket to the project by entering its connection details in the Oracle Backend with Supabase APIs Console.

Before linking the bucket, collect the connection values from OCI:

Create a Bucket in the OCI Console

Create an OCI Object Storage bucket before linking it to your project. To create the bucket, follow these steps:

  1. In the OCI Console, open Storage > Buckets.

    Description of the illustration oci-buckets-navigation.png

  2. Select the compartment where you want to create the bucket.

  3. Click Create bucket.

  4. In Bucket name, enter a name. Review the storage tier and other settings for your application.

    Description of the illustration oci-create-bucket-form.png

  5. Click Create.

For details about the available bucket settings, see Creating an Object Storage Bucket.

Link an OCI Object Storage Bucket in the Console

To link an OCI Object Storage bucket, have its namespace, bucket name, region, user OCID, tenancy OCID, API key fingerprint, and private key ready. Then follow these steps:

  1. In the project navigation, select Storage.

  2. Click Set up file system.

  3. In the setup panel, select Link to OCI Object Storage.

  4. Enter the values in Namespace, User OCID, Tenancy OCID, Fingerprint, Private key, Bucket name, and Region.

    Description of the illustration storage-console-oci-setup.png

  5. Click Save.

Storage Access Control with DDS

Oracle Deep Data Security (DDS) uses Data Grants to control who can read, upload, and delete stored files. A grant names the allowed database operations on BAAS_STORAGE_OBJECTS and the Data Roles that receive access. Conditions can restrict file paths, content types, and request operations. Configure grants that match both the operations and path your app uses before you run the upload and download quickstart.

For grant syntax and the project’s default roles, see Creating a Data Grant and Default Data Roles.

Authenticated and Unauthenticated Access

To let both anonymous and signed-in users read image files in public/images/, grant SELECT to the default unauthenticated and authenticated Data Roles. The grant makes these files readable to both groups; the path name alone does not:

CREATE OR REPLACE DATA GRANT "public image file reads" AS
SELECT
ON BAAS_STORAGE_OBJECTS
WHERE object_name LIKE 'public/images/%'
AND content_type LIKE 'image/%'
TO BAAS_USER$NOAUTH_ROLE, BAAS_USER$AUTHENTICATED_ROLE;

In this example, BAAS_USER$NOAUTH_ROLE applies to unauthenticated requests, and BAAS_USER$AUTHENTICATED_ROLE applies to signed-in users. Use the role names created for your project’s schema.

Controlling Access by File Path and Metadata

To restrict a grant by file path or type, add WHERE conditions on object_name and content_type. The public-read example uses object_name LIKE 'public/images/%' to limit access to that path and content_type LIKE 'image/%' to match images.

For folder-level checks, use a path-prefix condition such as object_name LIKE 'uploads/%'. The Storage File Paths and Metadata example matches the uploads folder, an image/% content type, and a single-file upload.

To distinguish storage requests that need different permissions, test ORA_END_USER_CONTEXT.BAASSYS.EU_CONTEXT.request.operation in the grant. Values include put, create-signed-url, and create-upload-signed-url.

Granting Access to Storage Operations

Match the Data Grant’s database operations to the action your app performs:

Creating a signed upload URL and uploading with its token are separate requests. Test both with the Data Role your app uses. For an example, see Upload with a Signed URL.

Setting Up Storage Using CLI

Use the fusabase CLI to configure BASE storage for a RELATIONAL project. Before you begin, configure the CLI and select your project.

To configure BASE storage, follow these steps:

  1. Run:

    fusabase set-objs
  2. At the storage type prompt, select base.

  3. Enter a bucket name for the project, such as app-files.

  4. To check the project’s reported storage type, run:

    fusabase list-projects

    In the row for your project, confirm that Objs Type is base.

To supply the values from a file instead, save this JSON as storage-config.json:

{
  "objs_type": "base",
  "bucket_name": "app-files"
}

Replace app-files with the bucket name you want to use. For the selected project, run:

fusabase set-objs --path=storage-config.json

To upload and download files, see Upload and Download Your First File. To link an OCI Object Storage bucket, use Link an OCI Object Storage Bucket in the Console.