Why Haft?
The Problem
Spring Initializr is great for bootstrapping a new project. You visit the website, select your dependencies, download a ZIP, and you're ready to go.
But then what?
Every time you need to add a new entity, you manually create:
User.java— Entity classUserRepository.java— JPA repositoryUserService.java— Service interfaceUserServiceImpl.java— Service implementationUserController.java— REST controllerUserRequest.java— Request DTOUserResponse.java— Response DTOUserMapper.java— MapStruct mapper
That's 8 files. Every. Single. Time.
And you need to:
- Remember the correct package structure
- Copy-paste from existing files
- Update imports
- Wire up dependencies
- Hope you didn't make a typo
The Solution
Haft is your lifecycle companion. It doesn't just bootstrap — it stays with you.
# Instead of creating 8 files manually...
haft generate resource User
# Done. All files generated with proper architecture.
What Makes Haft Different
1. Interactive TUI Wizard
Not a web form. A beautiful terminal interface with:
- Real-time search across 230+ dependency shortcuts
- Category filtering (Web, SQL, Security, etc.)
- Keyboard navigation
- Back button support (press
Esc)
2. Spring Initializr Integration
Haft uses the same dependency metadata as Spring Initializr. You get access to all official Spring starters with their descriptions.
3. Smart Detection
When generating code, Haft reads your build file (pom.xml or build.gradle) to detect:
- Lombok → Uses
@Data,@Builder, etc. - MapStruct → Generates mapper interfaces
- Validation → Adds
@Validannotations - Spring Data JPA → Configures repositories correctly
4. Intelligent Architecture Detection
Haft scans your existing codebase and generates code that matches your patterns:
| Detection | What it learns |
|---|---|
| Architecture | Layered, Feature, Hexagonal, Clean, Modular, Flat |
| Feature Style | Flat (user/UserController.java) vs Nested (user/controller/UserController.java) |
| DTO Naming | Request/Response vs DTO |
| ID Type | Long vs UUID |
| Mapper | MapStruct, ModelMapper, or manual |
| Base Entity | Detects and extends your base class |
Profile caching makes subsequent runs instant.
5. Architectural Consistency
Every generated file follows the same patterns:
- Consistent naming conventions
- Proper layered architecture
- DTOs for API boundaries
- Exception handling
6. CLI-First
Works in any terminal:
# Interactive mode
haft init
# Scripted mode (CI/CD friendly)
haft init my-app --group com.example --deps web,jpa --no-interactive
Comparison
| Feature | Spring Initializr | Haft |
|---|---|---|
| Project scaffolding | ✅ | ✅ |
| Web interface | ✅ | ❌ |
| CLI interface | ❌ | ✅ |
| Interactive TUI | ❌ | ✅ |
| Resource generation | ❌ | ✅ |
| Test generation | ❌ | ✅ |
| Security generation | ❌ | ✅ |
| Dependency management | ❌ | ✅ |
| Smart detection | ❌ | ✅ |
| Architecture detection | ❌ | ✅ |
| Profile caching | ❌ | ✅ |
| Works offline | ❌ | ✅ |
Use Cases
Starting a New Project
haft init my-api
Interactive wizard guides you through all configuration options.
Adding a New Resource
haft generate resource Product
Generates all CRUD layers with proper architecture.
Adding a Dependency
haft add security
Adds Spring Security with proper configuration.
Adding Security Configuration
haft generate security --jwt
Generates complete JWT authentication setup with token generation, validation, and auth endpoints.
CI/CD Pipelines
haft init user-service \
--group com.company \
--java 21 \
--spring 3.4.1 \
--deps web,data-jpa,security \
--no-interactive
Fully scriptable, no interaction required.
Philosophy
- Convention over Configuration — Sensible defaults, override when needed
- CLI is Documentation —
--helptells you everything - Offline First — No internet required after installation
- Zero Lock-in — Generated code is standard Spring Boot