Contributing
Code Conventions
Language
- GraalVM JDK 21 source/target
- Use modern Java features (records, sealed classes, pattern matching where appropriate)
- Public-facing identifiers and REST contracts are in English
- Code comments may be in English or Chinese
Lombok
- Use
@Data,@Getter,@Setterfor DTOs and entities - Exception: Entities with
@Idthat go throughCrudRepository.update()must use explicit getters/setters - Use
@Slf4jfor logging
Controllers
- Annotate with
@Controller("/_matrix/...") - Use
@Secured(SecurityRule.IS_ANONYMOUS)for Matrix compatibility (most endpoints) - Use
@Secured(SecurityRule.IS_AUTHENTICATED)only for admin-only endpoints - Return proper Matrix error responses via
BaseExceptionandBaseErrorEnum - Avoid returning bare
HttpResponse.ok()orHttpResponse.serverError()without a body
Services
- Prefer constructor injection over field injection
- Throw
BaseExceptionfor domain errors (handled byMatrixExceptionHandler) - Use
@Injectfor dependency injection
Repositories
- Extend Micronaut Data interfaces
- Annotate with
@JdbcRepository(dialect = Dialect.H2) - Follow Micronaut Data naming conventions for query derivation
Entities
- Use
@MappedEntitywith explicit table names - Use
@Idfor primary keys - Avoid Lombok
@Getter/@Setteron entities withCrudRepositoryCRUD operations
Error Handling
- Define error codes in
BaseErrorEnum - Throw
BaseExceptionfor business logic errors MatrixExceptionHandlerconverts exceptions to Matrix error format
Commit Messages
Follow conventional commits:
Pull Requests
- Create a feature branch from
main - Implement changes with tests
- Run
mvn test— all tests must pass - Update
docs/plan/STATUS.mdif adding new features - Submit PR with clear description of changes
Running Locally
Project Status
All phases P0–P5 are complete. See Roadmap for details.