CrowdConnect is a collaborative problem-solving platform designed to facilitate community engagement and effective solutions through voting, comments, and user authentication. This repository contains the backend implementation of the CrowdConnect application using Spring Boot and MySQL.
- Features
- Technologies Used
- Setup Instructions
- API Endpoints
- Authentication
- Database Schema
- Contributing
- License
- User Authentication: Secure user registration and login using JSON Web Tokens (JWT).
- Solution Management: Create, read, update, and delete solutions.
- Voting System: Users can vote on solutions, promoting community involvement.
- Comments Section: Users can leave comments on solutions for discussions.
- CORS Support: Cross-Origin Resource Sharing support for frontend integration.
- Java
- Spring Boot
- Spring Boot Starter
- Spring Boot Starter Data JPA
- Spring Boot Starter Security
- Spring Boot DevTools
- Spring Boot Starter Web
- Hibernate JPA
- MySQL
- JSON Web Token (JWT)
- BCrypt for Password Encryption
- RESTful API Principles
-
Clone the Repository:
git clone https://github.com/yourusername/crowdconnect-backend.git cd crowdconnect-backend
-
Install Dependencies: Make sure you have Maven installed. Run:
mvn clean install
-
Configure Database: Update the
application.properties
file with your MySQL database credentials:spring.datasource.url=jdbc:mysql://localhost:3306/crowdconnect spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update
-
Run the Application: You can run the application using the following command:
mvn spring-boot:run
-
Access the API: The API will be available at
http://localhost:8080
.
- POST
/api/auth/register
: Register a new user. - POST
/api/auth/login
: Authenticate a user and return a JWT token.
- GET
/api/solutions
: Retrieve a list of solutions. - POST
/api/solutions
: Create a new solution. - GET
/api/solutions/{solutionId}
: Retrieve a specific solution. - PUT
/api/solutions/{solutionId}
: Update an existing solution. - DELETE
/api/solutions/{solutionId}
: Delete a specific solution.
- POST
/api/solutions/{solutionId}/vote
: Vote on a solution. - GET
/api/solutions/{solutionId}/votes
: Retrieve votes for a specific solution.
- POST
/api/solutions/{solutionId}/comments
: Add a comment to a solution. - GET
/api/solutions/{solutionId}/comments
: Retrieve comments for a specific solution.
- All API requests (except for registration and login) require a valid JWT token in the
Authorization
header. Use the format:Authorization: Bearer <token>
The database schema includes tables for users, solutions, votes, and comments. Please refer to the database migration files for more detailed schema information.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes and commit them (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Create a pull request.