A Spring Boot + MySQL backend for a chat application, featuring JWT authentication, user/channel management, and friend chat functionality.
- User registration and login (JWT-based authentication)
- Channel creation, joining, and membership management
- Friend system with one-on-one chat rooms
- Message sending and retrieval (channels and friend chats)
- RESTful API endpoints
- Integration and controller tests
- Java 17
- Spring Boot 3.2.5
- MySQL 8
- Gradle (Kotlin DSL)
- Lombok
- JJWT (JSON Web Token)
- Java 17+
- Docker (for MySQL, or install MySQL manually)
- Gradle (or use the included
./gradlewwrapper)
You can start a MySQL container with the provided Gradle task:
./gradlew startMysqlOr manually:
docker run --name kungnection -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=kungnection -p 3306:3306 -d mysql:latestEdit src/main/resources/application.properties if you need to change DB credentials.
The app will auto-run schema.sql and data.sql on startup. Test users are included.
./gradlew bootRun./gradlew test- Use Postman or curl to test endpoints (see controller classes for routes)
- Example login:
curl -X POST -H "Content-Type: application/json" -d '{"username":"tester1","password":"testpassword"}' http://localhost:8080/auth/loginsrc/main/java/org/kungnection/- Main Java sourcesrc/main/resources/- Config, schema, and seed datasrc/test/java/org/kungnection/- Tests
./gradlew bootRun- Run the Spring Boot app./gradlew test- Run all tests./gradlew startMysql- Start MySQL via Docker
- Lombok is used for model boilerplate; enable annotation processing in your IDE.
- JWT secret and DB credentials are for development only—change for production.
MIT