APiGen CLI
Command Line Interface for APiGen - Enterprise API Generator with instant code generation from SQL/OpenAPI.
Overview
The Problem: Slow Manual Development
Before APiGen CLI:
bash
# Week 1: Project setup
mkdir my-api && cd my-api
gradle init # or mvn archetype:generate (interactive hell)
# Manually configure: dependencies, plugins, Spring Boot version
# Setup: database config, logging, Docker, CI/CD
# Week 2-3: Code entities manually
# Create User.java, UserRepository.java, UserService.java, UserController.java
# Repeat for every entity (10+ files per entity × 20 entities = 200+ files)
# Week 4: Tests, validation, documentation
# Write tests manually (another 200+ test files)
Total: 4+ weeks for initial setup + basic CRUDAfter APiGen CLI:
bash
# Minute 1: Initialize project
apigen init --name my-api --language java-spring -f jwt-auth,docker,openapi
# Minute 2: Generate from SQL schema
apigen generate --from sql --input schema.sql
# Minute 3: Project ready
cd my-api
./gradlew bootRun # ✅ Fully functional API with docs, tests, Docker
Total: 3 minutes for production-ready APITime Saved: 99.9% reduction (4 weeks → 3 minutes)
Commands
apigen init
Initialize a new APiGen project with an interactive wizard.
bash
# Interactive mode
apigen init
# Non-interactive mode
apigen init --name my-api --language java-spring --database postgresql
# Specify features
apigen init --name my-api -l java-spring -f jwt-auth,docker,openapiapigen generate
Generate code from schema files.
bash
# Generate from SQL
apigen generate --from sql --input schema.sql
# Generate from OpenAPI
apigen generate --from openapi --input api.yaml
# With custom output directory
apigen generate -f sql -i schema.sql -o ./src/generated
# Dry run (preview only)
apigen generate -f sql -i schema.sql --dry-runapigen add
Add entities or fields to your project.
bash
# Add a new entity
apigen add entity Product
# Add entity with fields
apigen add entity Product --fields "name:string,price:decimal,stock:int"
# Add entity with relations
apigen add entity Order --relations "user:User,items:OrderItem[]"
# Add a field to existing entity
apigen add field Product category:stringapigen remove
Remove entities or fields from your project.
bash
# Remove an entity
apigen remove entity Product
# Remove a field
apigen remove field Product categoryapigen validate
Validate project configuration and schema files.
bash
# Validate entire project
apigen validate
# Validate specific file
apigen validate --input schema/entities.sqlapigen preview
Preview code generation without creating files.
bash
# Preview generation
apigen preview --from sql --input schema.sql
# Show diff against existing files
apigen preview -f sql -i schema.sql --diffapigen migrate
Generate database migration files.
bash
# Create migration with name
apigen migrate --name add_user_email
# Add column migration
apigen migrate --name add_email --add-column users.email:stringConfiguration
APiGen CLI uses a configuration file (.apigenrc.yml) in your project root.
yaml
# APiGen Configuration
version: "1.0"
defaults:
language: java-spring
features:
- jwt-auth
- rate-limiting
- soft-delete
- auditing
- openapi
- docker
database: postgresql
output:
directory: ./src/main/java
package: com.example.apiInstallation Methods
Homebrew (macOS/Linux)
bash
brew tap jnzader/apigen
brew install apigenScoop (Windows)
powershell
scoop bucket add apigen https://github.com/jnzader/scoop-bucket
scoop install apigenNPM (Cross-platform)
bash
npm install -g @jnzader/apigen-cli