Standard project layout, package conventions, module system, and layered architecture patterns.
project-root/
├── src/
│ ├── main/
│ │ ├── java/ # Application source code
│ │ │ └── com/example/app/
│ │ │ ├── Application.java
│ │ │ ├── config/
│ │ │ ├── controller/
│ │ │ ├── service/
│ │ │ ├── repository/
│ │ │ ├── model/
│ │ │ └── exception/
│ │ └── resources/ # Configuration files
│ │ ├── application.yml
│ │ ├── application-dev.yml
│ │ ├── application-prod.yml
│ │ └── db/migration/
│ └── test/
│ ├── java/ # Test source code
│ │ └── com/example/app/
│ │ ├── controller/
│ │ ├── service/
│ │ └── repository/
│ └── resources/ # Test resources
│ └── application-test.yml
├── pom.xml # Maven build
├── build.gradle.kts # or Gradle build
└── README.md
// Reverse domain name + project + layer
com.company.project.controller
com.company.project.service
com.company.project.repository
com.company.project.model
com.company.project.dto
com.company.project.exception
com.company.project.config
com.company.project.util
// Feature-based alternative
com.company.project.user.controller
com.company.project.user.service
com.company.project.order.controller
com.company.project.order.service
┌─────────────────────────────────────────┐
│ Controller Layer │ ← HTTP handling, validation
├─────────────────────────────────────────┤
│ Service Layer │ ← Business logic
├─────────────────────────────────────────┤
│ Repository Layer │ ← Data access
├─────────────────────────────────────────┤
│ Model/Entity │ ← Domain objects
└─────────────────────────────────────────┘
// Dependency rules:
// Controller → Service → Repository → Model
// NEVER: Repository → Service or Model → anything
// Controller - handles HTTP
@RestController
@RequestMapping("/api/users")
public class UserController {
private final UserService userService;
// Only UserService, never UserRepository
}
// Service - business logic
@Service
public class UserService {
private final UserRepository userRepository;
private final EmailService emailService;
// Can use multiple repositories and services
}
// Repository - data access
@Repository
public interface UserRepository extends JpaRepository<User, Long> {
// Only data operations
}
// Separate DTOs for request/response
public record CreateUserRequest(
@NotBlank String name,
@Email String email
) {}
public record UserResponse(
Long id,
String name,
String email,
LocalDateTime createdAt
) {
public static UserResponse from(User user) {
return new UserResponse(
user.getId(),
user.getName(),
user.getEmail(),
user.getCreatedAt()
);
}
}
// Mapper interface
public interface UserMapper {
User toEntity(CreateUserRequest request);
UserResponse toResponse(User user);
}
// module-info.java
module com.example.app {
// Dependencies
requires java.sql;
requires spring.boot;
requires spring.boot.autoconfigure;
requires spring.web;
// What we export
exports com.example.app.api;
exports com.example.app.model;
// Internal packages (not exported)
// com.example.app.internal is hidden
// Reflection access for frameworks
opens com.example.app.model to spring.core;
opens com.example.app to spring.beans;
}
parent-project/
├── pom.xml # Parent POM
├── core/ # Shared domain, utils
│ ├── pom.xml
│ └── src/main/java/
├── api/ # REST API module
│ ├── pom.xml
│ └── src/main/java/
├── service/ # Business logic
│ ├── pom.xml
│ └── src/main/java/
└── infrastructure/ # External integrations
├── pom.xml
└── src/main/java/
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer