r/javahelp • u/[deleted] • 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
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?
4
Aug 26 '24
I am sorry if it sounded like that...
No its not a assignment , its my personal project and i am passionate about it. I don't want anyone to write "code" for me. I just need help in designing the flow and structure of the app...
I just wanted to go in a right direction... and learn while going
6
u/South_Dig_9172 Aug 26 '24
Start small then. If we just tell you the flow, how will you learn? How will you know how to create the flow next time?
3
u/RapunzelLooksNice Aug 26 '24
OK, so start by writing a simple chat server with no rooms or users or history and client app for that. Experiment with what you might need.
1
u/yaahboyy Aug 26 '24
As someone who has had similar thoughts and considers themself a beginner still, I feel like personally it would be counter productive if I approached this the way you did.
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
I googled to see some examples but all i see is a basic app with only one room/topic
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.
If i am assuming/doing something wrong ... please point me to a right direction
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.
1
u/-Dargs Aug 27 '24
Its suggestions and newbie learners that think like this give me reassurance that I'll never be out of a job.
"Just copy-paste code from the internet."
"You're an engineer, Harry!"
1
u/wearetunis Aug 27 '24
I’d counter and say someone trying to build with AI might not even have to consider a job if it deploys? Roles can reverse quickly and that person you knocked for the method, could be your boss one day. I wouldn’t make following corporate processes and procedures to build someone else’s dreams be my identity. Your CEO didn’t.
1
u/-Dargs Aug 27 '24
I don't really get what you were trying to say. Be an entrepreneur rather than a salary slave? I'd rather be a salary slave and work 10 hours per week instead of 80.
1
u/wearetunis Aug 27 '24
I’m saying to build OP’s/anyones application as a solo developer, AI can help more than someone who works for a company on a team. Newbies using AI will still learn the same shit and also how to troubleshoot the future issues that will come with AI. The future will be filled with new companies/CEO’s that started with AI and may end up being maintained by someone like you.
•
u/AutoModerator Aug 26 '24
Please ensure that:
Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
You include any and all error messages in full
You ask clear questions
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.