Jakarta (jakarta.validation) vs Javax (javax.validation)
Swagger/OpenAPI
Adds @Operation, @Tag annotations if detected
Database Type
JPA, MongoDB, Cassandra, R2DBC
Profile Caching
First run scans your project and caches the profile to .haft/profile.json. Subsequent runs are instant.
# First run (~200ms) - scans and caches
haft generate resource User
# Second run (~10ms) - uses cache
haft generate resource Product
# Force re-scan if needed
haft generate resource Order --refresh
Why Haft?
Spring Initializr
Haft
Project Bootstrap
✅
✅
Works Offline
❌
✅
Resource Generation
❌
✅
Intelligent Detection
❌
✅
Architecture Aware
❌
✅
Test Generation
❌
✅
Dependency Management
❌
✅
Interactive TUI
❌
✅
Lifecycle Companion
❌
✅
Haft works completely offline. No web browser. No internet dependency. Just you and your terminal.
go install github.com/KashifKhn/haft/cmd/haft@latest
From Source
git clone https://github.com/KashifKhn/haft.git
cd haft
make build
sudo mv bin/haft /usr/local/bin/
Shell Completions
Enable tab completions for your shell:
# Bash
haft completion bash > /etc/bash_completion.d/haft
# Zsh
haft completion zsh > "${fpath[1]}/_haft"
# Fish
haft completion fish > ~/.config/fish/completions/haft.fish
# PowerShell
haft completion powershell > haft.ps1
Quick Start
Create a New Project
haft init
An interactive wizard guides you through project setup:
# Generate resource + unit/integration tests
haft generate resource Product
# Skip test generation
haft generate resource Payment --skip-tests
Generated test files:
# ServiceTest - Unit tests with Mockito
# ControllerTest - Integration tests with MockMvc
# RepositoryTest - Integration tests with @DataJpaTest
# EntityTest - Unit tests for entity
Individual Generators
haft generate controller Product # haft g co Product
haft generate service Order # haft g s Order
haft generate repository Payment # haft g repo Payment
haft generate entity Customer # haft g e Customer
haft generate dto Invoice # Request + Response DTOs
Generate Security Configuration
# Interactive selection of security types
haft generate security
# Generate JWT authentication
haft generate security --jwt
# Generate session-based authentication
haft generate security --session
# Generate OAuth2 authentication (Google, GitHub, Facebook)
haft generate security --oauth2
# Generate all security types
haft generate security --all
# Interactive search picker
haft add
# Browse by category
haft add --browse
# Add using shortcuts (330+ available)
haft add lombok validation jwt
# Add using Maven coordinates (auto-verified)
haft add org.mapstruct:mapstruct
# Remove dependencies
haft remove lombok
haft remove # Interactive picker
Development Workflow
haft dev serve # Start with hot-reload
haft dev build # Build project
haft dev test # Run tests
haft dev clean # Clean artifacts
Project Analysis
haft info # Project information
haft info --loc # With lines of code
haft routes # List REST endpoints
haft routes --files # With file locations
haft stats # Code statistics
haft stats --cocomo # COCOMO cost estimates
Features
Intelligent Detection — Learns from your codebase patterns