An open API service indexing awesome lists of open source software.

https://github.com/zernonia/supabase-cdn-transformation


https://github.com/zernonia/supabase-cdn-transformation

Last synced: 6 months ago
JSON representation

Awesome Lists containing this project

README

          




Supabase Storage CDN & Transformation (Alternative Unofficial)


Secured & Simple Supabase Storage CDN & Transformation (Self-hosted).




View Tutorial
ยท
Report Bug
ยท
Request Feature


Deploy with Vercel

![Supabase CDN & Transformation](https://cdn.hashnode.com/res/hashnode/image/upload/v1631296527320/TH24GsjXyv.png?w=1600&h=840&fit=crop&crop=entropy&auto=compress)

## ๐Ÿš€ Features

- โ˜ CDN
- ๐Ÿคš Image Transformation (width, height, quality)
- ๐Ÿš€ 1-Click Deploy!
- ๐Ÿ”’ Hosted on your own Vercel instance
- ๐Ÿ‘€ No Sensitive info required

## ๐Ÿ“‡ Inspiration/Showcase

I had a website called [Made With Supabase](https://www.madewithsupabase.com/), which showcase projects that made with Supabase. A problem occurs to me where the images load super-duper slow. Hence, I started to look into this issue.

It turns out that some of the images has around 5MB ๐Ÿคฏ, which is too high quality, and wasting data quota as well for all my visitors!

Then, I found out that [Supabase Storage](https://supabase.io/storage)'s CDN and Transformation still Working in Progress. I don't want to wait any longer, and thus, I've created this simple **Serverless CDN and Image Transformation** service for everyone! ๐ŸŽ‡โœจ๐ŸŽ‰.

### ๐Ÿ”จ Built With

- [Vercel](https://vercel.com/)

## ๐Ÿพ Instructions

1. Click [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fzernonia%2Fsupabase-cdn-transformation&env=SUPABASE_URL&project-name=supabase-cdn-transformation&repo-name=supabase-cdn-transformation&demo-title=Supabase%20CDN%20Transformation&demo-description=Temporary%20Altnernative%20for%20Supabase%20Storage%20CDN%20%26%20Transformation&demo-url=https%3A%2F%2Fsupabase-cdn-transformation.vercel.app%2F&demo-image=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1631296527320%2FTH24GsjXyv.png%3Fw%3D1600%26h%3D840%26fit%3Dcrop%26crop%3Dentropy%26auto%3Dcompress)
2. Create a new Git repo.
3. Create a team? You can `skip` it.
4. Key in `SUPABASE_URL` (only support 1 project at once) in the Environment Variables.
5. Wait for deployment
6. Congratulations! Your serverless function is up and running! Enjoy !!! ๐ŸŽ‰
7. ๐ŸŒŸ this repo, ๐Ÿค this project, โ˜• buy me a coffee?
8. Learn more from this [Blog post](https://blog.zernonia.com/supabase-storage-cdn-and-transformation-with-serverless-function-unofficial).

## How to use

Here are some of the parameter to pass along the new image's url.

```sh
w: width (number of pixel) // optional
h: height (number of pixel) // optional
f: file_name (eg: avatar.png)
b: bucket_name (eg: static)
q: quality (0 to 100) // optional

```

1. Click `Deploy` button above and follow the instruction above.
2. Wrap all the images url in your project's `` with the following code.

`https://{ url-for-the-serverless-function-you-just-deployed }/api/resize?...`
3. Pass the parameter into the url as query string. (eg:)

`https://.../api/resize?f=avatar.png&b=static&w=1200`
4. Insert the link into `` and you are done!

## ๐Ÿ“œ License

Not Associated with Supabase.

Distributed under the MIT License. See `LICENSE` for more information.

# ๐Ÿ“ง Contact

Twitter - [@zernonia](https://twitter.com/zernonia)

Also, if you like my work, please buy me a coffee โ˜•๐Ÿ˜ณ


Logo