Yeasir0032 / Discord-Clone

A Discord clone built using Next.js, Tailwind CSS, and LiveKit, providing users with real-time text, voice, and video communication features.
https://discord-a.up.railway.app/
MIT License
41 stars 49 forks source link

Supabase storage bucket using for File storage #10

Open Yeasir0032 opened 6 months ago

Yeasir0032 commented 6 months ago

Functionality to use supabase storage

Currently the project uses uploadthing for storing files. The new mechanism involves using supabase's storage system to store files. Steps to follow:

  1. Read about supabase storage system.
  2. Understand how supabase works in this project ( for example you can look into this code snippet page.tsx
  3. Trace the references of upload thing.
    • It is used when server is created or edited
    • For file attachment in messaging
  4. Replace the functionality from upload thing to supabase storage .
  5. Make sure to remove uploadthing from package.json by uninstalling it.
ArtiGaund commented 6 months ago

Can do updating function to supabase storage ? Can You assign this issue to me?

Yeasir0032 commented 6 months ago

Could you please provide steps how would you achieve this. @ArtiGaund

ArtiGaund commented 6 months ago

1) Initialize supabase client (/config/supabase.js) import { createClient } from "@supabase/supabase-js"

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_KEY; const supabase = createClient(supabaseUrl, supabaseKey);

export default supabase

2) Replacing uploads from uploadthings folder, Uploading with Supabase storage import { supabase } from "./config/supabase async function uploadFile(file){ const filePath=...${file.name} const {data,error} = await supabase.storage.from('bucket-name').upload(filePath) if(error) console.error("Error while uploading file", error)

return data

} 3) Replacing downloads from uploadthings folder, with supabase storage (same as uploads)

4) removing uploading things from package.json.

codebreaker3008 commented 6 months ago

@Yeasir0032 can you assign this issue to me ??

Yeasir0032 commented 6 months ago

@codebreaker3008 I have already assigned her. If she fails to do so then you will be assigned

ArtiGaund commented 6 months ago

@Yeasir0032 Is there any timeline to complete it?

Yeasir0032 commented 6 months ago

This issue will not take more than 4 days. If you need some more time you can ask for it but if you become inactive then I have to give chance to others

ArtiGaund commented 6 months ago

I will do it try to complete it till tomorrow

codebreaker3008 commented 6 months ago

@Yeasir0032 could you assign this to me too, accept the one which does it earlier

ArtiGaund commented 6 months ago

@Yeasir0032 Where are the tables of Supabase with their fields and their datatype?

Yeasir0032 commented 6 months ago

Screenshot from 2024-05-11 20-28-26 Here is the schema visualizer

growupanand commented 6 months ago

I am working on the file preview component #19, How much time it can take for a new upload flow any idea?

ArtiGaund commented 6 months ago

You can assign this issue to someone. My setup is not working, and it is not good to hold an assignment if I am not able to work on it.

Yeasir0032 commented 6 months ago

@codebreaker3008 Do you want to do it?

codebreaker3008 commented 6 months ago

@Yeasir0032 yes but i am caught up in some personal issues, you could assign it to me but it will take some time

Yeasir0032 commented 6 months ago

Hey @ArtiGaund , could you update your progress. Let's fix the error you are facing.

ArtiGaund commented 6 months ago

I will update in night bcz my laptop is updating now, it was freezing alot, so today I am updating it, may be it will resolve freezing issue.

Yeasir0032 commented 6 months ago

How far have you reached? @ArtiGaund Did you setup supabase database (Postgres) on your own. If yes then please add your schema visualizer as I have done above. If no then we need to do that first. Following steps

ArtiGaund commented 6 months ago

Created buckets in database done

Yeasir0032 commented 5 months ago

Hey @ArtiGaund The documentation for table setup has been added. Do check Learn.md file.

ArtiGaund commented 5 months ago

Screenshot (341)

Before upload file button was working, now its not working. Not able to upload image.

PayalKumari10 commented 4 months ago

Hello, @ArtiGaund any update on this issue?

ArtiGaund commented 4 months ago

This issue is not assigned to me.