Skip to content

Commit 720f4ac

Browse files
🤖 ai-agent(claude-code): init with CLAUDE.md
1 parent 94b22a0 commit 720f4ac

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Common Development Commands
6+
7+
### Building and Running
8+
- `./mvnw clean install` - Clean build with all tests
9+
- `./mvnw install -DskipTests` - Fast build without tests
10+
- `./mvnw spring-boot:run` - Run the application locally
11+
- `./mvnw test` - Run all tests
12+
- `./mvnw test -Dtest=ClassName` - Run specific test class
13+
- `./mvnw test -Dtest=ClassName#methodName` - Run specific test method
14+
15+
### Infrastructure
16+
- `docker compose up` - Start Axon Server and PostgreSQL containers
17+
- `docker compose down` - Stop containers
18+
- Application runs on default Spring Boot port (8080)
19+
- Axon Server UI available at http://localhost:8024
20+
- PostgreSQL accessible at localhost:6446
21+
22+
### Testing
23+
- Tests use real PostgreSQL Event Store via Testcontainers
24+
- All tests follow BDD pattern: given(events) → when(command) → then(events/state)
25+
- Use `AxonUtils` and `EventStoreAssertions` helper classes for test setup
26+
27+
## Architecture Overview
28+
29+
This is a Domain-Driven Design implementation using Event Sourcing with Axon Framework and Spring Modulith. The application models a Heroes of Might & Magic III domain with four main bounded contexts.
30+
31+
### Core Architectural Patterns
32+
- **Event Sourcing**: All state changes captured as domain events
33+
- **CQRS**: Separate write (command) and read (query) models
34+
- **Vertical Slice Architecture**: Features organized by capability, not technical layer
35+
- **Spring Modulith**: Module boundaries enforced at compile time
36+
- **Event Modeling**: System design follows Event Modeling nomenclature
37+
38+
### Module Structure
39+
Each domain module follows a consistent structure with three slice types:
40+
41+
```
42+
com.dddheroes.heroesofddd/
43+
├── armies/ # Army management
44+
├── astrologers/ # Week symbols and creature bonuses
45+
├── calendar/ # Game time progression
46+
├── creaturerecruitment/ # Building dwellings and recruiting creatures
47+
├── resourcespool/ # Player resources management
48+
├── maintenance/ # Event store operations
49+
└── shared/ # Common domain concepts
50+
```
51+
52+
### Slice Types (following Event Modeling)
53+
- **write/**: Commands → Aggregates → Events (business logic)
54+
- **read/**: Event projections → Read models → Queries (data access)
55+
- **automation/**: Event processors implementing business policies
56+
- **events/**: Domain events (contracts between slices)
57+
58+
### Key Aggregates
59+
- `Army` - manages creature stacks (max 7)
60+
- `Dwelling` - creature recruitment buildings
61+
- `Calendar` - game time progression
62+
- `Astrologers` - weekly creature bonuses
63+
- `ResourcesPool` - player resources (gold, wood, etc.)
64+
65+
### Event Processing
66+
- Uses Axon Framework event processors with game-specific sequencing
67+
- All processors use `gameIdSequencingPolicy` for consistency
68+
- Dead Letter Queue (DLQ) enabled for automation processors
69+
- Event store backed by PostgreSQL with JPA
70+
71+
### Domain Rules Examples
72+
- Armies limited to 7 creature stacks (`CanHaveMax7CreatureStacksInArmy`)
73+
- Cannot recruit more creatures than available (`RecruitCreaturesNotExceedAvailableCreatures`)
74+
- Days must be started in sequence (`CannotSkipDays`)
75+
- One week symbol per week (`OnlyOneSymbolPerWeek`)
76+
77+
### Testing Strategy
78+
Tests focus on observable behavior using Axon Test Fixture:
79+
- Write slice tests: given(events) → when(command) → then(events)
80+
- Read slice tests: given(events) → then(read model state)
81+
- Automation tests: when(event) → then(command issued)
82+
83+
### REST API
84+
- Swagger UI available at `/swagger-ui.html`
85+
- API docs at `/api-docs`
86+
- Maintenance endpoints for event stream operations
87+
88+
### Configuration Notes
89+
- Axon Server disabled by default (uses JPA event store)
90+
- Virtual threads enabled for better concurrency
91+
- Jackson serialization for events and messages
92+
- Game metadata correlation for event sequencing

0 commit comments

Comments
 (0)