# kevinxjavier/spring-boot-webflux-apirest architecture

> Architecture diagram of the GitHub repository kevinxjavier/spring-boot-webflux-apirest, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kevinxjavier/spring-boot-webflux-apirest
- Repository: https://github.com/kevinxjavier/spring-boot-webflux-apirest

## Overview

This is a reactive Spring WebFlux product REST API backed by MongoDB. The main workflow is an HTTP client request handled by ProductController, delegated through ProductService to reactive Mongo repositories, and returned as a product response. The API also supports multipart image uploads, while startup code resets collections and seeds sample categories and products. The README documents product CRUD and listing endpoints; source excerpts do not show category endpoints or runtime Mongo configuration, so those links are not asserted.

Main entry points: [`src/main/java/com/kevinpina/services/ProductServiceImpl.java`](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductServiceImpl.java) (Service implementation), [`src/main/java/com/kevinpina/controllers/ProductController.java`](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/controllers/ProductController.java) (Product API), [`src/main/java/com/kevinpina/services/ProductService.java`](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductService.java) (Product service), [`src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java`](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java) (Startup seeding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API layer"]
  node_controller["Product API"]
  node_upload_store[("Image files")]
end

subgraph group_logic["Product logic"]
  node_service["Product service"]
  node_service_impl["Service implementation"]
  node_startup["Startup seeding"]
end

subgraph group_data["Mongo data"]
  node_product_dao["Product repository<br/>[ProductDao.java]"]
  node_category_dao["Category repository<br/>[CategoryDao.java]"]
  node_product["Product document<br/>[Product.java]"]
  node_category["Category document<br/>[Category.java]"]
end

node_client(("HTTP client"))
node_mongo[("MongoDB")]

node_client -->|"sends request"| node_controller
node_controller -->|"calls operations"| node_service
node_service_impl -->|"implements"| node_service
node_service_impl -->|"uses repository"| node_product_dao
node_service_impl -->|"uses repository"| node_category_dao
node_service_impl -->|"queries products"| node_mongo
node_product_dao -.->|"persists products"| node_mongo
node_category_dao -.->|"persists categories"| node_mongo
node_controller -->|"writes images"| node_upload_store
node_startup -->|"drops collections"| node_mongo
node_startup -->|"seeds records"| node_service
node_product -->|"references category"| node_category

click node_controller "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/controllers/ProductController.java"
click node_service "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductService.java"
click node_service_impl "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductServiceImpl.java"
click node_product_dao "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/dao/ProductDao.java"
click node_category_dao "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/dao/CategoryDao.java"
click node_product "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/documents/Product.java"
click node_category "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/documents/Category.java"
click node_startup "https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_upload_store,node_client toneBlue
class node_service,node_service_impl,node_startup,node_mongo toneAmber
class node_product_dao,node_category_dao,node_product,node_category toneMint
```

## Components

### API layer

- [Product API](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/controllers/ProductController.java): `src/main/java/com/kevinpina/controllers/ProductController.java`
- **Image files**

### Product logic

- [Product service](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductService.java): `src/main/java/com/kevinpina/services/ProductService.java`
- [Service implementation](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/services/ProductServiceImpl.java): `src/main/java/com/kevinpina/services/ProductServiceImpl.java`
- [Startup seeding](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java): `src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java`

### Mongo data

- [Product repository](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/dao/ProductDao.java): `src/main/java/com/kevinpina/models/dao/ProductDao.java`
- [Category repository](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/dao/CategoryDao.java): `src/main/java/com/kevinpina/models/dao/CategoryDao.java`
- [Product document](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/documents/Product.java): `src/main/java/com/kevinpina/models/documents/Product.java`
- [Category document](https://github.com/kevinxjavier/spring-boot-webflux-apirest/blob/master/src/main/java/com/kevinpina/models/documents/Category.java): `src/main/java/com/kevinpina/models/documents/Category.java`

### Other components

- **HTTP client**
- **MongoDB**

## Connections

- HTTP client → Product API: sends request (evidence: `README.md`)
- Product API → Product service: calls operations (evidence: `src/main/java/com/kevinpina/controllers/ProductController.java`)
- Service implementation → Product service: implements (evidence: `src/main/java/com/kevinpina/services/ProductServiceImpl.java`)
- Service implementation → Product repository: uses repository (evidence: `src/main/java/com/kevinpina/services/ProductServiceImpl.java`)
- Service implementation → Category repository: uses repository (evidence: `src/main/java/com/kevinpina/services/ProductServiceImpl.java`)
- Service implementation → MongoDB: queries products (evidence: `src/main/java/com/kevinpina/services/ProductServiceImpl.java`)
- Product repository → MongoDB: persists products
- Category repository → MongoDB: persists categories
- Product API → Image files: writes images (evidence: `src/main/java/com/kevinpina/controllers/ProductController.java`)
- Startup seeding → MongoDB: drops collections (evidence: `src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java`)
- Startup seeding → Product service: seeds records (evidence: `src/main/java/com/kevinpina/SpringBootWebfluxApirestApplication.java`)
- Product document → Category document: references category (evidence: `src/main/java/com/kevinpina/models/documents/Product.java`)
