Skip to content

Java Package Conventions

Purpose

This standard defines package and naming conventions for the future backend implementation.

Base Package

com.algoza.algosure.<module>
  api
    rest
    dto
    mapper
  application
    command
    query
    service
  domain
    model
    event
    service
    policy
  infrastructure
    persistence
    messaging
    integration

Naming Conventions

Element Convention
Module package Lowercase module name, such as organization or bid.
Command Business imperative name ending in Command.
Query Read intent ending in Query.
Application service Use-case focused name ending in ApplicationService.
Domain service Domain behavior name ending in Service.
Policy Decision rule name ending in Policy.
Repository Aggregate or table ownership name ending in Repository.
Event Past-tense business fact name.
DTO Contract shape ending in Request, Response, or Dto.
Mapper Contract mapping name ending in Mapper.

Rules

  • Package names follow module ownership.
  • Business concepts use Domain language.
  • Avoid generic names such as manager, helper, util, processor, or handler unless the responsibility is explicitly narrow.
  • Do not place repositories, entities, or controllers in shared packages.
  • Do not create a cross-domain service package for convenience.

Dependency Direction

API depends on application contracts. Application depends on domain and repository ports. Infrastructure depends inward and implements persistence, messaging, and integration behavior.