An AI-powered Japanese Role-Playing Game (JRPG) project that combines traditional JRPG elements with modern AI technology.
This project aims to create an engaging JRPG experience where AI plays a crucial role in:
- Dynamic story generation
- Character development
- Combat mechanics
- World building
The project follows a multi-module architecture:
-
Core Module (
app/core
)- Domain models and business logic
- Pure Java 21 records for immutable data
- Type-safe enums and validation
-
Persistence Module (
app/persistence
)- JPA entities and repositories
- PostgreSQL with JSON support
- MapStruct for clean mapping
-
Context Module (
app/context
)- Player context management
- Event-driven architecture
- Redis caching
-
Repository Module (
app/repository
)- REST API endpoints
- Spring Boot application
- H2 database for development
- JPA repositories for data access
- Java 21
- Gradle 8.x
- Docker (for Redis and PostgreSQL)
- Claude API Key
- OpenAI API Key
-
Set required environment variables:
export CLAUDE_API_KEY=your_claude_api_key export OPENAI_API_KEY=your_openai_api_key export REDIS_HOST=localhost export REDIS_PORT=6379
-
Start required services:
docker-compose up -d
-
Run the application:
./gradlew :app:repository:run
The project uses a multi-module Gradle setup:
# Build all modules
./gradlew build
# Run tests
./gradlew test
# Run specific module
./gradlew :app:repository:run
The API is available at:
- Repository Service: http://localhost:8081
- H2 Console: http://localhost:8081/h2-console
- ✅ Multi-module architecture
- ✅ Java 21 records and pattern matching
- ✅ Type-safe domain model
- ✅ Event-driven design
- ✅ Player session tracking
- ✅ Action history
- ✅ NPC relationships
- ✅ Location tracking
- ✅ Claude API integration
- ✅ OpenAI API integration
- ✅ Prompt generation
- ✅ Response processing
- ✅ JPA repositories
- ✅ JSON support
- ✅ Caching with Redis
- ✅ Database migrations
- ✅ Entity mapping with MapStruct
- ✅ Lombok for clean code
app/
├── core/ # Core domain models and business logic
├── persistence/ # JPA entities and repositories
├── context/ # Player context and event management
└── repository/ # REST API and Spring Boot application
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── ai/rpg/
│ │ │ ├── persistence/ # JPA entities
│ │ │ ├── repository/ # Repository interfaces
│ │ │ └── config/ # Spring configuration
│ │ └── resources/
│ └── test/
│ └── java/
│ └── ai/rpg/
│ └── repository/ # Repository tests
└── build.gradle
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.