This project is a fully reactive REST API built with Spring Boot 3 and Spring WebFlux.
It demonstrates how to build scalable and non-blocking backend services using reactive programming principles, functional endpoints, and MongoDB as the persistence layer.
The application manages products through a complete CRUD workflow and supports multipart file uploads while maintaining a reactive architecture end-to-end.
- Java 22
- Spring Boot 3.3.2
- Spring WebFlux
- Reactive Streams
- MongoDB
- ReactiveMongoRepository
- Functional Routing (RouterFunction)
- Handler Functions
- Bean Validation
- Multipart File Upload
- Maven
flowchart LR
Client["REST Client"]
Router["RouterFunction"]
Handler["ProductoHandler"]
Service["ProductoService"]
Repository["ReactiveMongoRepository"]
MongoDB[("MongoDB")]
Client --> Router
Router --> Handler
Handler --> Service
Service --> Repository
Repository --> MongoDB
- Built using Spring WebFlux and Reactive Streams.
- Fully non-blocking request processing.
- Functional endpoints implemented using RouterFunction and Handler.
- Reactive persistence with ReactiveMongoRepository.
- Clear separation between routing, business logic, and data access layers.
- Multipart file upload support for product images.
- Validation and error handling integrated into the reactive flow.
- Designed following reactive programming and clean architecture principles.
- Full CRUD operations for products.
- Reactive MongoDB integration.
- Multipart image upload support.
- Functional routing architecture.
- Product search by ID.
- Request validation using Bean Validation.
- Non-blocking I/O processing.
- Reactive data access layer.
src/main/java
│
├── models
│ └── documents
│
├── models
│ └── services
│
├── models
│ └── dao
│
├── handlers
│
├── routers
│
├── config
│
└── SpringBootWebfluxApplication
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v2/productos | Get all products |
| GET | /api/v2/productos/{id} | Get product by ID |
| POST | /api/v2/productos | Create a new product |
| PUT | /api/v2/productos/{id} | Update a product |
| DELETE | /api/v2/productos/{id} | Delete a product |
| POST | /api/v2/productos/upload | Upload product image |
Clone the repository:
git clone https://github.com/freyderdev/spring-boot-webflux-apirest.git
cd spring-boot-webflux-apirestStart MongoDB locally:
docker run -d \
--name mongodb \
-p 27017:27017 \
mongoRun the application:
./mvnw spring-boot:runAPI Base URL:
http://localhost:8080/api/v2/productos
- Reactive Programming with Spring WebFlux.
- Functional Endpoint Design.
- Non-blocking REST APIs.
- Reactive Persistence with MongoDB.
- Layered Architecture.
- File Upload Handling.
- Modern Backend Development Practices.
Freyder Otalvaro
Senior Software Engineer | Java | AWS | Distributed Systems
- GitHub: https://github.com/freyderdev
- LinkedIn: https://www.linkedin.com/in/freyder-otalvaro-70484b73/
- Location: Colombia 🇨🇴