Vali-Blob.Supabase 1.0.0

dotnet add package Vali-Blob.Supabase --version 1.0.0
                    
NuGet\Install-Package Vali-Blob.Supabase -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Vali-Blob.Supabase" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vali-Blob.Supabase" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Vali-Blob.Supabase" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Vali-Blob.Supabase --version 1.0.0
                    
#r "nuget: Vali-Blob.Supabase, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Vali-Blob.Supabase@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Vali-Blob.Supabase&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Vali-Blob.Supabase&version=1.0.0
                    
Install as a Cake Tool

Vali-Blob.Supabase

NuGet License: MIT .NET

Supabase Storage provider for Vali-Blob — the unified cloud storage abstraction library for .NET.

Implements IStorageProvider over the Supabase Storage REST API with signed URL generation, resumable uploads via the TUS protocol, public and private bucket support, and seamless DI registration.


Compatibility

Target Framework Supported
netstandard2.0 Yes
netstandard2.1 Yes
net6.0 Yes
net7.0 Yes
net8.0 Yes
net9.0 Yes

Installation

dotnet add package ValiBlob.Core
dotnet add package ValiBlob.Supabase

Configuration

{
  "ValiBlob": {
    "DefaultProvider": "Supabase"
  },
  "ValiBlob:Supabase": {
    "Url":    "https://your-project-ref.supabase.co",
    "ApiKey": "",
    "Bucket": "my-bucket"
  }
}

Security: Never commit ApiKey to source control. Use environment variables or a secrets manager. Use the service_role key for server-side operations with full access. For user-facing operations, use a scoped anon key with Row Level Security (RLS) policies configured in Supabase.


Registration

using ValiBlob.Core.DependencyInjection;
using ValiBlob.Supabase.Extensions;

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "Supabase")
    .UseSupabase();

With pipeline

builder.Services
    .AddValiBlob(opts => opts.DefaultProvider = "Supabase")
    .UseSupabase()
    .WithPipeline(p => p
        .UseValidation(v =>
        {
            v.AllowedExtensions = new[] { ".jpg", ".png", ".gif", ".webp" };
            v.MaxFileSizeBytes  = 10 * 1024 * 1024; // 10 MB
        })
    );

Usage

Upload

public class AvatarService(IStorageProvider storage)
{
    public async Task<string> UploadAvatarAsync(Stream image, string userId, string extension)
    {
        var result = await storage.UploadAsync(new UploadRequest
        {
            Path        = StoragePath.From("avatars", $"{userId}{extension}"),
            Content     = image,
            ContentType = "image/jpeg"
        });

        if (!result.IsSuccess)
            throw new Exception(result.ErrorMessage);

        return result.Value!.Url;
    }
}

Download

var result = await storage.DownloadAsync(new DownloadRequest
{
    Path = StoragePath.From("avatars", "user-123.jpg")
});

if (result.IsSuccess)
    await result.Value!.CopyToAsync(Response.Body);

Public bucket URL

For objects in a public bucket, the URL is returned directly in the upload result:

var result = await storage.UploadAsync(request);
var publicUrl = result.Value!.Url;
// → "https://your-project.supabase.co/storage/v1/object/public/avatars/user-123.jpg"

Signed URL (private bucket)

var url = await storage.GetPresignedDownloadUrlAsync(new PresignedUrlRequest
{
    Path      = StoragePath.From("private-docs", "contract.pdf"),
    ExpiresIn = TimeSpan.FromHours(1)
});

return Redirect(url.Value!);

Resumable upload (TUS protocol)

Supabase Storage implements the TUS resumable upload protocol. Use this for large files — the upload can be paused and resumed after network interruptions:

public class UploadService(IResumableUploadProvider resumable)
{
    public async Task UploadVideoAsync(Stream content, string fileName, long totalSize)
    {
        // Start session — returns a TUS upload URL
        var session = await resumable.StartUploadAsync(new ResumableUploadRequest
        {
            FileName    = fileName,
            ContentType = "video/mp4",
            TotalSize   = totalSize
        });

        // Upload in chunks (e.g. 6 MB each — Supabase default chunk size)
        var buffer = new byte[6 * 1024 * 1024];
        int chunkIndex = 0, read;

        while ((read = await content.ReadAsync(buffer)) > 0)
        {
            await resumable.UploadChunkAsync(new ResumableChunkRequest
            {
                SessionId  = session.SessionId,
                ChunkIndex = chunkIndex++,
                Data       = new MemoryStream(buffer, 0, read)
            });
        }

        await resumable.CompleteUploadAsync(session.SessionId);
    }
}

Features

Feature Supported
Upload / Download / Delete / List Yes
Exists check Yes
Copy / Move Yes
Public bucket URLs Yes
Signed download URL Yes
Resumable uploads (TUS protocol) Yes
BucketOverride per request Yes
RLS / scoped API key support Yes
Polly retry resilience Yes

Options reference

Property Default Description
Url — Supabase project URL (required)
ApiKey — Supabase API key (service_role or anon)
Bucket — Default storage bucket name
SignedUrlExpirySeconds 3600 Default signed URL expiry in seconds

Documentation



Donations

If Vali-Blob is useful to you, consider supporting its development:


License

MIT License

Contributions

Issues and pull requests are welcome on GitHub.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 318 3/21/2026