Package Exports
- sprygen
- sprygen/dist/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sprygen) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🌱 Sprygen
A production-ready Spring Boot project generator CLI
Sprygen is an interactive CLI written in TypeScript that scaffolds secure, structured Java Spring Boot applications. It handles the boilerplate of authentication, role-based access control, database configuration, and optional frontends so you can focus on building features.
Scaffold a full CRUD application with JWT auth, an admin panel, and Swagger docs in under 30 seconds.
✨ Features
- Interactive Scaffolding: Prompt-based setup for Java 17/21, Maven/Gradle, and databases (H2, MySQL, PostgreSQL).
- Modern Fullstack Monorepos: Scaffold a complete monorepo with a robust Spring Boot backend and a highly polished Next.js 15 frontend styled with Tailwind v4 and
lucide-react. Includes pre-wired Axios API hooks and auth states. - Built-in Security: Stateless JWT authentication or stateful Session-based logins.
- Enterprise Architecture: Compile-time safe mapping with MapStruct, auto-configured
Page<T>pagination, and JPASpecificationdynamic filtering out of the box. - Database Migrations: First-class Flyway support. Automatically scaffold migration directories and generate
.sqlmigrations per entity. - Role-Based Access Control & Auditing: Pre-configured
ROLE_ADMINandROLE_USERentities with JPA Auditing (@CreatedBy,@LastModifiedDate). - Entity Generator: Scaffold JPA Entities, Repositories, Services, Mappers, DTOs, and REST Controllers instantly.
- Batch Schema Generation: Scaffold multiple interconnected entities at once using a declarative JSON schema.
🚀 Installation
Install Sprygen globally via npm to use the sprygen command from anywhere:
npm install -g sprygen(For local development: clone this repository, run npm install, npm run build, and npm link)
🛠️ CLI Commands
1. Create a New Project
Launch the interactive prompt to configure and scaffold a new Spring Boot application.
sprygen new <project-name>You will be asked to configure:
- Package name (e.g.,
com.example.app) - Build Tool (Maven or Gradle)
- Database (H2, MySQL, PostgreSQL)
- Auth Strategy (JWT or Session)
- Project Type (REST API or Fullstack with UI)
- Optional Modules (Swagger/OpenAPI, Mail, Logging)
2. Generate a Single Entity
Run this command inside your generated Sprygen project directory. It prompts you to define fields and automatically generates the entire persistence and REST API stack.
sprygen add-entity <entity-name> # e.g. sprygen add-entity ProductGenerated files include:
- JPA Entity Class (with fields defined via prompt, extends
AbstractAuditingEntity) - Spring Data
JpaRepository+JpaSpecificationExecutor EntitySpecification(for dynamic query filtering)- Service Class (handling
Page<T>mapping) - MapStruct
MapperInterface - REST Controller (Paginated standard CRUD endpoints)
- Filter and Response DTOs
- Flyway SQL Migration (if project uses Flyway)
3. Batch Generate Entities (block-generate)
Perfect for initial project bootstrapping. Design your entire database in a schema.json file and generate all your entities and relations in one command.
[
{
"name": "Product",
"fields": [
{ "name": "title", "type": "String", "nullable": false }
],
"relations": [
{ "type": "ManyToOne", "target": "Category", "fieldName": "category", "eager": true }
]
}
]sprygen block-generate schema.json4. Inject Authentication
Useful for modifying existing non-Sprygen projects. Scaffolds robust JWT authentication layers into an already existing Spring Boot codebase.
sprygen generate-auth5. Convert to Flyway (migrate:init)
Instantly convert an existing ddl-auto: update Spring Boot project into a Flyway versioned project. It creates the migration directory, generates V1__baseline.sql, patches application.yml, and tracks state so future add-entity commands automatically generate SQL schema deltas.
sprygen migrate:init6. Update Sprygen
Ensure you are always running the latest version with the newest features and bug fixes by using the built-in update command.
sprygen update🏗️ Project Architecture
Applications generated by Sprygen follow standard best practices. If you choose a Fullstack project, Sprygen scaffolds a clean Monorepo:
my-project/
├── backend/ # Spring Boot REST API
│ ├── src/main/java/com/example/app/
│ │ ├── config/ # Security, CORS, Swagger configs
│ │ ├── controller/ # REST Controllers
│ │ ├── entity/ # JPA Models
│ │ ├── service/ # Business Logic
│ │ └── security/ # JWT/Session filters
│ └── pom.xml
└── frontend/ # Next.js 15 (App Router)
├── src/app/ # Modern Next.js App Router (dashboard, login, register)
├── src/components/ # Shared UI components (Sidebar, Dashboard layout)
├── src/hooks/ # Typed custom hooks (useAuth, useFetch)
├── src/lib/ # Axios API instances mapping to Spring Boot
└── package.json # Tailwind v4, lucide-react, next-themes📄 License
Sprygen is licensed under the MIT License.