How jciterceros/vr_online_backend works
Project type & purpose
• This is a monolithic Java Spring Boot REST-API backend for an online store (“VR Online”).
• It follows a layered, domain-driven structure with packages per business domain: Endereço, Pessoa, Produtos, Pagamentos, Pedidos, Segurança.
High-level architecture
• Clients (Insomnia/Postman/SPA) → HTTP requests → Spring MVC Controllers → Business Services → Spring Data JPA Repositories → Relational DB
• Cross-cutting concerns: Security (BasicAuth filter, WebSecurityConfig, BCrypt), ModelMapper for DTO mapping, exception handlers
• External integration: ViaCep REST API (through an Adapter)
Main components
a. API Boundary
• HTTP entry point (Controller classes per domain)
• Security filter chain (CustomBasicAuthenticationFilter, WebSecurityConfig)
b. Domain services
• Service interfaces & implementations per domain; PaymentServiceImpl + factories/strategy objects (IPagamentoProcessar, …)
c. Persistence
d. Domain model
• Entities (Pessoa, Produto, Pagamento, Pedido, Endereco, etc.) and DTOs (request/response objects)
e. External system
• ViaCep REST service via EnderecoViaCepAdapter
Interactions & data flow
1. Client → (1) Authentication filter → (2) Controller
2. Controller → calls corresponding Service
3. Service → may use Factory/Strategy (payments) or Adapter (ViaCep) → if data access needed → Repository
4. Repository → Database
5. Service returns DTO → Controller → HTTP Response → Client
Architectural patterns & principles
• Layered architecture (Controller → Service → Repository)
• Domain-driven packages isolating business logic
• Factory & Strategy patterns in Pagamentos
• Adapter pattern for external ViaCep integration
• Dependency Injection for loose coupling
• DTOs + ModelMapper for mapping between domain and API models
Technologies & frameworks to annotate
• Spring Boot (starter-web, data-jpa, security)
• Spring MVC controllers
• Spring Data JPA (repositories)
• ModelMapper (ModelMapperConfig)
• Spring Security (WebSecurityConfig, CustomBasicAuthenticationFilter, BCryptPasswordEncoderAdapter)
• Maven build (pom.xml)
• Clear component labels (e.g., PedidoVendaController, PedidoVendaService, PedidoVendaRepository)
• Logical grouping by domain boundaries