Skip to content

3.3. Package Structure

3.3.1. Standard Layer Structure

The feature package structure is used as the default.

com.tienipia.{service-name}/
├── domain/
│   └── user/
│       ├── controller/
│       │   └── UserController.java
│       ├── service/
│       │   ├── UserService.java
│       │   └── UserServiceImpl.java
│       ├── repository/
│       │   └── UserRepository.java
│       └── dto/
│           ├── CreateUserRequest.java
│           └── UserResponse.java
├── global/
│   ├── config/
│   │   ├── SecurityConfig.java
│   │   └── WebConfig.java
│   ├── exception/
│   │   ├── GlobalExceptionHandler.java
│   │   ├── ErrorCode.java
│   │   └── ErrorResponse.java
│   └── common/
│       └── PageResponse.java
├── infra/
│   ├── external/
│   └── storage/
└── jooq/                          # jOOQ codegen auto-generated (target/)
    └── tables/

3.3.2. Package Structure Principles

  • domain/: Organize sub-packages by business domain.
  • global/: Place configuration, exceptions, and utilities shared across the entire application.
  • infra/: Place infrastructure code related to external system integration and storage.
  • jooq/: This is the package auto-generated by jOOQ codegen. It resides under target/generated-sources/ and must not be modified manually.
  • Minimize direct references between domains; use interfaces for dependencies when necessary.

TIENIPIA QUALIFIED STANDARD