A modern, production-ready real-time web chat application built with Spring Boot 3.3.0, WebSockets (STOMP), and Google OAuth2 β featuring instant multi-user messaging, secure authentication, and a responsive chat UI.
- Custom Login & Registration β with BCrypt password hashing via Spring Security
- Google OAuth2 Sign-In β one-click sign-in with your Google account
- Session Management β secure HTTP session tracking after login
- Duplicate User Prevention β username/email uniqueness enforced at the database level
- WebSocket + STOMP β instant bidirectional message delivery
- SockJS Fallback β works even in environments where WebSocket is blocked
- Multi-Channel Support β
#general,#random,#announcements,#help - Message Persistence β chat history stored in the H2 database (last 50 messages)
- Typing Indicators β see when someone else is typing in real-time
- Online/Offline Status β live tracking of who is connected
- Active User List β shown in the sidebar in real-time
- User Join/Leave Notifications β broadcast events on connect/disconnect
- Responsive Design β works on desktop and mobile browsers
- Gradient Dark Theme β modern blue-purple sidebar + clean chat area
- Message Bubbles β clear visual separation for sent vs. received messages
- Smooth Animations β fade-in transitions and micro-interactions
- Emoji Reactions β react to messages with emojis
| Layer | Technology |
|---|---|
| Backend Framework | Spring Boot 3.3.0 |
| Language | Java 21 |
| Real-Time | WebSocket + STOMP + SockJS |
| Security | Spring Security + Google OAuth2 |
| Database | H2 In-Memory (JPA / Hibernate) |
| Templating | Thymeleaf |
| Frontend | HTML5 + CSS3 + Vanilla JavaScript |
| Build Tool | Maven 3.8+ |
| Server | Embedded Apache Tomcat 10 |
JLiveChats/
βββ src/main/java/com/jlivechats/
β βββ JLiveChatsApplication.java # Spring Boot entry point
β βββ config/
β β βββ SecurityConfig.java # Spring Security + OAuth2 config
β β βββ WebSocketConfig.java # STOMP / SockJS WebSocket config
β β βββ SessionAuthenticationFilter.java # Session β Security bridge
β βββ controller/
β β βββ WebController.java # Login, Register, Chat page routes
β β βββ WebSocketController.java # STOMP message handlers
β βββ model/
β β βββ User.java # User JPA entity
β β βββ ChatMessage.java # Message JPA entity
β βββ repository/
β β βββ UserRepository.java # JPA Repository for users
β β βββ ChatMessageRepository.java # JPA Repository for messages
β βββ service/
β βββ AuthenticationService.java # User auth + registration logic
βββ src/main/resources/
β βββ templates/ # Thymeleaf HTML templates
β β βββ login.html
β β βββ register.html
β β βββ chat.html
β βββ static/ # Static assets
β β βββ css/style.css
β β βββ js/
β β βββ index.html
β β βββ script.js
β βββ application.properties # App configuration
βββ pom.xml
βββ Dockerfile
βββ render.yaml
βββ README.md
- Java 17+ β
java -version - Maven 3.8+ β
mvn -version
git clone https://github.com/bhola-dev58/JLiveChats.git
cd JLiveChatsmvn clean packagejava -jar target/jlivechats-1.0.0.jarhttp://localhost:8080
The app will redirect you to
/login. Register a new account or sign in with Google.
By default, the Google credentials in application.properties are pre-configured for local use. If you want to use your own Google Cloud credentials:
- Go to Google Cloud Console
- Create an OAuth2 Client ID
- Add
http://localhost:8080/login/oauth2/code/googleas an Authorized Redirect URI - Update
application.properties:
spring.security.oauth2.client.registration.google.client-id=YOUR_CLIENT_ID
spring.security.oauth2.client.registration.google.client-secret=YOUR_CLIENT_SECRETFor full setup instructions, see GOOGLE_OAUTH_FIX.md
| Endpoint | Type | Description |
|---|---|---|
/ws |
WebSocket | SockJS connection endpoint |
/app/sendMessage |
STOMP Publish | Send a chat message |
/app/typing |
STOMP Publish | Broadcast typing indicator |
/topic/messages |
STOMP Subscribe | Receive new messages |
/topic/users |
STOMP Subscribe | Receive user presence updates |
docker build -t jlivechats .
docker run -p 8080:8080 jlivechats- See DEPLOYMENT.md for step-by-step cloud deployment instructions.
- Passwords are hashed with BCrypt before being stored in the database
- Sessions are secured via Spring Security's filter chain
- OAuth2 tokens are managed by Spring Security OAuth2 Client
- CSRF protection is disabled intentionally to support WebSocket connections
| Problem | Fix |
|---|---|
| Port 8080 already in use | Run lsof -i :8080 and kill the process, or change port in application.properties |
| Google sign-in error 400 | See GOOGLE_OAUTH_FIX.md |
| App won't start | Ensure Java 17+ is installed: java -version |
| Messages not updating | Check browser console for WebSocket connection errors |
- WebSocket real-time messaging
- Google OAuth2 sign-in
- BCrypt password encryption
- Database-backed user registration
- Typing indicators
- Multi-channel support
- Direct Messages (1-on-1)
- File/image sharing
- PostgreSQL migration (production)
- Push notifications
- Admin dashboard
Bhola Yadav
USN: 1CR23CS044 | Section: K | Branch: Computer Science Engineering
GitHub
This project is open-source and available for educational purposes.
JLiveChats β Built with β€οΈ using Spring Boot, WebSockets, and Google OAuth2.