Skip to content

Backend Conventions

Paulo Gomes da Cruz Junior edited this page Aug 27, 2026 · 1 revision

Backend Component — Conventions

Package Structure

Sources are organized by layer under ca.bc.gov.nrs.hrs:

  • configuration/: Spring @Configuration beans.
  • controller/: REST API entry points.
  • service/: Business logic and orchestration.
  • repository/: Spring Data JPA interfaces.
  • entity/: JPA entities and persistence models.
  • dto/: Immutable records for API data transfer.
  • provider/: Clients for external services (e.g., Cognito, Legacy).
  • exception/: Domain and standard API exceptions.
  • util/: Cross-cutting utility classes.

Naming Conventions

  • Controllers: Suffix with Controller (e.g., SearchController).
  • Services: Suffix with Service (e.g., UserService).
  • Repositories: Suffix with Repository (e.g., UserPreferenceRepository).
  • Entities: Suffix with Entity (e.g., UserPreferenceEntity).
  • DTOs: Implemented as record, suffix with Dto (e.g., ForestClientDto).
  • Methods: CamelCase (e.g., getUserPreferences).
  • Constants: UPPER_SNAKE_CASE.

Coding Style

  • Use Lombok (@AllArgsConstructor, @RequiredArgsConstructor, @Slf4j) to reduce boilerplate.
  • Prefer Constructor Injection over @Autowired.
  • Methods interacting with external boundaries should be @Observed.

Waste Plus Wiki

Home

Architecture

Codes

Decisions

Knowledge Base

Development

Changes

Clone this wiki locally