Interactive Spring Boot CRUD CLI
Project description
🌱 SpringGen
SpringGen is an interactive CLI tool that generates ready-to-run Spring Boot CRUD boilerplate code — complete with Entities, Repositories, Services, and Controllers — using configurable templates.
🚀 Features
✅ Interactive CLI (no arguments needed)
✅ Supports pagination and sorting (configurable defaults)
✅ Uses YAML config stored under ~/.springgen/config.yml
✅ Generates clean, Lombok-based classes with constructor injection
✅ Jinja2-powered templates (easy to customize)
✅ Auto-detects jakarta.persistence or javax.persistence
✅ Works cross-platform (Linux / macOS / Windows)
🧩 Installation
pip install springgen
Requires Python ≥ 3.8
⚙️ Usage Simply run:
springgen
You’ll be prompted for entity names and which layers to generate:
Enter entity names (comma-separated): Product, Category
Do you want to generate Repository layer for all entities? [y/n]: y
Do you want to generate Service layer (interface + impl) for all entities? [y/n]: y
Do you want to generate Controller layer for all entities? [y/n]: y
SpringGen will generate:
src/main/java/com/example/demo/
├─ model/
│ └─ Product.java
├─ repository/
│ └─ ProductRepository.java
├─ service/
│ ├─ ProductService.java
│ └─ impl/ProductServiceImpl.java
└─ controller/
└─ ProductController.java
⚙️ Configuration SpringGen stores configuration at:
~/.springgen/config.yml
🧾 Default Config
base_package: com.example.demo
persistence_package: auto # auto | jakarta.persistence | javax.persistence
features:
pagination_and_sorting: true
api:
defaultPageSize: 10
defaultSort: id,asc
folders:
entity: model
repository: repository
service: service
controller: controller
Edit interactively
springgen --config
Open in your editor
springgen --edit-config
Change settings via CLI
springgen --set api.defaultPageSize=25
springgen --set features.pagination_and_sorting=false
🧠 Example Generated Code ✅ Entity
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Product {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}```
✅ Repository
```java
@Repository
public interface ProductRepository extends JpaRepository<Product, Long> {}
✅ Service (with pagination)
public interface ProductService {
Product getById(Long id);
Product save(Product obj);
Product update(Product obj);
Page<Product> getPage(Pageable pageable);
void delete(Long id);
}```
✅ Controller
```java
@RestController
@RequestMapping("/products")
@RequiredArgsConstructor
public class ProductController {
private final ProductService service;
@GetMapping
public ResponseEntity<?> getAll(
@PageableDefault(page = 0, size = 10, sort = "id", direction = Sort.Direction.ASC)
Pageable pageable) {
Page<Product> page = service.getPage(pageable);
return ResponseEntity.ok(page);
}
// other CRUD methods...
}
🧰 Advanced 📦 Single-folder mode Put everything inside one package:
springgen --single-folder common
🧩 Developer Info
👨💻 Author
Ajoy Deb Nath
🔗 GitHub: Ajoy-1704001
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file springgen-1.0.1.tar.gz.
File metadata
- Download URL: springgen-1.0.1.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8a89c058cb90d0d7b694c810e84790dd038d3b880fbb75ea27ed4507d4d8268
|
|
| MD5 |
3d8db0a3108757f312a1f3131f52ac8e
|
|
| BLAKE2b-256 |
9bdca8ccf2b05b86c9963fe287efbaea2f2dfcd66463bd21b37b6446a4e548da
|
File details
Details for the file springgen-1.0.1-py3-none-any.whl.
File metadata
- Download URL: springgen-1.0.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d87a02d277f6f193c4f5190a7b5ddf440bbbfe5b90a11f24f4eddd938daf35
|
|
| MD5 |
adbfb175955cbb15e87dccd633f7211e
|
|
| BLAKE2b-256 |
9c614a6fd9cfca6799e87ced9893c8ba58b6335a1b45ea71e6802bbfacd4be0e
|