sentrionic / Valkyrie

A Fullstack Discord Clone using React and Go.
MIT License
308 stars 71 forks source link

General Questions #1

Closed dude83759 closed 3 years ago

dude83759 commented 3 years ago

Hello Sir, I found your clone very helpful but I want some help regarding installation, how can I contact you, please provide mail address or if linkedin account link.

sentrionic commented 3 years ago

What problem did you encounter during the process? We can talk about it here for others to see that might have similar problems.

dude83759 commented 3 years ago

Not any specific problem. Actually I am a beginner so I am not much experienced with all this stuff. So I required detailed steps to clone your repo and achieve discord clone. Also will this discord clone chat work on a PHP website. If possible please connect on dude83759@gmail.com

dude83759 commented 3 years ago

I didn't tried installing this clone and working on it, should I do as defined in readme and also is AWS a must for uploading files or there is some free service for that or how to do that on localhost.

sentrionic commented 3 years ago

You should follow the steps in the readme. If you don't have NodeJS yet, you should install that as well. You could replace the yarn command with npm in that case.

AWS is required for file upload. You can definitely replace it with something like https://cloudinary.com/, though you would have to change the file upload part yourself in that case.

I don't know what you mean with a PHP website so I can't help you with that.

dude83759 commented 3 years ago

Thanks a ton for your reply. Okay, I will follow the steps in the readme and reach out to you for any queries. I would have been glad if I can contact you somewhere else because here it might be that you are not always active on Github. ..... Coming to NodeJS I have to installed it earlier for another project and so should I replace yarn commands with npm and will they work. Actually for what is yarn command used?

With PHP website I meant that I made a dynamic website with PHP for a project where users can login, so after that they can chat (like discord).

So will this be totally seperate or how will I integrate that users database for login into chat with this one.

dude83759 commented 3 years ago

Also do you have any experience with WebRTC? Looking forward to hearing from you soon!

sentrionic commented 3 years ago

Yarn is a dependency manager similar to npm.

The frontend and backend are separate entities, so you could use a different frontend or backend. You would just have to call the endpoints listed on localhost:4000/api. I've never used PHP so I can't help you any further with that. Similarly I haven't used WebRTC either.

dude83759 commented 3 years ago

Okay, I will try to do my best, if I encounter any error, would ask you.

dude83759 commented 3 years ago

Just one more thing, is your repo up to date with your demo website https://valkyrieapp.xyz/

dude83759 commented 3 years ago

Also sir, it is given that redis is not available officially for windows.

sentrionic commented 3 years ago

Yes

dude83759 commented 3 years ago

you responded - Yes for which question ?

sentrionic commented 3 years ago

The live version is up to date with the repository. As for Redis you would need to search for different solutions to run it on Windows, for example by using Docker.

dude83759 commented 3 years ago

The live version is up to date with the repository. As for Redis you would need to search for different solutions to run it on Windows, for example by using Docker.

Okay

dude83759 commented 3 years ago

What about this https://redislabs.com/blog/redis-on-windows-10/

dude83759 commented 3 years ago

Also would this work for your repo https://divyanshushekhar.com/how-to-install-redis-on-windows-10/

sentrionic commented 3 years ago

You can give both a shot, I would try the first one since it's provided by the redis devs themselves.

dude83759 commented 3 years ago

Okay, then I will try the 1st one and let you know.

You can give both a shot, I would try the first one since it's provided by the redis devs themselves.

dude83759 commented 3 years ago

Just asking for a personal choice, won't the first option be difficult and take too much time than the second. If the results will be the same I would go for 2nd. What do you say?

dude83759 commented 3 years ago

I am going with WSL 1 because WSL 2 seems to be lengthy and tougher than WSL 1

dude83759 commented 3 years ago

How to get these values ---

DATABASE_URL="postgresql://:@localhost:5432/db_name" REDIS_URL=localhost:6379 CORS_ORIGIN=http://localhost:3000 SECRET=SUPERSECRET REDIS_HOST=192.168.2.123 REDIS_PORT=6379 REDIS_PASSWORD=password

dude83759 commented 3 years ago

Hello Sir,

Here is what I did but still the project is not working on my localhost.

then on web

Please help me troubleshoot, where did it went wrong.

dude83759 commented 3 years ago

