Overview
The Furniture API is a microservice-based REST API built with Spring Boot 3.5.7 and Java 21. It follows a cloud-native architecture pattern with service discovery, enabling scalable and distributed furniture catalog and inventory management.Technology Stack
Core Framework
- Spring Boot 3.5.7 - Main application framework
- Java 21 - Programming language runtime
- Maven - Dependency management and build tool
Data Layer
- PostgreSQL - Primary relational database hosted on Neon (AWS us-east-1)
- Spring Data JPA - Data access abstraction
- Hibernate - ORM implementation with PostgreSQL dialect
Cloud & Service Discovery
- Netflix Eureka Client - Service registration and discovery
- Spring Cloud 2025.0.0 - Cloud-native application support
- Spring Boot Actuator - Health checks and monitoring endpoints
API Documentation
- SpringDoc OpenAPI - Automatic API documentation generation
- Swagger UI - Interactive API documentation at
/doc/swagger-ui.html
Additional Libraries
- Lombok - Reduces boilerplate code with annotations
- ModelMapper 3.2.1 - Object mapping between DTOs and entities
- Gson - JSON serialization/deserialization
- Hibernate Validator - Bean validation
Architecture Pattern
Microservice Registration
The application is configured as a microservice with@EnableDiscoveryClient annotation in the main application class:
The service registers with Eureka Server at
https://furniture-eureka-server.onrender.com/eureka and runs on port 8082.Service Discovery Configuration
The application uses Netflix Eureka for service discovery with the following settings:- Service Name:
microservice-rest - Port: 8082
- Eureka Server:
https://furniture-eureka-server.onrender.com/eureka - IP Preference: Uses IP address instead of hostname
- Registry Fetch: Enabled for client-side load balancing
- Registration: Automatically registers with Eureka on startup
Database Configuration
Connection Details
- Database Type: PostgreSQL
- Database Name:
catalog_and_inventory_db - Hosting: Neon (AWS c-3.us-east-1)
- Connection Pool: Neon pooler for optimized connections
- SSL Mode: Required with channel binding
JPA Configuration
The
ddl-auto=none setting means database schema changes are not automatically applied. Schema migrations should be managed separately.JSON Serialization
The API uses snake_case naming convention for JSON properties:category_id, created_at) instead of camelCase.
CORS Configuration
Cross-Origin Resource Sharing
The API implements CORS to allow cross-origin requests from frontend applications:CORS is configured for
/api/** endpoints only. Requests from https://tu-frontend.com are allowed with standard HTTP methods.API Documentation
Swagger UI is automatically generated and available at:- API docs enabled at
/v3/api-docs - Auto-scans
com.api.furniturepackage for endpoints - Interactive documentation for testing endpoints
Deployment Architecture
Service Components
- Eureka Server - Service registry hosted on Render
- Furniture API Microservice - This application (port 8082)
- PostgreSQL Database - Hosted on Neon cloud
- Frontend Application - Consumes the API (tu-frontend.com)
Communication Flow
Monitoring & Health
Spring Boot Actuator provides monitoring endpoints for:- Application health checks
- Metrics collection
- Service status for Eureka
- Application info
Build & Packaging
The application is packaged as an executable JAR file using Maven:Build Configuration
- Compiler: Maven compiler plugin with Lombok annotation processing
- Spring Boot Plugin: Creates executable JAR with embedded Tomcat
- Java Version: 21
- Tomcat: Embedded server (provided scope)
Lombok is excluded from the final JAR as it’s only needed during compilation for generating boilerplate code.