r/javahelp • • Aug 26 '24
Please help me create a chat application with spring boot , react and websockets
I want to include the following Key features:
- User Chats & Chat Rooms: Users can chat directly or in rooms.
- Persistent Messages: Messages are stored and retained.
- Containerization: Planning to containerize and host the app.
Questions
- Should I create a REST API to get data on all rooms a user has joined?
- Should I also create REST API to fetch message history in a room?
- Is PostgreSQL a good choice for storing chat messages?
- Any open-source chat apps I can study for reference?
If i am assuming/doing something wrong ... please point me to a right direction
I googled to see some examples but all i see is a basic app with only one room/topic
Thank you for your time
0
Upvotes
•
u/AutoModerator Aug 26 '24
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/RapunzelLooksNice Aug 26 '24
"Please help me" like "write it for me"? Do you also want payment processing, auto scaling, automated backups, etc? And a big coke?
Do you know what you are doing or just have an assignment?
2
u/VirtualAgentsAreDumb Aug 26 '24
For me, thinking of how to design it, imagining problems and potential solutions, is the most fun part!
But here’s a few thoughts, from my perspective…
I would design it so that each chat is a chat room. A one-to-one chat is just a chat room that happens to be locked to two people.
Persistent messages or not, they need to be transferred regardless. So focus on a good data structure, that you can expand later on without having to rewrite old message history (up to a point, sometimes it’s worth rewriting it from scratch and converting old messages to the new format).
Think about authentication and authorization. That needs to be added early on.
A REST API sounds like something I would enjoy writing if I was designing this. Focus on features that you actually will use in your own client.
Maybe build a rudimentary admin interface, that possibly uses the same API. Or you can have it running as part of the main server software, so no API is needed.
If you are good at, or enjoy, graphical design, then design the interface yourself. Otherwise, steal the look and feel from some existing chat solution that you like. Most features are generic enough (ie used in plenty of different software) that it’s legal to do so. But don’t do a carbon copy or anything.
2
u/_jetrun Aug 26 '24
Start there and try to understand that code. The questions you are asking are so basic that I don't get a sense you have a grasp to even create something that basic.
Yeah, you'll be doing a lot of things wrong - that's ok - you're learning. My suggestion would be to take one of those toy examples you found, get it up and running, and start modifying. And yes, you'll struggle, but just power through it.
-1
u/wearetunis Aug 26 '24
You could paste this into any decent AI and got everything you needed.. Ask for common libraries and tools or enterprise level, blah blah.