This is a CRUD API built with Spring Boot that integrates Kafka for asynchronous messaging and PostgreSQL as the primary database. The API allows creating, reading, updating, and deleting records while leveraging Kafka for event-driven communication between services. Kafka is used to ensure reliable, scalable, and real-time message delivery.
- CRUD Operations with Kafka for asynchronous messaging capabilities
- Integration with Kafka for reliable data communication
- RESTful API design with clean architecture
- Spring Kafka for message handling and event processing
- Input validation and error handling
- Swagger UI for API documentation and testing
- Spring Boot 2.5.4
- Kafka for event-driven architecture
- Spring Kafka for Kafka integration
- PostgreSQL as the primary database
- Lombok for reducing boilerplate code
- Swagger for API documentation
api-springboot-kafka/
│
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/springboot_kafka/ # Source code and main application
│ ├── resources/
│ │ ├── application.properties # Configuration for PostgreSQL, Kafka
│ └── test/
│ └── java/ # Unit tests for services and controllers
└── pom.xml # Project dependencies
-
Clone the repository
git clone https://github.com/mochrks/api-springboot-kafka.git cd api-springboot-kafka
-
Install dependencies
mvn clean install
-
Set up Kafka and PostgreSQL
- Ensure Kafka and PostgreSQL are running locally or provide your connection details in
application.properties
. - Update the following properties in
src/main/resources/application.properties
:
spring.kafka.bootstrap-servers=localhost:9092 spring.datasource.url=jdbc:postgresql://localhost:5432/your_database spring.datasource.username=your_username spring.datasource.password=your_password
- Ensure Kafka and PostgreSQL are running locally or provide your connection details in
-
Run the application
mvn spring-boot:run
-
The application will be running on
http://localhost:8080
.