|
| 1 | +Rosetta-Java Cardano Application — Development Guide (Context Window For AI Agents) |
| 2 | + |
| 3 | +✅ Overview |
| 4 | + |
| 5 | +This project is a Java implementation of the Rosetta specification, adapted from Coinbase’s original mesh. It targets the Cardano blockchain and is optimized for performance, scalability, and testability. |
| 6 | + |
| 7 | +⸻ |
| 8 | + |
| 9 | +🛠️ Technologies & Standards |
| 10 | +• Java 24 – Latest LTS features leveraged. |
| 11 | +• Lombok – For reducing boilerplate (e.g., getters, constructors). |
| 12 | +• Hibernate + JOOQ – A hybrid approach planned: |
| 13 | +• Hibernate for standard ORM tasks. |
| 14 | +• JOOQ for complex SQL operations. |
| 15 | +• Hibernate for standard ORM needs. |
| 16 | +• JOOQ for high-performance, complex SQL queries. |
| 17 | +• Flywheel – Used for event-sourced state and domain logic. |
| 18 | +• OpenAPI (api.yaml) – Contract-first approach: |
| 19 | +• Edit src/main/resources/rosetta-specifications-1.4.15/api.yaml for API changes. |
| 20 | +• Code generation tools automatically create request/response classes. |
| 21 | +• No Spring RestControllers – All endpoints are generated from OpenAPI spec; avoid manually annotating endpoints. |
| 22 | +• JUnit 5 with @Nested tests – Organize tests into logical groups. |
| 23 | +• AssertJ – Preferred assertion framework for fluent and expressive assertions. |
| 24 | + |
| 25 | +⸻ |
| 26 | + |
| 27 | +📋 Step-by-Step Context Window / Discovery |
| 28 | + |
| 29 | +1. Rosetta API Specification |
| 30 | + • Maintained in: |
| 31 | + src/main/resources/rosetta-specifications-1.4.15/api.yaml |
| 32 | + • ❗ All endpoints and models are generated, do not manually modify controller classes. |
| 33 | + |
| 34 | +2. Code Generation |
| 35 | + • Triggered via build tools (Gradle/Maven). |
| 36 | + • Output includes: |
| 37 | + • DTOs |
| 38 | + • Server interfaces |
| 39 | + • Clients |
| 40 | + • Ensures OpenAPI remains the single source of truth. |
| 41 | + |
| 42 | +3. Persistence Layer |
| 43 | + • Hibernate handles standard CRUD and entity management. |
| 44 | + • JOOQ will be used for: |
| 45 | + • Bulk operations |
| 46 | + • Deep filtering |
| 47 | + • Custom joins / window functions |
| 48 | + • Both work seamlessly alongside Flywheel event sourcing. |
| 49 | + |
| 50 | +4. Domain Logic with Flywheel |
| 51 | + • Domain state transitions are event-driven. |
| 52 | + • Promotes traceability and immutability. |
| 53 | + |
| 54 | +5. Testing Strategy |
| 55 | + • JUnit 5 with @Nested classes to: |
| 56 | + • Separate concerns within test files. |
| 57 | + • Improve readability and scope clarity. |
| 58 | + • AssertJ provides fluent API for: |
| 59 | + • Clean, expressive assertions. |
| 60 | + • Better failure messages than vanilla JUnit or Hamcrest. |
| 61 | + |
| 62 | +⸻ |
| 63 | + |
| 64 | +📎 Notes |
| 65 | +• Avoid using @RestController or manual API layer. |
| 66 | +• All changes to API contract must be made in api.yaml. |
| 67 | +• Lombok annotations (@Value, @Builder, @Getter, etc.) are preferred to minimize boilerplate. |
0 commit comments