Storage Providers
Custom Storage Provider

Custom Storage Provider

When integrating the Montagix SDK into your projects, you might have specific storage requirements that neither the built-in LocalStorageProvider nor the S3StorageProvider can fulfill. In such cases, the SDK offers the flexibility to define a CustomStorageProvider.


The CustomStorageProvider is designed for developers to tailor a storage solution that best fits their application's needs. Whether you have a unique storage architecture, special security protocols, or specific data handling workflows, the custom provider allows you to embed your storage logic seamlessly within the Montagix SDK ecosystem.

Implementing Your Solution

To use a custom storage provider, you'll need to:

  1. Extend the CustomStorageProvider abstract class.
  2. Implement the required methods like put, delete, serialize, and deserialize.
  3. Ensure that your custom provider integrates well with the SDK's other components.

With this custom implementation, you gain full control over how and where your assets are stored, retrieved, and managed, aligning perfectly with any unique storage setups you may have.


  • Full Control: Tailor your storage mechanism to your specific needs.
  • Security: Integrate your organization's security policies and measures directly.
  • Flexibility: Choose storage locations, methods, and protocols based on your preferences and requirements.

Remember, with great power comes great responsibility. Ensure that your custom storage solution is robust, secure, and efficient to keep your Montagix-powered applications running smoothly.


Here is an example illustrating a simplified version of a LocalStorageProvider.

class LocalStorageProvider implements CustomStorageProvider {
  async delete(src: string): Promise<void> {
    return Promise.resolve();
  async put(id: string, src: string | File): Promise<string> {
    if (src instanceof File) {
      return Promise.resolve(URL.createObjectURL(src));
    return Promise.resolve(src);
  serialize() {
    return {
      type: 'LocalStorageProvider',
  static deserialize() {
    return new LocalStorageProvider();
export default LocalStorageProvider;