Skip to content

freyderdev/spring-boot-webflux-apirest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Reactive Product API with Spring WebFlux & MongoDB

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.


🚀 Technologies and Tools

  • Java 22
  • Spring Boot 3.3.2
  • Spring WebFlux
  • Reactive Streams
  • MongoDB
  • ReactiveMongoRepository
  • Functional Routing (RouterFunction)
  • Handler Functions
  • Bean Validation
  • Multipart File Upload
  • Maven

🏗️ Architecture Overview

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
Loading

🎯 Architecture Highlights

  • 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.

📦 Features

  • 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.

📂 Project Structure

src/main/java
│
├── models
│   └── documents
│
├── models
│   └── services
│
├── models
│   └── dao
│
├── handlers
│
├── routers
│
├── config
│
└── SpringBootWebfluxApplication

📬 Main Endpoints

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

🧪 How to Run

Clone the repository:

git clone https://github.com/freyderdev/spring-boot-webflux-apirest.git
cd spring-boot-webflux-apirest

Start MongoDB locally:

docker run -d \
  --name mongodb \
  -p 27017:27017 \
  mongo

Run the application:

./mvnw spring-boot:run

API Base URL:

http://localhost:8080/api/v2/productos

🌟 What This Project Demonstrates

  • 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.

👨‍💻 Author

Freyder Otalvaro

Senior Software Engineer | Java | AWS | Distributed Systems

About

Reactive REST API built with Spring Boot, WebFlux, and MongoDB. Includes full CRUD, photo uploads, and functional routing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages