├── .gitignore ├── LICENSE ├── README.md └── frontend & backend ├── mvnw ├── mvnw.cmd ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── chattingapp │ │ │ ├── ChatappApplication.java │ │ │ ├── config │ │ │ ├── SecurityConfig.java │ │ │ └── WebSocketConfig.java │ │ │ ├── controller │ │ │ ├── AccountController.java │ │ │ └── ChatController.java │ │ │ ├── model │ │ │ ├── Account.java │ │ │ ├── ChatRoom.java │ │ │ ├── Message.java │ │ │ ├── Notification.java │ │ │ └── Status.java │ │ │ ├── repository │ │ │ ├── AccountRepository.java │ │ │ ├── ChatRoomRepository.java │ │ │ └── MessageRepository.java │ │ │ └── service │ │ │ ├── AccountService.java │ │ │ ├── ChatRoomService.java │ │ │ └── MessageService.java │ └── resources │ │ ├── application.properties │ │ ├── static │ │ └── sql-script │ │ │ └── SQLScript.txt │ │ └── templates │ │ ├── index.html │ │ ├── login.html │ │ └── register.html └── test │ └── java │ └── com │ └── example │ └── chattingapp │ └── ChatappApplicationTests.java └── target └── classes ├── application.properties ├── com └── example │ └── chattingapp │ ├── ChatappApplication.class │ ├── config │ ├── SecurityConfig.class │ └── WebSocketConfig.class │ ├── controller │ ├── AccountController.class │ └── ChatController.class │ ├── model │ ├── Account.class │ ├── ChatRoom$ChatRoomBuilder.class │ ├── ChatRoom.class │ ├── Message.class │ ├── Notification.class │ └── Status.class │ ├── repository │ ├── AccountRepository.class │ ├── ChatRoomRepository.class │ └── MessageRepository.class │ └── service │ ├── AccountService.class │ ├── ChatRoomService.class │ └── MessageService.class ├── static └── sql-script │ └── SQLScript.txt └── templates ├── index.html ├── login.html └── register.html /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | .pnpm-debug.log* 9 | 10 | # Diagnostic reports (https://nodejs.org/api/report.html) 11 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 12 | 13 | # Runtime data 14 | pids 15 | *.pid 16 | *.seed 17 | *.pid.lock 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 30 | .grunt 31 | 32 | # Bower dependency directory (https://bower.io/) 33 | bower_components 34 | 35 | # node-waf configuration 36 | .lock-wscript 37 | 38 | # Compiled binary addons (https://nodejs.org/api/addons.html) 39 | build/Release 40 | 41 | # Dependency directories 42 | node_modules/ 43 | jspm_packages/ 44 | 45 | # Snowpack dependency directory (https://snowpack.dev/) 46 | web_modules/ 47 | 48 | # TypeScript cache 49 | *.tsbuildinfo 50 | 51 | # Optional npm cache directory 52 | .npm 53 | 54 | # Optional eslint cache 55 | .eslintcache 56 | 57 | # Optional stylelint cache 58 | .stylelintcache 59 | 60 | # Microbundle cache 61 | .rpt2_cache/ 62 | .rts2_cache_cjs/ 63 | .rts2_cache_es/ 64 | .rts2_cache_umd/ 65 | 66 | # Optional REPL history 67 | .node_repl_history 68 | 69 | # Output of 'npm pack' 70 | *.tgz 71 | 72 | # Yarn Integrity file 73 | .yarn-integrity 74 | 75 | # dotenv environment variable files 76 | .env 77 | .env.development.local 78 | .env.test.local 79 | .env.production.local 80 | .env.local 81 | 82 | # parcel-bundler cache (https://parceljs.org/) 83 | .cache 84 | .parcel-cache 85 | 86 | # Next.js build output 87 | .next 88 | out 89 | 90 | # Nuxt.js build / generate output 91 | .nuxt 92 | dist 93 | 94 | # Gatsby files 95 | .cache/ 96 | # Comment in the public line in if your project uses Gatsby and not Next.js 97 | # https://nextjs.org/blog/next-9-1#public-directory-support 98 | # public 99 | 100 | # vuepress build output 101 | .vuepress/dist 102 | 103 | # vuepress v2.x temp and cache directory 104 | .temp 105 | .cache 106 | 107 | # vitepress build output 108 | **/.vitepress/dist 109 | 110 | # vitepress cache directory 111 | **/.vitepress/cache 112 | 113 | # Docusaurus cache and generated files 114 | .docusaurus 115 | 116 | # Serverless directories 117 | .serverless/ 118 | 119 | # FuseBox cache 120 | .fusebox/ 121 | 122 | # DynamoDB Local files 123 | .dynamodb/ 124 | 125 | # TernJS port file 126 | .tern-port 127 | 128 | # Stores VSCode versions used for testing VSCode extensions 129 | .vscode-test 130 | 131 | # yarn v2 132 | .yarn/cache 133 | .yarn/unplugged 134 | .yarn/build-state.yml 135 | .yarn/install-state.gz 136 | .pnp.* 137 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 HARIHARAN S 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🚀 Real-Time Chat Application with Spring Boot 2 | 3 | A modern real-time chat application built with Spring Boot and WebSocket technology. This application enables instant messaging between users with support for group chats, typing indicators, and online status tracking. 4 | 5 | ## 🌟 Features 6 | 7 | - 💬 Real-time messaging using WebSocket 8 | - 👥 Group chat functionality 9 | - ⌨️ Typing indicators 10 | - 🟢 Online/Offline status 11 | - 🔒 Secure authentication 12 | - 📱 Responsive design 13 | - 🔄 Message persistence 14 | - 🎨 Modern UI/UX 15 | 16 | ## 🛠️ Tech Stack 17 | 18 | - **Backend:** 19 | - Spring Boot 20 | - WebSocket 21 | - STOMP Protocol 22 | - Spring Security 23 | - Spring Data JPA 24 | - MySQL/PostgreSQL 25 | 26 | - **Frontend:** 27 | - React.js 28 | - Material-UI 29 | - Socket.io-client 30 | - Redux 31 | 32 | ## 📁 Project Structure 33 | 34 | ``` 35 | 📦 realtime-chatapp-springboot 36 | ┣ 📂 .mvn 37 | ┣ 📂 src 38 | ┃ ┣ 📂 main 39 | ┃ ┃ ┣ 📂 java 40 | ┃ ┃ ┃ ┗ 📂 com 41 | ┃ ┃ ┃ ┃ ┗ 📂 example 42 | ┃ ┃ ┃ ┃ ┃ ┗ 📂 chattingapp 43 | ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂 config 44 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 WebSocketConfig.java 45 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 SecurityConfig.java 46 | ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂 controller 47 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 ChatController.java 48 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 AccountController.java 49 | ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂 model 50 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 Account.java 51 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 ChatRoom.java 52 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 Message.java 53 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 Notification.java 54 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 Status.java 55 | ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂 repository 56 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 AccountRepository.java 57 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 ChatRoomRepository.java 58 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 MessageRepository.java 59 | ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂 service 60 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 AccountService.java 61 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣ 📜 ChatRoomService.java 62 | ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 MessageService.java 63 | ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜 ChatappApplication.java 64 | ┃ ┃ ┣ 📂 resources 65 | ┃ ┃ ┃ ┣ 📂 static 66 | ┃ ┃ ┃ ┣ 📂 templates 67 | ┃ ┃ ┃ ┗ 📜 application.properties 68 | ┃ ┣ 📂 test 69 | ┣ 📜 pom.xml 70 | ┣ 📜 mvnw 71 | ┣ 📜 mvnw.cmd 72 | ┣ 📜 .gitignore 73 | ┗ 📜 README.md 74 | ``` 75 | 76 | ## 🚀 Getting Started 77 | 78 | ### Prerequisites 79 | 80 | - Java 11 or higher 81 | - Maven 82 | - Node.js and npm 83 | - MySQL/PostgreSQL 84 | 85 | ### Installation 86 | 87 | 1. Clone the repository: 88 | ```bash 89 | git clone https://github.com/HARIHARANS24/realtime-chatapp-springboot.git 90 | ``` 91 | 92 | 2. Configure the database in `application.properties` 93 | 94 | 3. Build and run the backend: 95 | ```bash 96 | mvn clean install 97 | mvn spring-boot:run 98 | ``` 99 | 100 | 4. Install frontend dependencies and run: 101 | ```bash 102 | cd frontend 103 | npm install 104 | npm start 105 | ``` 106 | 107 | ## 🔧 Configuration 108 | 109 | The application can be configured through `application.properties`: 110 | 111 | ```properties 112 | # Database Configuration 113 | spring.datasource.url=jdbc:mysql://localhost:3306/chatapp 114 | spring.datasource.username=your_username 115 | spring.datasource.password=your_password 116 | 117 | # WebSocket Configuration 118 | websocket.endpoint=/ws 119 | websocket.allowed-origins=* 120 | ``` 121 | 122 | ## 🤝 Contributing 123 | 124 | Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change. 125 | 126 | 1. Fork the repository 127 | 2. Create your feature branch (`git checkout -b feature/AmazingFeature`) 128 | 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) 129 | 4. Push to the branch (`git push origin feature/AmazingFeature`) 130 | 5. Open a Pull Request 131 | 132 | ## 📝 License 133 | 134 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 135 | 136 | ## 👥 Authors 137 | 138 | - **HARIHARANS24** - *Initial work* - [GitHub Profile](https://github.com/HARIHARANS24) 139 | 140 | ## 🙏 Acknowledgments 141 | 142 | - Spring Boot Team 143 | - WebSocket Community 144 | - All contributors and supporters 145 | -------------------------------------------------------------------------------- /frontend & backend/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.3.2 23 | # 24 | # Optional ENV vars 25 | # ----------------- 26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source 27 | # MVNW_REPOURL - repo url base for downloading maven distribution 28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output 30 | # ---------------------------------------------------------------------------- 31 | 32 | set -euf 33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x 34 | 35 | # OS specific support. 36 | native_path() { printf %s\\n "$1"; } 37 | case "$(uname)" in 38 | CYGWIN* | MINGW*) 39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" 40 | native_path() { cygpath --path --windows "$1"; } 41 | ;; 42 | esac 43 | 44 | # set JAVACMD and JAVACCMD 45 | set_java_home() { 46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched 47 | if [ -n "${JAVA_HOME-}" ]; then 48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 49 | # IBM's JDK on AIX uses strange locations for the executables 50 | JAVACMD="$JAVA_HOME/jre/sh/java" 51 | JAVACCMD="$JAVA_HOME/jre/sh/javac" 52 | else 53 | JAVACMD="$JAVA_HOME/bin/java" 54 | JAVACCMD="$JAVA_HOME/bin/javac" 55 | 56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then 57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 59 | return 1 60 | fi 61 | fi 62 | else 63 | JAVACMD="$( 64 | 'set' +e 65 | 'unset' -f command 2>/dev/null 66 | 'command' -v java 67 | )" || : 68 | JAVACCMD="$( 69 | 'set' +e 70 | 'unset' -f command 2>/dev/null 71 | 'command' -v javac 72 | )" || : 73 | 74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then 75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 76 | return 1 77 | fi 78 | fi 79 | } 80 | 81 | # hash string like Java String::hashCode 82 | hash_string() { 83 | str="${1:-}" h=0 84 | while [ -n "$str" ]; do 85 | char="${str%"${str#?}"}" 86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) 87 | str="${str#?}" 88 | done 89 | printf %x\\n $h 90 | } 91 | 92 | verbose() { :; } 93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } 94 | 95 | die() { 96 | printf %s\\n "$1" >&2 97 | exit 1 98 | } 99 | 100 | trim() { 101 | # MWRAPPER-139: 102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. 103 | # Needed for removing poorly interpreted newline sequences when running in more 104 | # exotic environments such as mingw bash on Windows. 105 | printf "%s" "${1}" | tr -d '[:space:]' 106 | } 107 | 108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties 109 | while IFS="=" read -r key value; do 110 | case "${key-}" in 111 | distributionUrl) distributionUrl=$(trim "${value-}") ;; 112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; 113 | esac 114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" 115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" 116 | 117 | case "${distributionUrl##*/}" in 118 | maven-mvnd-*bin.*) 119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ 120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in 121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; 122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; 123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; 124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; 125 | *) 126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 127 | distributionPlatform=linux-amd64 128 | ;; 129 | esac 130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" 131 | ;; 132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; 133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; 134 | esac 135 | 136 | # apply MVNW_REPOURL and calculate MAVEN_HOME 137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" 139 | distributionUrlName="${distributionUrl##*/}" 140 | distributionUrlNameMain="${distributionUrlName%.*}" 141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}" 142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" 143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" 144 | 145 | exec_maven() { 146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : 147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" 148 | } 149 | 150 | if [ -d "$MAVEN_HOME" ]; then 151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME" 152 | exec_maven "$@" 153 | fi 154 | 155 | case "${distributionUrl-}" in 156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; 157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; 158 | esac 159 | 160 | # prepare tmp dir 161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then 162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } 163 | trap clean HUP INT TERM EXIT 164 | else 165 | die "cannot create temp dir" 166 | fi 167 | 168 | mkdir -p -- "${MAVEN_HOME%/*}" 169 | 170 | # Download and Install Apache Maven 171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 172 | verbose "Downloading from: $distributionUrl" 173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 174 | 175 | # select .zip or .tar.gz 176 | if ! command -v unzip >/dev/null; then 177 | distributionUrl="${distributionUrl%.zip}.tar.gz" 178 | distributionUrlName="${distributionUrl##*/}" 179 | fi 180 | 181 | # verbose opt 182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' 183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v 184 | 185 | # normalize http auth 186 | case "${MVNW_PASSWORD:+has-password}" in 187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; 188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; 189 | esac 190 | 191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then 192 | verbose "Found wget ... using wget" 193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" 194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then 195 | verbose "Found curl ... using curl" 196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" 197 | elif set_java_home; then 198 | verbose "Falling back to use Java to download" 199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" 200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" 201 | cat >"$javaSource" <<-END 202 | public class Downloader extends java.net.Authenticator 203 | { 204 | protected java.net.PasswordAuthentication getPasswordAuthentication() 205 | { 206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); 207 | } 208 | public static void main( String[] args ) throws Exception 209 | { 210 | setDefault( new Downloader() ); 211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); 212 | } 213 | } 214 | END 215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java 216 | verbose " - Compiling Downloader.java ..." 217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" 218 | verbose " - Running Downloader.java ..." 219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" 220 | fi 221 | 222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 223 | if [ -n "${distributionSha256Sum-}" ]; then 224 | distributionSha256Result=false 225 | if [ "$MVN_CMD" = mvnd.sh ]; then 226 | echo "Checksum validation is not supported for maven-mvnd." >&2 227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 228 | exit 1 229 | elif command -v sha256sum >/dev/null; then 230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then 231 | distributionSha256Result=true 232 | fi 233 | elif command -v shasum >/dev/null; then 234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then 235 | distributionSha256Result=true 236 | fi 237 | else 238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 240 | exit 1 241 | fi 242 | if [ $distributionSha256Result = false ]; then 243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 245 | exit 1 246 | fi 247 | fi 248 | 249 | # unzip and move 250 | if command -v unzip >/dev/null; then 251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" 252 | else 253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" 254 | fi 255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" 256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" 257 | 258 | clean || : 259 | exec_maven "$@" 260 | -------------------------------------------------------------------------------- /frontend & backend/mvnw.cmd: -------------------------------------------------------------------------------- 1 | <# : batch portion 2 | @REM ---------------------------------------------------------------------------- 3 | @REM Licensed to the Apache Software Foundation (ASF) under one 4 | @REM or more contributor license agreements. See the NOTICE file 5 | @REM distributed with this work for additional information 6 | @REM regarding copyright ownership. The ASF licenses this file 7 | @REM to you under the Apache License, Version 2.0 (the 8 | @REM "License"); you may not use this file except in compliance 9 | @REM with the License. You may obtain a copy of the License at 10 | @REM 11 | @REM http://www.apache.org/licenses/LICENSE-2.0 12 | @REM 13 | @REM Unless required by applicable law or agreed to in writing, 14 | @REM software distributed under the License is distributed on an 15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | @REM KIND, either express or implied. See the License for the 17 | @REM specific language governing permissions and limitations 18 | @REM under the License. 19 | @REM ---------------------------------------------------------------------------- 20 | 21 | @REM ---------------------------------------------------------------------------- 22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2 23 | @REM 24 | @REM Optional ENV vars 25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution 26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output 28 | @REM ---------------------------------------------------------------------------- 29 | 30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) 31 | @SET __MVNW_CMD__= 32 | @SET __MVNW_ERROR__= 33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% 34 | @SET PSModulePath= 35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( 36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) 37 | ) 38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% 39 | @SET __MVNW_PSMODULEP_SAVE= 40 | @SET __MVNW_ARG0_NAME__= 41 | @SET MVNW_USERNAME= 42 | @SET MVNW_PASSWORD= 43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) 44 | @echo Cannot start maven from wrapper >&2 && exit /b 1 45 | @GOTO :EOF 46 | : end batch / begin powershell #> 47 | 48 | $ErrorActionPreference = "Stop" 49 | if ($env:MVNW_VERBOSE -eq "true") { 50 | $VerbosePreference = "Continue" 51 | } 52 | 53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties 54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl 55 | if (!$distributionUrl) { 56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 57 | } 58 | 59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { 60 | "maven-mvnd-*" { 61 | $USE_MVND = $true 62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" 63 | $MVN_CMD = "mvnd.cmd" 64 | break 65 | } 66 | default { 67 | $USE_MVND = $false 68 | $MVN_CMD = $script -replace '^mvnw','mvn' 69 | break 70 | } 71 | } 72 | 73 | # apply MVNW_REPOURL and calculate MAVEN_HOME 74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 75 | if ($env:MVNW_REPOURL) { 76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } 77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" 78 | } 79 | $distributionUrlName = $distributionUrl -replace '^.*/','' 80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' 81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" 82 | if ($env:MAVEN_USER_HOME) { 83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" 84 | } 85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' 86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" 87 | 88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { 89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" 90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 91 | exit $? 92 | } 93 | 94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { 95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" 96 | } 97 | 98 | # prepare tmp dir 99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile 100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" 101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null 102 | trap { 103 | if ($TMP_DOWNLOAD_DIR.Exists) { 104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 106 | } 107 | } 108 | 109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null 110 | 111 | # Download and Install Apache Maven 112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 113 | Write-Verbose "Downloading from: $distributionUrl" 114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 115 | 116 | $webclient = New-Object System.Net.WebClient 117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { 118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) 119 | } 120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null 122 | 123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum 125 | if ($distributionSha256Sum) { 126 | if ($USE_MVND) { 127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." 128 | } 129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash 130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { 131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." 132 | } 133 | } 134 | 135 | # unzip and move 136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null 137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null 138 | try { 139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null 140 | } catch { 141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { 142 | Write-Error "fail to move MAVEN_HOME" 143 | } 144 | } finally { 145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 147 | } 148 | 149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 150 | -------------------------------------------------------------------------------- /frontend & backend/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.4.0 9 | 10 | 11 | com.example 12 | chatapp 13 | 0.0.1-SNAPSHOT 14 | chatapp 15 | Web Chat App for one to one chat 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 17 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-data-jpa 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-security 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-thymeleaf 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-web 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-starter-websocket 52 | 53 | 54 | org.thymeleaf.extras 55 | thymeleaf-extras-springsecurity6 56 | 57 | 58 | 59 | com.mysql 60 | mysql-connector-j 61 | runtime 62 | 63 | 64 | org.projectlombok 65 | lombok 66 | 1.18.28 67 | provided 68 | 69 | 70 | org.springframework.boot 71 | spring-boot-starter-test 72 | test 73 | 74 | 75 | org.springframework.security 76 | spring-security-test 77 | test 78 | 79 | 80 | 81 | 82 | 83 | 84 | org.apache.maven.plugins 85 | maven-compiler-plugin 86 | 87 | 88 | 89 | org.projectlombok 90 | lombok 91 | 92 | 93 | 94 | 95 | 96 | org.springframework.boot 97 | spring-boot-maven-plugin 98 | 99 | 100 | 101 | org.projectlombok 102 | lombok 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/ChatappApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ChatappApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ChatappApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.config; 2 | 3 | import com.example.chattingapp.service.AccountService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 10 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 11 | import org.springframework.security.crypto.password.PasswordEncoder; 12 | import org.springframework.security.web.SecurityFilterChain; 13 | import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 14 | 15 | @Configuration 16 | @EnableWebSecurity 17 | public class SecurityConfig { 18 | 19 | @Autowired 20 | AccountService accountService; 21 | 22 | @Bean 23 | public static PasswordEncoder passwordEncoder() { 24 | return new BCryptPasswordEncoder(); 25 | } 26 | 27 | @Bean 28 | public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { 29 | http 30 | .csrf(csrf -> csrf.disable()) 31 | .authorizeHttpRequests(authz -> authz 32 | .requestMatchers("/css/**", "/js/**", "/images/**", "/webjars/**").permitAll() 33 | .requestMatchers("/register").permitAll() 34 | .anyRequest().authenticated() 35 | ) 36 | .formLogin(form -> form 37 | .loginPage("/login") 38 | .loginProcessingUrl("/login") 39 | .defaultSuccessUrl("/index", true) 40 | .permitAll() 41 | ) 42 | .logout(logout -> logout 43 | .invalidateHttpSession(true) 44 | .clearAuthentication(true) 45 | .logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 46 | .logoutSuccessUrl("/login?logout") 47 | .permitAll() 48 | ) 49 | .headers(headers -> headers 50 | .frameOptions(frameOptions -> frameOptions.sameOrigin()) 51 | ); 52 | 53 | return http.build(); 54 | } 55 | 56 | @Autowired 57 | public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { 58 | auth.userDetailsService(accountService).passwordEncoder(passwordEncoder()); 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.messaging.converter.DefaultContentTypeResolver; 6 | import org.springframework.messaging.converter.MappingJackson2MessageConverter; 7 | import org.springframework.messaging.converter.MessageConverter; 8 | import org.springframework.messaging.simp.config.MessageBrokerRegistry; 9 | import org.springframework.util.MimeTypeUtils; 10 | import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; 11 | import org.springframework.web.socket.config.annotation.StompEndpointRegistry; 12 | import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; 13 | 14 | import java.util.List; 15 | 16 | @Configuration 17 | @EnableWebSocketMessageBroker 18 | public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { 19 | 20 | @Override 21 | public void configureMessageBroker(MessageBrokerRegistry registry) { 22 | registry.enableSimpleBroker("/user"); 23 | registry.setApplicationDestinationPrefixes("/app"); 24 | registry.setUserDestinationPrefix("/user"); 25 | } 26 | 27 | @Override 28 | public void registerStompEndpoints(StompEndpointRegistry registry) { 29 | registry.addEndpoint("/ws") 30 | .withSockJS(); 31 | } 32 | 33 | @Override 34 | public boolean configureMessageConverters(List messageConverters) { 35 | DefaultContentTypeResolver resolver = new DefaultContentTypeResolver(); 36 | resolver.setDefaultMimeType(MimeTypeUtils.APPLICATION_JSON); 37 | MappingJackson2MessageConverter converter = new MappingJackson2MessageConverter(); 38 | converter.setObjectMapper(new ObjectMapper()); 39 | converter.setContentTypeResolver(resolver); 40 | messageConverters.add(converter); 41 | return false; 42 | } 43 | } -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/controller/AccountController.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.controller; 2 | 3 | import com.example.chattingapp.model.Account; 4 | import com.example.chattingapp.service.AccountService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.ResponseEntity; 7 | import org.springframework.messaging.handler.annotation.MessageMapping; 8 | import org.springframework.messaging.handler.annotation.Payload; 9 | import org.springframework.messaging.handler.annotation.SendTo; 10 | import org.springframework.security.core.context.SecurityContextHolder; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.ui.Model; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.PostMapping; 15 | import org.springframework.web.bind.annotation.RequestParam; 16 | 17 | import java.util.List; 18 | 19 | @Controller 20 | public class AccountController { 21 | 22 | @Autowired 23 | private AccountService accountService; 24 | 25 | @GetMapping("/register") 26 | public String showRegistrationForm() { 27 | return "register"; 28 | } 29 | 30 | @PostMapping("/register") 31 | public String registerAccount(@RequestParam String username, @RequestParam String password, Model model) { 32 | try { 33 | accountService.registerAccount(username, password); 34 | return "redirect:/login"; 35 | } catch (RuntimeException e) { 36 | model.addAttribute("error", e.getMessage()); 37 | return "register"; 38 | } 39 | } 40 | 41 | @GetMapping("/login") 42 | public String login() { 43 | return "login"; 44 | } 45 | 46 | @GetMapping("/index") 47 | public String index( Model model) { 48 | String username = SecurityContextHolder.getContext().getAuthentication().getName(); 49 | model.addAttribute("username", username); 50 | return "index"; 51 | } 52 | 53 | @MessageMapping("/user.addUser") 54 | @SendTo("/user/public") 55 | public Account addUser( 56 | @Payload Account user 57 | ) { 58 | accountService.saveUser(user); 59 | return user; 60 | } 61 | 62 | @MessageMapping("/user.disconnectUser") 63 | @SendTo("/user/public") 64 | public Account disconnectUser( 65 | @Payload Account user 66 | ) { 67 | accountService.disconnect(user); 68 | return user; 69 | } 70 | 71 | @GetMapping("/users") 72 | public ResponseEntity> findConnectedUsers() { 73 | return ResponseEntity.ok(accountService.findConnectedUsers()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/controller/ChatController.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.controller; 2 | 3 | import com.example.chattingapp.model.Message; 4 | import com.example.chattingapp.model.Notification; 5 | import com.example.chattingapp.service.MessageService; 6 | import lombok.RequiredArgsConstructor; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.messaging.handler.annotation.MessageMapping; 9 | import org.springframework.messaging.handler.annotation.Payload; 10 | import org.springframework.messaging.simp.SimpMessagingTemplate; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.PathVariable; 14 | 15 | import java.util.List; 16 | 17 | @Controller 18 | @RequiredArgsConstructor 19 | public class ChatController { 20 | 21 | private final SimpMessagingTemplate messagingTemplate; 22 | private final MessageService messageService; 23 | 24 | @MessageMapping("/chat") 25 | public void process(@Payload Message message) { 26 | Message savedMessage = messageService.save(message); 27 | messagingTemplate.convertAndSendToUser( 28 | message.getReceiverId(), 29 | "/queue/messages", 30 | new Notification( 31 | savedMessage.getId(), 32 | savedMessage.getSenderId(), 33 | savedMessage.getReceiverId(), 34 | savedMessage.getContent() 35 | ) 36 | ); 37 | } 38 | 39 | @GetMapping("/messages/{senderId}/{receiverId}") 40 | public ResponseEntity> getChatMessages( 41 | @PathVariable String senderId, 42 | @PathVariable String receiverId 43 | ) { 44 | var chatMessages = messageService.getChatMessage(senderId, receiverId); 45 | return ResponseEntity.ok(chatMessages); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/model/Account.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.model; 2 | 3 | import jakarta.persistence.*; 4 | import lombok.*; 5 | import org.springframework.security.core.GrantedAuthority; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | 8 | import java.util.Collection; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | @Entity 14 | public class Account implements UserDetails { 15 | 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private Long id; 19 | private String username; 20 | private String password; 21 | private Status status; 22 | 23 | @Transient 24 | private Collection authorities; 25 | 26 | public Account(String username, String password, Collection authorities) { 27 | this.username = username; 28 | this.password = password; 29 | this.authorities = authorities; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/model/ChatRoom.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Builder; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | @Data 13 | @Builder 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Entity 17 | public class ChatRoom { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | private Long id; 21 | private String chatId; 22 | private String senderId; 23 | private String receiverId; 24 | } 25 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/model/Message.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.*; 8 | 9 | import java.util.Date; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @Entity 15 | public class Message { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private Long id; 19 | private String chatId; 20 | private String senderId; 21 | private String receiverId; 22 | private String content; 23 | private Date timestamp; 24 | } 25 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/model/Notification.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.model; 2 | 3 | import jakarta.persistence.Entity; 4 | import jakarta.persistence.GeneratedValue; 5 | import jakarta.persistence.GenerationType; 6 | import jakarta.persistence.Id; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @Entity 15 | public class Notification { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private Long id; 19 | private String senderId; 20 | private String receiverId; 21 | private String content; 22 | } 23 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/model/Status.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.model; 2 | 3 | public enum Status { 4 | ONLINE, OFFLINE 5 | } 6 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/repository/AccountRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.repository; 2 | 3 | import com.example.chattingapp.model.Account; 4 | import com.example.chattingapp.model.Status; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | import java.util.List; 8 | import java.util.Optional; 9 | 10 | public interface AccountRepository extends JpaRepository { 11 | Optional findByUsername(String username); 12 | List findAllByStatus(Status status); 13 | } 14 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/repository/ChatRoomRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.repository; 2 | 3 | import com.example.chattingapp.model.ChatRoom; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface ChatRoomRepository extends JpaRepository { 9 | Optional findBySenderIdAndReceiverId(String senderId, String receiverId); 10 | } 11 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/repository/MessageRepository.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.repository; 2 | 3 | import com.example.chattingapp.model.Message; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.List; 7 | 8 | public interface MessageRepository extends JpaRepository { 9 | List findByChatId(String chatId); 10 | } 11 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/service/AccountService.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.service; 2 | 3 | import com.example.chattingapp.model.Account; 4 | import com.example.chattingapp.model.Status; 5 | import com.example.chattingapp.repository.AccountRepository; 6 | import lombok.RequiredArgsConstructor; 7 | import org.springframework.security.core.GrantedAuthority; 8 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 9 | import org.springframework.security.core.userdetails.UserDetails; 10 | import org.springframework.security.core.userdetails.UserDetailsService; 11 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 12 | import org.springframework.security.crypto.password.PasswordEncoder; 13 | import org.springframework.stereotype.Service; 14 | 15 | import java.util.Arrays; 16 | import java.util.Collection; 17 | import java.util.List; 18 | 19 | @Service 20 | @RequiredArgsConstructor 21 | public class AccountService implements UserDetailsService { 22 | 23 | private final PasswordEncoder passwordEncoder; 24 | private final AccountRepository accountRepository; 25 | 26 | public Account findAccountByUsername(String username) { 27 | return accountRepository.findByUsername(username).orElseThrow(() -> new RuntimeException("Account not found")); 28 | } 29 | 30 | @Override 31 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 32 | 33 | Account account = findAccountByUsername(username); 34 | if (account == null) { 35 | throw new UsernameNotFoundException("Username or Password not found"); 36 | } 37 | 38 | return new Account( 39 | account.getUsername(), 40 | account.getPassword(), 41 | authorities() 42 | ); 43 | } 44 | 45 | public Collection authorities() { 46 | return Arrays.asList(new SimpleGrantedAuthority("USER")); 47 | } 48 | 49 | public Account registerAccount(String username, String password) { 50 | if (accountRepository.findByUsername(username).isPresent()) { 51 | throw new RuntimeException("Username already exists"); 52 | } 53 | 54 | Account account = new Account(); 55 | account.setUsername(username); 56 | account.setPassword(passwordEncoder.encode(password)); // Encrypt password 57 | return accountRepository.save(account); 58 | } 59 | 60 | public List getConnectedUsers() { 61 | return accountRepository.findAllByStatus(Status.ONLINE); 62 | } 63 | 64 | public void saveUser(Account user) { 65 | var existingUser = accountRepository.findByUsername(user.getUsername()).orElse(null); 66 | if (existingUser != null) { 67 | existingUser.setStatus(Status.ONLINE); 68 | accountRepository.save(existingUser); 69 | } 70 | } 71 | 72 | public void disconnect(Account user) { 73 | var existingUser = accountRepository.findByUsername(user.getUsername()).orElse(null); 74 | if (existingUser != null) { 75 | existingUser.setStatus(Status.OFFLINE); 76 | accountRepository.save(existingUser); 77 | } 78 | } 79 | 80 | public List findConnectedUsers() { 81 | return accountRepository.findAllByStatus(Status.ONLINE); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/service/ChatRoomService.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.service; 2 | 3 | import com.example.chattingapp.model.ChatRoom; 4 | import com.example.chattingapp.repository.ChatRoomRepository; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.Optional; 9 | 10 | @Service 11 | @RequiredArgsConstructor 12 | public class ChatRoomService { 13 | 14 | private final ChatRoomRepository chatRoomRepository; 15 | 16 | public Optional getChatRoomId( 17 | String senderId, 18 | String receiverId, 19 | boolean createRoomIfNotExist 20 | ) { 21 | return chatRoomRepository 22 | .findBySenderIdAndReceiverId(senderId, receiverId) 23 | .map(ChatRoom::getChatId) 24 | .or(() -> { 25 | if (createRoomIfNotExist) { 26 | var newChatRoomId = createChatId(senderId, receiverId); 27 | return Optional.of(newChatRoomId); 28 | } 29 | 30 | return Optional.empty(); 31 | }); 32 | } 33 | 34 | private String createChatId(String senderId, String receiverId) { 35 | var chatId = String.format("%s_%s", senderId, receiverId); 36 | 37 | ChatRoom senderReceiver = ChatRoom 38 | .builder() 39 | .chatId(chatId) 40 | .senderId(senderId) 41 | .receiverId(receiverId) 42 | .build(); 43 | 44 | ChatRoom receiverSender = ChatRoom 45 | .builder() 46 | .chatId(chatId) 47 | .senderId(receiverId) 48 | .receiverId(senderId) 49 | .build(); 50 | 51 | chatRoomRepository.save(senderReceiver); 52 | chatRoomRepository.save(receiverSender); 53 | 54 | return chatId; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /frontend & backend/src/main/java/com/example/chattingapp/service/MessageService.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp.service; 2 | 3 | import com.example.chattingapp.model.Message; 4 | import com.example.chattingapp.repository.MessageRepository; 5 | import lombok.RequiredArgsConstructor; 6 | import org.springframework.stereotype.Service; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | @Service 12 | @RequiredArgsConstructor 13 | public class MessageService { 14 | private final MessageRepository messageRepository; 15 | private final ChatRoomService chatRoomService; 16 | 17 | public Message save(Message message) { 18 | var chatId = chatRoomService 19 | .getChatRoomId(message.getSenderId(), message.getReceiverId(), true) 20 | .orElseThrow(() -> new RuntimeException("Chat room could not be created or found")); 21 | message.setChatId(chatId); 22 | messageRepository.save(message); 23 | return message; 24 | } 25 | 26 | public List getChatMessage(String senderId, String receiverId) { 27 | var chatId = chatRoomService.getChatRoomId(senderId, receiverId, false); 28 | return chatId.map(messageRepository::findByChatId).orElse(new ArrayList<>()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /frontend & backend/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=chattingapp 2 | # MySQL Database configuration 3 | spring.datasource.url=jdbc:mysql://localhost:3306/chattingapp?useSSL=false&serverTimezone=UTC 4 | spring.datasource.username=root 5 | spring.datasource.password=root 6 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 7 | 8 | # JPA & Hibernate configuration 9 | spring.jpa.hibernate.ddl-auto=update 10 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect 11 | spring.jpa.show-sql=true 12 | -------------------------------------------------------------------------------- /frontend & backend/src/main/resources/static/sql-script/SQLScript.txt: -------------------------------------------------------------------------------- 1 | CREATE DATABASE chattingapp; -------------------------------------------------------------------------------- /frontend & backend/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Chat App | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 165 | 166 | 167 | 168 | 169 | 177 | 178 | 179 |
180 |
181 | 182 |
183 |
Online Users
184 |
    185 |
    Logged in as:
    186 |
    187 | 188 | 189 |
    190 |
    191 | 192 | 196 |
    197 |
    198 |
    199 | 200 | 201 |
    202 | © 2025 . All rights reserved SwiftChat. | Privacy Policy 203 |
    204 | 205 | 206 | 207 | 208 | 322 | 323 | 324 | -------------------------------------------------------------------------------- /frontend & backend/src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Login | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 110 | 111 | 112 | 113 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /frontend & backend/src/main/resources/templates/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Register | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 117 | 118 | 119 | 120 |
    121 |

    Create your SwiftChat Account

    122 |
    123 |
    124 | 125 | 126 |
    127 |
    128 | 129 | 130 |
    131 |
    132 | 133 | 134 |
    Passwords do not match.
    135 |
    136 | 137 |
    138 | 141 |
    142 | 143 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /frontend & backend/src/test/java/com/example/chattingapp/ChatappApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.chattingapp; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class ChatappApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /frontend & backend/target/classes/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=chattingapp 2 | # MySQL Database configuration 3 | spring.datasource.url=jdbc:mysql://localhost:3306/chattingapp?useSSL=false&serverTimezone=UTC 4 | spring.datasource.username=root 5 | spring.datasource.password=root 6 | spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 7 | 8 | # JPA & Hibernate configuration 9 | spring.jpa.hibernate.ddl-auto=update 10 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect 11 | spring.jpa.show-sql=true 12 | -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/ChatappApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/ChatappApplication.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/config/SecurityConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/config/SecurityConfig.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/config/WebSocketConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/config/WebSocketConfig.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/controller/AccountController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/controller/AccountController.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/controller/ChatController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/controller/ChatController.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/Account.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/Account.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/ChatRoom$ChatRoomBuilder.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/ChatRoom$ChatRoomBuilder.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/ChatRoom.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/ChatRoom.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/Message.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/Message.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/Notification.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/Notification.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/model/Status.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/model/Status.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/repository/AccountRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/repository/AccountRepository.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/repository/ChatRoomRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/repository/ChatRoomRepository.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/repository/MessageRepository.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/repository/MessageRepository.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/service/AccountService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/service/AccountService.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/service/ChatRoomService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/service/ChatRoomService.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/com/example/chattingapp/service/MessageService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HARIHARANS24/realtime-chatapp-springboot/018393606638a657d17232f543ed8f2ae29619a1/frontend & backend/target/classes/com/example/chattingapp/service/MessageService.class -------------------------------------------------------------------------------- /frontend & backend/target/classes/static/sql-script/SQLScript.txt: -------------------------------------------------------------------------------- 1 | CREATE DATABASE chattingapp; -------------------------------------------------------------------------------- /frontend & backend/target/classes/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Chat App | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 165 | 166 | 167 | 168 | 169 | 177 | 178 | 179 |
    180 |
    181 | 182 |
    183 |
    Online Users
    184 |
      185 |
      Logged in as:
      186 |
      187 | 188 | 189 |
      190 |
      191 | 192 | 196 |
      197 |
      198 |
      199 | 200 | 201 |
      202 | © 2025 . All rights reserved SwiftChat. | Privacy Policy 203 |
      204 | 205 | 206 | 207 | 208 | 322 | 323 | 324 | -------------------------------------------------------------------------------- /frontend & backend/target/classes/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Login | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 110 | 111 | 112 | 113 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /frontend & backend/target/classes/templates/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Register | SwiftChat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 117 | 118 | 119 | 120 |
      121 |

      Create your SwiftChat Account

      122 |
      123 |
      124 | 125 | 126 |
      127 |
      128 | 129 | 130 |
      131 |
      132 | 133 | 134 |
      Passwords do not match.
      135 |
      136 | 137 |
      138 | 141 |
      142 | 143 | 159 | 160 | 161 | 162 | --------------------------------------------------------------------------------