Please help @sentrionic

dude83759 commented 3 years ago

@sentrionic Sir please reply I have tried everything but still it's not working.

dude83759 commented 3 years ago

in my server folder when I open cmd and run yarn start I get the error unable to connect the databse the server does not support ssl connections and tried all stackoverflow solutions but none worked for me, please help.

sentrionic commented 3 years ago

There's not much help I can remote provide either. My only guess would be to remove

extra: {
  ssl: {
    rejectUnauthorized: false,
  },
},
ssl: true,

in database.ts

dude83759 commented 3 years ago

There's not much help I can remote provide either. My only guess would be to remove

extra: {
  ssl: {
    rejectUnauthorized: false,
  },
},
ssl: true,

in database.ts

Okay will try that but sir, I have been waiting for your reply for hours. Is there some communication method where we can have instant communication. Also if you agree I will be ready for a MS teams meeting or Google meet meeting.

dude83759 commented 3 years ago

Also @sentrionic as I mentioned what I did, did you find any other mistakes in what steps I followed, please let me know.

sentrionic commented 3 years ago

Did you insert your postgres username and password in your DATABASE_URL? The REDIS_HOST should be localhost as well, I made a mistake in the readme there while copying.

dude83759 commented 3 years ago

Did you insert your postgres username and password in your DATABASE_URL? The REDIS_HOST should be localhost as well, I made a mistake in the readme there while copying.

Yes I inserted my username and password in DATABASE_URL in the .env file in server and copied that same file to web.

also REDIS_HOST ==localhost just now removed this

extra: {
  ssl: {
    rejectUnauthorized: false,
  },
},
ssl: true,

still getting the error below. Screenshot (47)

sentrionic commented 3 years ago

Web uses a different .env file that should only contain REACT_APP_API=http://localhost:4000. As I said previously remote help is very difficult. You could try to create a different node and express project with TypeORM and see if you can connect to your database there.

dude83759 commented 3 years ago

Hey, thanks, finally I am not getting the error but still my localhost:3000 doesn't load anything and localhost:4000 does load like yours https://api.valkyrieapp.xyz/ and localhost:4000/ws loads same as yours https://api.valkyrieapp.xyz/ws/.

I am also having a nodejs application that runs on port 3000, so is that the cause of not loading localhost:3000

sentrionic commented 3 years ago

If your client does not run on port 3000 then you need to change CORS_ORIGIN to the port it runs on. What error do you get on your client?

dude83759 commented 3 years ago

Sir, I request you to please upload a step-by-step video guideline to make this project, please sir.

dude83759 commented 3 years ago

For beginners, it's too difficult too troubleshoot, by the way thanks a ton, you helped me with every error I encountered but still on localhost:4001 the application displays, I enter the details to register and when I click on register nothing happens.

sentrionic commented 3 years ago

Beginners should probably follow tutorials first to get into React development with custom backends or try not to mess with the different ports too much.

If you press F12 you can open the developer console of your browser and then check if there are errors either in the console or network tab. If you run the server on a different port don't forget to change the REACT_APP_API to said port.

dude83759 commented 3 years ago

Sir, one very important request. It might take you some time but please please clone this repo yourself and do the steps again as you mentioned in the readme. then please let me know if you are able to install without any problem.

dude83759 commented 3 years ago

Beginners should probably follow tutorials first to get into React development with custom backends or try not to mess with the different ports too much.

If you press F12 you can open the developer console of your browser and then check if there are errors either in the console or network tab. If you run the server on a different port don't forget to change the REACT_APP_API to said port.

Sure!

dude83759 commented 3 years ago

Screenshot (49)

sentrionic commented 3 years ago

You client runs on 4001 right? Your backend uses another port, that's the one that you need to specify in the env variable.

dude83759 commented 3 years ago

Screenshot (50) Now what to do???

values of server .env PORT=3000 REDIS_URL=localhost:6379 CORS_ORIGIN=http://localhost:3000 SECRET=supersecret

REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=

vlaue of web .env.development browser=none REACT_APP_API=http://localhost:3000

dude83759 commented 3 years ago

Now after this if I open localhost:3000 it opens swagger UI, if I open localhost:3000/ws/ it opens Valkyrie websockets.

