Welcome to the Chat Ping Server! This project is the backend implementation of a messaging application that provides secure and scalable server-side services. It handles user authentication, message exchanges, thread management, and more, making it an essential component for real-time communication platforms.
- Authors
- Project Summary
- Features
- Installation
- Usage Guide
- API Documentation
- File Structure
- License
- Feedback
- Contributing
- CSC207: Group 167
- Contributors:
The Chat Ping Server was developed to provide a robust backend solution for a messaging application. It offers:
- Secure authentication and authorization using JWT.
- Real-time messaging support with thread-based communication.
- Scalable architecture using Spring Boot and PostgreSQL.
- Comprehensive API documentation for ease of integration.
- User Authentication: Secure login and registration with password hashing.
- JWT-Based Authorization: Stateless session management for scalability.
- Messaging System:
- Create threads for group or individual messaging.
- Send and retrieve messages within threads.
- Swagger API Documentation: Easily explore and test endpoints.
- Error Handling: Unified error response format for consistency.
- Validation:
- Email and password validation for secure user management.
- Unique username validation.
- Database Integration:
- Supports PostgreSQL for production.
- H2 in-memory database for testing.
- Java: JDK 17+
- Maven: Latest version
- PostgreSQL: For production database
- Git: For cloning the repository
-
Clone the repository:
git clone https://github.com/your-repo/chat-ping-server.git cd chat-ping-server -
Configure the database in
application.properties:- For production:
spring.datasource.url=jdbc:postgresql://<your-db-url>:5432/<your-db-name> spring.datasource.username=<your-db-username> spring.datasource.password=<your-db-password> - For local testing (optional):
spring.datasource.url=jdbc:postgresql://localhost:5432/ spring.datasource.username=postgres spring.datasource.password=1230
- For production:
-
Build the project using Maven:
mvn clean install
-
Run the application:
mvn spring-boot:run
-
Start the server on
http://localhost:5000/. -
Access the Swagger UI for API exploration:
http://localhost:5000/swagger-ui/index.html -
Common Endpoints:
- Authentication:
POST /api/v1/auth/register- Register a new user.POST /api/v1/auth/login- Login with credentials.
- Threads:
POST /api/v1/threads- Create a new thread.GET /api/v1/threads- List all threads.
- Messages:
POST /api/v1/messages- Send a message.GET /api/v1/messages/{threadId}- Retrieve messages in a thread.
- Authentication:
View the full API documentation and try out endpoints via the Swagger UI:
- Swagger UI: http://localhost:5000/swagger-ui/index.html
├── .ebextensions
│ └── nginx.config
├── README.md
├── pom.xml
├── src
│ ├── main
│ │ ├── java
│ │ │ └── chat
│ │ │ └── ping
│ │ │ ├── MainApplication.java
│ │ │ ├── config
│ │ │ ├── entity
│ │ │ ├── infrastructure
│ │ │ ├── shared
│ │ │ └── usecase
│ └── resources
│ └── application.properties
└── test
├── java
└── resources
For a detailed breakdown, refer to the complete file structure in this README's File Structure section.
This project is licensed under the MIT License. For details, refer to the LICENSE file.
We value your feedback! Submit your suggestions, bug reports, or feature requests via:
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
feature-branch). - Commit and push your changes.
- Open a pull request with a detailed description (pull requet template is in the repo).
Guidelines for contributions:
- Write clear and concise commit messages.
- Ensure all tests pass before submitting a pull request.
- Follow the existing code style conventions.
Happy coding!