anthony-fdez / supa-messenger

⚡️Real Time Chat app, supports group chats, direct messages and friendships. Built with ReactJS and Supabase as a backend
https://supamessenger.com/
MIT License
26 stars 3 forks source link

Please!! #62

Closed intelhere closed 1 month ago

intelhere commented 1 month ago

The readme of this repo is really nice! To make it clearer, could you pretty please add copy-pastable SQL of the database tables that one can paste into Supabase's SQL editor to be able to make a local version of the Supabase tables?

I've taken a look at the database-schema graph, but would really appreciate SQL that can be used!

If there's anything I can answer, please let me know!

anthony-fdez commented 1 month ago

@intelhere Hey I appreciate the kinds words and you looking at this repo! I'm not able to get in my laptop right now to do this as I think I'll need to do a pg_dump to get you the schema. I'll try getting that for you this weekend

intelhere commented 1 month ago

@anthony-fdez, Thank you so much for replying!! I think if you don't want to do a pg_dump, you might be able to get away by going to Supabase and visiting each table and copy pasting over its "table definition" into a md or sql file in the repo.

Like so: image

Which then shows the table's SQL: image

And it's copy-pastable like so:

create table
  public.channels (
    id bigint generated by default as identity not null,
    inserted_at timestamp with time zone not null default timezone ('utc'::text, now()),
    slug text not null,
    created_by uuid not null,
    type public.channel_type not null default 'one-on-one'::channel_type,
    constraint channels_pkey primary key (id),
    constraint channels_created_by_fkey foreign key (created_by) references auth.users (id)
  ) tablespace pg_default;

Once again, tysm for replying!!

anthony-fdez commented 1 month ago

@intelhere just made a PR!

intelhere commented 1 month ago

@anthony-fdez, Thank you so much, this will be so helpful in learning! I will be trying to use the SQL statements you added in a Supabase instance very soon and let you know how it goes!

I was trying out your deployed version and saw that creating private rooms (the room with a code) wasn't working for some reason, I think it might be because the onrender service is down?

anthony-fdez commented 1 month ago

@intelhere I'm glad to hear it helped let me know how it goes. And yeah I took down the render service it was too costly

intelhere commented 1 month ago

@anthony-fdez, I'll definitely let you know! Got it, that makes sense. Wondering, is that what the code under the server folder is for here?

anthony-fdez commented 1 month ago

Yessir! It's a custom nodejs server, it's like its own little project within the main project.

intelhere commented 1 month ago

That's super cool! I was wondering on the user side of things, since private rooms need a password to be accessed, does that mean that just the existence of a room/room name can be seen by all other users on the platform, regardless of if they have the password or not?

anthony-fdez commented 1 month ago

No, if I recall correctly private rooms are hidden in the UI and you can only join by accessing the link directly and the entering the password, so they're basically invite only rooms.

To test out a private room try with two incognito windows and send a friend request to each other user, then send a DM. DMs are private but no one can join a DM room as it's made automatically when the friendship is created just for the two friends. But if you try opening the room url in another window with a different user it will prompt you for a password.

intelhere commented 1 month ago

@anthony-fdez, Yep, I've tried out DMs via sending a friend request, but I think I first need to create a room with friends to then be able to send a friend request -- like there isn't a way for me to send a friend request by typing there username in from somewhere, but rather have to be in a room with those friends first.

Hmm, yeah I did want to try out how the private group room with the code would show up in the UI, but I think that won't be possible as of now due to the onrender project being down. Is there a way I could deploy the mini-backend (the one you had on onrender) to a service like Netlify where I could use their serverless functions (which are free for tons of invocations)?

anthony-fdez commented 1 month ago

@intelhere yeah you're right there is no search feature, that should be relatively easy to implement though, the thing is there are no usernames, everything in the app is handled by email, and all emails are public. You probably know sharing emails is probably bad and thats why this app is not meant to be used as a real messaging app. I'd have to do a refactor to make the users enter a username after they maker their account. And completely remove all the emails from the users DB (it will stay in the supabase auth table, not on my public users table)

You're getting me exited to work on this again haha i might work on it one of these weekends and do the username refactor and implement a search feature to add friends using the username.

Regarding the server, you can deploy whats on the server folder anywhere you want really, its pretty easy to deploy a nodejs server, the only reason I took id down is because I was already paying for this plus a couple other projects and I was spending too much on side projects, but if you only have one project it would possible fall in the free tier.

intelhere commented 1 month ago

@anthony-fdez Oh yeah, there aren't any usernames, I got confused with this and another project that did have usernames, but their overall chat webapp wasn't that good compared to Supamessenger. For the "add friend" feature, I would suggest to have it where when the user types in their friend's username, they don't see a dropdown list of other users with similar usernames (like Instagram does), in an effort to keep privacy by preventing other users from just finding random accounts. In this case, I think it would be best to just have it where the user enters in their friend's username and if the username exists, the friend request is sent to the other friend.

I think what you have done so far is really cool and I'm sure you'd be able to achieve a ton over a weekend!!

For your response to my question about the server, thanks, I think with some modifications I should be able to deploy it to Netlify's serverless functions (they support Express.js)!

anthony-fdez commented 1 month ago

Thanks! I'm gonna give it a go and I'll tag you on the PR once i'm done. By the way, were you trying to make your own supabase chat? if so how's that going?

intelhere commented 1 month ago

Of course, looking forward to it! Thanks for asking, I was looking into how full-stack chat apps can be made with excellent backend-as-a-service products like Supabase. Your project had the most info and a well-rounded product that I could learn a ton from, so it's going pretty well!

intelhere commented 1 month ago

Hey @anthony-fdez! I was looking over the weekend quite a few times lol to see if a PR or maybe a comment popped up!

Btw I'm really appreciative that you're active in replying back, there aren't many other GitHub repo owners that do that :)

I think you maybe had a busy weekend -- I think a PR can be hard to get pushed out for a feature, but perhaps opening a branch for it would be cool!

anthony-fdez commented 1 month ago

Hey @intelhere ! I apologize I haven't been able to put much time into the project due to work, I end up everyday that the last thing I wanna do is keep coding haha.

I did add a quick update but it was more for styles and a new login page, idk if you saw that.

I'm gonna attend a hackathon this weekend so I might not have time to do much, but you can be sure whenever I work on it I'll let you know. If you wanna work on it you're more than welcome to contribute

intelhere commented 1 month ago

No problem @anthony-fdez!