Skip to main content

Backend Overview

The Iquea Commerce backend is a modern e-commerce REST API built with Spring Boot, providing a robust foundation for managing products, categories, orders, and user authentication.

Technology Stack

Core Framework

  • Java 21 - Latest LTS version with modern language features
  • Spring Boot 3.4.0 - Enterprise-grade application framework
  • Maven - Dependency management and build automation

Key Dependencies

Based on pom.xml, the backend leverages these essential libraries:

Spring Boot Starters

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-validation</artifactId>
</dependency>

Security & Authentication

  • Spring Security - Authentication and authorization
  • JJWT 0.12.6 - JWT token generation and validation
  • BCrypt - Password encryption

Database

  • MySQL Connector - Database connectivity
  • Hibernate/JPA - ORM framework
  • MySQL 8.x - Production database

Development Tools

  • Lombok 1.18.38 - Reduces boilerplate code
  • MapStruct 1.6.0 - Type-safe bean mapping
  • Spring DevTools - Hot reload and development utilities
  • Spring Boot Actuator - Production monitoring and metrics

Project Structure

The backend follows a clean, layered architecture:
com.edu.mcs.Iquea/
├── config/              # Configuration classes
│   └── CorsConfig.java
├── controllers/         # REST API endpoints
│   ├── AuthController.java
│   ├── CategoriaController.java
│   ├── ProductoController.java
│   ├── PedidoController.java
│   └── UsuarioController.java
├── services/            # Business logic layer
│   ├── interfaces/
│   │   ├── IProductoService.java
│   │   ├── ICategoriaService.java
│   │   └── ...
│   └── implementaciones/
│       ├── ProductoServiceImpl.java
│       ├── CategoriaServiceImpl.java
│       └── ...
├── repositories/        # Data access layer
│   ├── ProductoRepository.java
│   ├── CategoriaRepository.java
│   ├── PedidoRepository.java
│   └── UsuarioRepository.java
├── models/              # Domain entities
│   ├── Usuario.java
│   ├── Producto.java
│   ├── Categoria.java
│   ├── Pedido.java
│   ├── Detalle_pedido.java
│   ├── Vo/              # Value Objects
│   │   ├── Email.java
│   │   ├── Precio.java
│   │   └── Dimensiones.java
│   ├── Enums/
│   │   ├── RolUsuario.java
│   │   └── EstadoPedido.java
│   └── dto/             # Data Transfer Objects
│       ├── detalle/
│       └── resumen/
├── mappers/             # DTO ↔ Entity converters
│   ├── ProductoMapper.java
│   ├── CategoriaMapper.java
│   └── ...
├── security/            # Security configuration
│   ├── SecurityConfig.java
│   ├── JwtUtil.java
│   └── JwtFilter.java
├── exceptions/          # Exception handling
│   ├── GlobalExceptionHandler.java
│   └── ApiError.java
└── IqueaApplication.java # Main application class

Development Tools

Lombok

Lombok eliminates boilerplate code by generating getters, setters, constructors, and more at compile time. Configuration in pom.xml:
<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.38</version>
    <scope>provided</scope>
</dependency>

MapStruct

MapStruct provides compile-time type-safe bean mapping between DTOs and entities. Example mapper interface:
@Mapper(componentModel = "spring")
public interface ProductoMapper {
    ProductoDetalleDTO toDTO(Producto producto);
    Producto toEntity(ProductoDetalleDTO dto);
    List<ProductoDetalleDTO> toDTOlist(List<Producto> productos);
}
Configuration in pom.xml:
<dependency>
    <groupId>org.mapstruct</groupId>
    <artifactId>mapstruct</artifactId>
    <version>1.6.0</version>
</dependency>
<dependency>
    <groupId>org.mapstruct</groupId>
    <artifactId>mapstruct-processor</artifactId>
    <version>1.6.0</version>
    <scope>provided</scope>
</dependency>

API Base Configuration

Application runs on:
  • Port: 8080
  • Base URL: http://localhost:8080
  • API Prefix: /api
Common endpoints:
  • /api/auth/* - Authentication endpoints
  • /api/productos - Product management
  • /api/categorias - Category management
  • /api/pedidos - Order management
  • /api/usuarios - User management

Development Workflow

  1. Build the project:
    mvn clean install
    
  2. Run the application:
    mvn spring-boot:run
    
  3. Hot reload: Spring DevTools enables automatic restart when code changes are detected.
  4. Database initialization: The application automatically creates tables and loads initial data from data.sql on startup.

Next Steps

Architecture

Learn about the layered architecture pattern

Domain Model

Explore entities and value objects

Security

Understand JWT authentication and authorization

Database

Database schema and configuration

Build docs developers (and LLMs) love