wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.76k stars 1.14k forks source link

Add support for FileStorageService as a concept / declaration #2018

Open Martinsos opened 1 month ago

Martinsos commented 1 month ago

Discussed in https://github.com/wasp-lang/wasp/discussions/1988

Originally posted by **shuntl** April 24, 2024 It would be awesome to have wasp in development mode be able to spin up a dummy S3 bucket. Then prod env we can add the details for either a real S3, Digital Ocean space etc etc.
Martinsos commented 1 month ago

My comment from discussion:

Huh that would be interesting indeed!

It is a bit specific though hm, doesn't sound like a feature to add to the core language of Wasp.

But maybe concept of FileStorage would be interesting, and then you can choose S3, Azure Blob, ... . Ok yeah that is actually what you said, I get it now! Ok, that would be quite interesting, you are right.

I wonder what the right name would be. FileStorage? Storage?

We could have a way to say we want to have Storage, and it can be Dummy for start, and then as you said it can be S3 or sometihng else. We would need to have abstraction layer over it though. I wonder if a library for this already exists. And they would still need to be able to access it under the hood when needed (and use e.g. specific S3 options).

Martinsos commented 1 month ago

I think this is a bit wild idea, I am not sure if we should do it or not, but it is interesting, and merits further investigation. It could be cool! FileStorage indeed is part of many web apps, and why wouldn't we abstract it?

Martinsos commented 1 month ago

Name for this is actually "Object Storage" from what I read a bit, or just Storage.

I found this library that abstracts it (among other stuff): https://github.com/pkgcloud/pkgcloud?tab=readme-ov-file#storage .

infomiho commented 1 month ago

This sounds like an interesting idea! Since we are suggesting to our users the usage of object storage vs. using the local file system to keep the app portable, it makes sense to offer first-party support for object storage.

Using S3-compatible API could be interesting as there are many that support it:

Martinsos commented 1 month ago

Aha, so S3 became kind of a standard -> ok, that is also an option then! Although it would be nice to also support Azure and GCP as two big providers.

Martinsos commented 1 month ago

Interest from user on Discord: https://discord.com/channels/686873244791210014/1245951215192375417/1246086398445092904 .

A file storage system direct integration using s3 buckets [Which can have relation with the database too, like storing user avatar in s3 bucket and linked to database field]