PraneoTech
Your Application Shouldn't Need to Know Where Its Files Live
The case for separating file storage from application logic and why a file API is more than another S3 wrapper.

Applications usually start with a reasonable shortcut: “We’ll store files in S3.” Or R2. Or Google Drive. Whatever works at the time.
Then the shortcut becomes architecture.
Credentials find their way into every service that uploads files. Controllers start handling provider-specific errors. Signed URL lifetimes become part of frontend logic. Object key layouts leak into business code. Encryption, if needed, gets implemented separately in each codebase.
When another product needs file storage, the team copies the integration. The same dependencies, the same assumptions, and eventually the same maintenance problems spread across another application.
The issue isn't choosing the wrong storage provider. It's allowing the choice of provider to shape the applications that depend on it.
Long-lived applications need to manage files. They shouldn't need to understand the infrastructure currently holding the bytes.
How applications become coupled to storage providers
Coupling rarely arrives through one obviously bad decision. It accumulates through convenience.
Provider SDKs become part of the application's vocabulary.
Upload code stops talking about documents and starts talking about buckets, keys, multipart uploads, refresh tokens, and drive file IDs. Those concepts belong to the storage layer. Once they appear throughout application services, changing providers means changing product code too.
Credentials and failure handling spread.
Every backend that interacts directly with storage needs access credentials, network configuration, retries, and monitoring. File handling starts competing with business logic for engineering attention and operational resources. Large transfers and encryption can also consume CPU, memory, and bandwidth in application processes.
Access patterns inherit provider-specific behavior.
Temporary URLs, access-control models, and folder structures differ between providers. S3-compatible object stores, for example, commonly represent folders through key prefixes rather than actual directory structures. Other providers expose different permission and identity models.
When an application assumes one provider's behavior, switching providers is no longer simply a configuration change. It can mean redesigning how files are accessed.
Metadata and ownership remain the application's problem.
An object store knows about objects. It doesn't inherently understand your application's users, domains, folder hierarchies, or which caller is allowed to replace or delete a particular file.
Teams fill that gap with their own database tables and authorization logic. Before long, provider identifiers and storage-specific assumptions are scattered across the application.
At that point, the application doesn't merely use storage. It has become partially responsible for implementing it.
What happens when storage requirements change?
Requirements change even when the product roadmap looks stable.
Cost or performance considerations push you toward another object store.
A customer review calls for more consistent encryption practices.
A second application needs the same file-management capabilities.
You need domain-scoped isolation rather than relying on a shared bucket-prefix convention.
The original provider works well for public images but is awkward for protected documents.
When each application owns its own storage integration, every change spreads across the systems that depend on it:
Update SDKs and credentials in multiple services.
Revisit upload, download, and access-URL workflows.
Migrate or temporarily duplicate stored objects.
Re-test authorization and failure handling in every consuming application.
Check for clients that depend on provider-specific URLs or identifiers.
The business asks to move its files. Engineering hears that every system that has ever uploaded something may need attention.
A storage abstraction doesn't eliminate migration work. It concentrates that work inside the file service instead of spreading provider-specific changes across every consuming application.
That is the value of separating the two responsibilities.
A dedicated file API creates a stable integration boundary
An alternative is to put a service boundary between applications and storage providers.
Instead of communicating directly with an object store, consuming applications communicate with a file API. They authenticate, upload, replace, list, download, and delete files through a consistent interface.
They don't need to communicate directly with Cloudflare R2, Amazon S3, Dropbox, or Google Drive.
The application works with files, folders, and domain scope. The file service handles provider credentials, object identifiers, storage SDKs, and the operations required to persist and retrieve those files.
In Orvex, that boundary is an HTTP API. A simplified example of an upload request looks like this:
curl -X POST http://localhost:3000/api/files/upload \ -H "X-API-Key: YOUR_API_KEY" \ -F "[email protected]" \ -F "folder=documents" \ -F "isProtected=true"The consuming application doesn't construct an R2 object key or configure an S3 client. When protection is enabled, it also doesn't need to implement Orvex's file-encryption workflow.
Orvex authenticates the API key, resolves the relevant domain, optionally encrypts the file, stores the object through the configured provider, and records its metadata in PostgreSQL.
Subsequent operations use Orvex file identifiers. Internally, the service keeps track of the storage provider and its corresponding object identifier through fields such as storageProvider and storageId.
The distinction matters: the application works with a file-management contract, while the service manages the storage implementation behind it.
Storage abstraction is not just wrapping the S3 SDK
There are two different levels of abstraction worth distinguishing.
Thin S3 wrapperFile-management APIPrimary audienceInfrastructure codeProduct applicationsCore conceptsBucket, key, PutObjectFile, folder, domain, ownershipAuthenticationCloud credentials in the applicationApplication credentials to the file serviceProvider changeMay retain S3-specific assumptionsProvider-specific work stays behind the service boundaryAdditional responsibilitiesUsually storage operationsCan centralize metadata, authorization, and encryption behavior
Wrapping @aws-sdk/client-s3 inside a helper module is useful engineering practice. It keeps SDK calls out of individual controllers and makes storage code easier to maintain.
But it is still an object-storage abstraction. The application continues to work with concepts such as keys, buckets, and object operations. Moving to a provider with different access or identity semantics may still require changes beyond that wrapper.
A file-management API abstracts a broader workflow:
Who is making the request?
Which application domain does the file belong to?
How is the file organized and identified?
Should the file be protected through encryption?
Who is allowed to list, replace, retrieve, or delete it?
Orvex's internal design follows this separation. Controllers handle file operations, while a storage service routes those operations through a provider interface with methods such as uploadFile, downloadFile, deleteFile, and getUrl.
Cloudflare R2 is the active storage implementation today, using the S3 SDK against an R2 endpoint. Dropbox and Google Drive clients exist behind the same interface, but they are currently disabled.
That distinction is important. Provider independence is an architectural direction, not a claim that every backend is ready for production use.
The immediate benefit for an application developer is simpler: the application integrates with Orvex's file API, not directly with R2's API.
How Orvex keeps consuming applications independent of storage providers
That separation is maintained at several concrete boundaries.
1. Applications authenticate to Orvex, not to the bucket.
File operations use application API keys through X-API-Key. SuperAdmin JWT authentication is used for provisioning users and domains. Cloud storage credentials remain within Orvex rather than being distributed to every application that needs to upload files.
2. Application identifiers are separate from provider identifiers.
Clients work with Orvex file IDs. When the service needs to retrieve, replace, or delete an object, it resolves the associated storageProvider and storageId.
The application does not need to know how a particular provider identifies its objects.
3. Provider selection belongs to Orvex.
Uploads use the currently active backend, Cloudflare R2. The service records which provider holds each object so subsequent operations can use the corresponding implementation.
If another provider is enabled, the consuming application should not need a separate SDK integration simply to use it.
4. Shared file behavior lives in one place.
Optional isProtected encryption, domain-scoped folders, pagination, and ownership checks are handled within the file service.
Without this boundary, each consuming application has to build and maintain its own version of these capabilities. Implementations can gradually diverge, creating different authorization rules, storage conventions, and maintenance requirements.
5. The file API remains the application-facing contract.
Applications use endpoints such as /api/files/upload and /api/files/:fileId/download. Provider-specific changes can be handled behind that interface, provided the service preserves the contract expected by its consumers.
This doesn't mean a storage migration is effortless. Objects may still need to be copied, metadata reconciled, and access behavior tested. The difference is where that work happens: inside the file service rather than in every application that uses it.
There is also an operational benefit to this separation. File transfers and encryption consume resources that may compete with application workloads. A dedicated service creates the option to scale those operations independently. Whether that improves performance depends on deployment, transfer paths, and where processing actually happens.
A file service doesn't replace your application's identity system
There is an important boundary here: Orvex does not decide who the users of a consuming application are.
The application remains responsible for authenticating its users, deciding which users should have access to file operations, and mapping its own organizations or accounts to the appropriate Orvex domains.
It must also keep API credentials on the server side rather than exposing them to browser or mobile clients.
Orvex takes responsibility for file-level operations and authorization within the domain it has been asked to manage. The consuming application retains its business identity model.
This separation is deliberate. A file service should not need to replace an application's authentication system to manage its files.
The core argument
Your application should care about:
Uploading a document into the correct domain.
Listing the files that belong to that domain.
Requesting protection when a file requires it.
Retrieving, replacing, or deleting files under the right authority.
It should not need to care about:
Which vendor endpoint stores the object.
How folders are represented inside object storage.
Which SDK version communicates with the provider.
Where storage credentials are configured.
How provider-specific identifiers map to application-facing file IDs.
Those responsibilities belong behind a dedicated file-management boundary.
Orvex is built around that separation. Cloudflare R2 is the active storage provider today. The service provides the application-facing file API, manages file metadata and authorization, and keeps provider-specific operations behind its storage interface.
The goal isn't to promise that every storage provider can be swapped without effort. It's to prevent every consuming application from having to understand the provider in the first place.
Manage files in the application.
Let infrastructure stay infrastructure.