if I open 192.168.1.7:3000 it does open valkyrie but clicking on registration does nothing.

dude83759 commented 3 years ago

Hey, thanks a ton, finally I am able to register, login, create server, add users, make friends, notification system working, create channel (Private also), get notified about online/offline, get notified about who's typing in the channel.

How can I add the option of user typing.... in direct messaging. Also user avatar didn't changed when I uploaded one and file upload didn't worked.

is it that for both of them I will require AWS S3.

Again, thanks a lot for this amazing project and helping me resolve all my enquiries, it's much appreciated would look to collaborate soon with you for this or any project in future.

Now coming to how did I solved my error, I think it was already solved because when I was solving error for connection to database somehow i might have changed ports, now after changing correct ports for hours, being frustrated I saw ports for your git repo and changed them in mine local project and it worked.

dude83759 commented 3 years ago

when using the project on localhost couldn't I simply save images in the project folder, because I am not going to deploy this online so AWS S3 seems a 2nd option. Please let me know.

sentrionic commented 3 years ago

You can store files to your local device and serve them yes. Since I have an AWS account I haven't used that option in a long time and therefore can't really remember how it worked.

As for user typing in DMs, that might be something I forgot to add.

dude83759 commented 3 years ago

Yeah, pardon me the user is typing .... is working on both direct messages and channel messages on server. Coming to storage I am going to try AWS and let you know what happens, do I just have to change AWS_ACCESS_KEY=ACCESS_KEY AWS_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY AWS_STORAGE_BUCKET_NAME=STORAGE_BUCKET_NAME AWS_S3_REGION=S3_REGION GMAIL_USER=GMAIL_USER GMAIL_PASSWORD=GMAIL_PASSWORD

also where we are having mails and why? for OTP or what? Also, coming to removing a friend it works fine on your demo website but on my local storage I am able to remove friend from friends section but when I click friend on right side bar (where user are shows offline/online) it gives a error page but friend is removed please help me correct that.

Also talking about what functions of the repo are wroking on localhost are ___

Message, Channel, Server CRUD --- yes Authentication using Express Sessions --- don't know what exactly is this but seems yes (if possible please explain) Channel / Websocket Member Protection --- don't know what exactly is this but seems yes (if possible please explain) Realtime Events --- yes events like adding friend, message, crud operations happens in real time File Upload (Avatar, Icon, Messages) to S3 -- going to try this Direct Messaging - yes Private Channels - yes Friend System - yes Notification System - yes (would like to get notified about channel messages like we get notified about direct messages) Basic Moderation for the guild owner (delete messages, kick & ban members) -- yes (Basically 2015 Discord features with 2021 Look) --- yes

in all, it's a fantastic repo.

Would you please help me add emoji part in the chat, would be glad to hear from you soon!

Screenshots for remove friend error (by right clicking on the friend in the right side bar ) Unhandled Rejection (TypeError): Cannot read property 'filter' of undefined

Screenshot (52) Screenshot (51)

dude83759 commented 3 years ago

For specific personalized conversation we may use https://gitter.im/ (login with GitHub).

sentrionic commented 3 years ago

As for new features I have currently no interest in adding new stuff. If you want emoji take a look at Emoji Mart. The only reason I didn't add it is that if I want to create a mobile app I can't use those emotes.

dude83759 commented 3 years ago
  • Emails are for resetting passwords, if you aren't interested in that you can skip that.
  • Express Sessions are a way to authenticate the user. If you have used JWT, sessions are similar to that.
  • Channel/Websocket Protection means that non authenticated users and users that are not members of that guild/channel can't subscribe to those events.
  • As for that error I will it out later.

As for new features I have currently no interest in adding new stuff. If you want emoji take a look at Emoji Mart. The only reason I didn't add it is that if I want to create a mobile app I can't use those emotes.

Thanks!

dude83759 commented 3 years ago

If I am not disturbing you then will you please take some time out from your schedule tasks for the following.

I have a mini web app which already has a login/register (DB used --> MySQL).

Now I want to integrate this chat on that mini web-app.

I want that if I login & click on chat option this discord chat opens for that registered user without asking again for the username and password for both login and register.

Will I have to connect mysql and postgresql and fetch table entries from 1st to 2nd and while clicking on chat run an api to take values for user log-in automatically.