Skip to content

Discussion: extending CloudStorage vs provider-specific APIs for advanced storage capabilities #4848

Closed

Description

@Metaildust

Related context:

  • #4846 adds the first official Tencent COS provider within the current CloudStorage contract.
  • #2229 highlights broader storage support needs for China-region and non-default provider setups.

While working on #4846, I noticed that the current shared CloudStorage abstraction covers the basic cross-provider workflow well:

  • server-side CRUD
  • public URLs
  • direct upload descriptions
  • upload verification
  • basic upload options such as contentLength and preventOverwrite

However, there are still several production-oriented capabilities that are not part of the shared abstraction today, especially for native / non-S3-compatible providers:

  • temporary private download URLs / presigned GET
  • custom Content-Type, metadata, and cache-related headers
  • large-file multipart / streaming-oriented upload support
  • object-management capabilities such as list / copy / move / rename

I am not proposing to expand #4846 itself with all of this. That PR intentionally stays within the current CloudStorage contract so the Tencent COS provider can remain reviewable and aligned with the existing official providers.

What I would like to discuss is what the preferred next step should be.

Option A: extend the shared Serverpod cloud storage abstractions / protocol

This would mean evolving the current shared CloudStorage API and, where needed, the direct-upload description protocol so these higher-level capabilities can become first-class optional features for official providers.

Potential direction:

  • add a shared way to create temporary private download URLs
  • introduce richer upload / object options for content type, metadata, and cache behavior
  • define optional capabilities for larger-file multipart / streaming flows
  • possibly introduce optional object-management APIs later

Pros:

  • gives application developers a more consistent cross-provider API
  • makes advanced providers feel more complete inside Serverpod itself
  • could benefit not only COS, but also native GCP and future provider integrations

Cons:

  • increases the surface area of the shared abstractions
  • requires API design and backward-compatibility care
  • may be too much to add all at once

Option B: keep the shared abstraction small and support these features separately

This would mean leaving the current CloudStorage contract unchanged, and letting providers expose additional capabilities through provider-specific helpers / extension APIs.

This is already close to what I have explored in my community packages:

  • tencent_cos_dart provides the low-level COS signer for presigned URLs, including custom headers and query params
  • serverpod_cos provides session.cosSigner() and an endpoint / helper-based way to generate presigned URLs, including GET
  • my CloudStorage-compatible community package was previously named serverpod_cloud_storage_cos, and has since been renamed to tencent_cos_cloud_storage_serverpod to avoid confusion with the new official package from #4846

Pros:

  • keeps the shared abstraction focused and minimal
  • lets provider-specific features evolve faster
  • lower risk for the core framework

Cons:

  • application code becomes less portable across providers
  • advanced features are discovered through provider-specific APIs rather than a shared Serverpod interface
  • may feel fragmented over time if multiple official providers need similar capabilities

Questions

  1. Which direction would you prefer for future work here:

    • extending the shared CloudStorage abstractions / protocol
    • or keeping the shared contract minimal and adding provider-specific extensions separately?
  2. If the shared direction is preferred, which capability would be the best first candidate?

    • temporary private download URLs / presigned GET seems like the most generally useful one to me
  3. If helpful, I can also share / adapt the approach used in my community packages and see whether that design is reusable here.

I would be happy to continue in whichever direction fits Serverpod best.

Activity

  1. Metaildust commented on Mar 13, 2026

    @Metaildust
    Author
  2. Metaildust commented on Mar 13, 2026

    @Metaildust
    Author

    One additional note from my side: if this direction is worth pursuing, I would start with temporary private download URLs / presigned GET support first.

    That feels like the most generally useful next capability, and it is also the part that is already implemented and widely used in production in my own packages / applications. So if there is interest, I can use that experience as a starting point and adapt it to whichever direction fits Serverpod best.

  3. nielsenko commented on Mar 16, 2026

    @nielsenko
    Collaborator

    I'd say Option A.

    Presigned download URLs are a good first candidate. PR #4806's approach of adding abstract methods to CloudStorage is the wrong mechanism, but aim to address the same need as I see it.

    We should use opt-in mixins on CloudStorage for extended capabilities. The reason being that CloudStorage is intended to be extended and adding new public members is a breaking change.

    Future capabilities (custom content-type/metadata, list objects, etc.) would each get their own mixin. CloudStorageOptions could also grow new fields since it's final (non-breaking addition of named parameters with defaults).

    Consolidating CloudStorage interface class cannot happen until 4.0.

  4. added
    in triage
    on Mar 19, 2026
  5. added
    enhancement
    area: storage
    on Apr 9, 2026
  6. moved this from Inbox 📫 to Backlog 🗂️ in Serverpod Frameworkson Apr 9, 2026
  7. removed
    in triage
    on Jun 11, 2026
  8. moved this from Backlog 🗂️ to Next Up 🎯 in Serverpod Frameworkson Aug 7, 2026
  9. self-assigned this
    on Aug 12, 2026
  10. moved this from Next Up 🎯 to In Progress 🔥 in Serverpod Frameworkson Aug 21, 2026
  11. moved this from In Progress 🔥 to Done 🚀 in Serverpod Frameworkson Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: storageenhancement

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions