This is the code base for chat-app implemented using websockets
Java8. Install java
Apache Maven. v3.8.6 Install maven
Node.js. v18.3.0 Install node.js
MySQL from MySQL Workbench
Set up your my sql server
Save your URI, Password and Username
- Navigate application.properties file
cd ./src/main/resources - If using a database other than mySql, then change the following:
spring.datasource.urlto the sql server url
spring.datasource.driver-class-nameto respective driver name
spring.jpa.properties.hibernate.dialectto respective dialect - Enter your username and password for the database in these two slots
spring.datasource.usernameandspring.datasource.password
- Move to the frontend directory
cd ./chat-app-frontend - Install Required Dependencies
npm install - Run the application
npm start - Run the tests
npm test
- Navigate to the root backend directory
- Install all the required maven dependency by running
cd ./src - Run the app
mvn spring-boot:run
Description: The jar file or the docker image would run the frontend and the backend on the same port.
In the main chat-app application folder, run mvn clean install
This command will create a working jar file that could be deployed to a website.
The jar file would in the target folder. Its named a chat-app-backend-0.0.1-SNAPSHOT.jar
Run this jar file by running java -jar path/to/your/jarfile.jar
The Docker container has enviroment varibles setup for the database credentials
ENV DATABASE_URI = database
ENV DATABASE_USER = user
ENV DATABASE_PASSWORD = pass
If you would like to change this, you need also the names in application.properties file as well
By default docker uses the Dockerfile of the current folder if you run a single command like
docker build -e DATABASE_URI = <db_uri> -e DATABASE_USER = <db_user> -e DATABASE_PASSWORD = <db_pass> -t <your_docker_image>
Run your docker image by running the following:
docker run -p 8080:8080 <your_docker_image>