Skip to main content

Production-ready Spring Boot project generator CLI

Project description

ar-infra-cli logo

ar-infra-cli

CLI generator for production-ready Spring Boot backends
Opinionated infrastructure scaffolding powered by ar-infra-template

Designed & maintained by Abegà Razafindratelo


ar-infra-cli banner


Table of Contents


Introduction

The ar-infra-cli is a command-line tool designed to generate production-ready Spring Boot applications. It leverages the ar-infra-template as its foundation, ensuring that every generated project starts with a complete, enterprise-grade infrastructure.

This CLI automates the creation of new backend services, eliminating the repetitive setup work and enforcing consistent architecture and security practices across projects.


What's New in v0.2.0

MySQL Database Support

  • Multiple database options: Choose between PostgreSQL and MySQL during project initialization
  • Dedicated database selection workflow: Database choice is now a separate step with clear prompts
  • Full MySQL integration: Connection pooling, migrations, and entity management configured automatically

New add-dependency Command

  • Gradle dependency management: Add dependencies to existing projects without manual file editing
  • Single or batch additions: Add one dependency or multiple in a single command
  • Project path flexibility: Specify custom project paths or use current directory

Enhanced OpenAPI Documentation Handling

  • Dynamic specification cleanup: OpenAPI documentation (doc/api.yml) now updates based on selected features
  • SwaggerHandler integration: Automatically removes unused API endpoints for non-selected features
  • Accurate documentation: Generated API specifications reflect only the enabled infrastructure components

Template Version Compatibility

  • Tag-based cloning: CLI now clones specific template repository versions using Git tags
  • Backward compatibility: Older CLI versions continue to work with their corresponding template versions
  • Forward compatibility: New template updates won't break existing CLI installations

Streamlined Feature Selection

  • Two-step selection process: Database choice separated from other infrastructure features
  • Zero-feature option: New --no-feature flag generates minimal Spring Boot projects
  • Better workflow: More intuitive feature selection aligned with project needs

What is ar-infra?

ar-infra refers to the architecture and infrastructure baseline defined by this ecosystem. It represents a structured, production-ready backend stack that includes:

  • Messaging (RabbitMQ)
  • Storage (S3-compatible bucket)
  • Database (PostgreSQL or MySQL with Flyway migrations)
  • Email service
  • Security configuration
  • Health check endpoints
  • Integration testing with Testcontainers
  • CI/CD workflows
  • Dockerized runtime environment
  • OpenAPI documentation with Swagger UI

This architecture is designed to be reliable, maintainable, and secure, suitable for enterprise-scale applications.


What is ar-infra-template?

The ar-infra-template is the base template that implements the ar-infra architecture. It provides the full project structure, configurations, validators, health endpoints, and CI/CD pipelines.

It is not intended to be cloned and customized manually. Instead, it serves as the foundation for generated projects, ensuring that every new application starts with the same solid infrastructure.

For more information about the ar-infra architecture, visit the ar-infra-template repository.


What is ar-infra-cli?

The ar-infra-cli is the tool that generates new Spring Boot projects based on the ar-infra-template. It provides customization options such as:

  • groupId and artifactId
  • Project version
  • Database selection (PostgreSQL or MySQL)
  • Feature selection (add or remove components as needed)
  • Target location customization
  • GitHub App integration for automated CI/CD setup
  • Dependency management for existing projects

By running a single command, developers can bootstrap a fully configured Spring Boot application based on the ar-infra architecture without manual setup.


Installation

Binary Installation (Recommended)

Linux (x64)

curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-linux-amd64
curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-linux-amd64.sha256
shasum -a 256 -c ar-infra-linux-amd64.sha256
chmod +x ar-infra-linux-amd64
sudo mv ar-infra-linux-amd64 /usr/local/bin/ar-infra

macOS (Intel)

curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-macos-amd64
curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-macos-amd64.sha256
shasum -a 256 -c ar-infra-macos-amd64.sha256
chmod +x ar-infra-macos-amd64
sudo mv ar-infra-macos-amd64 /usr/local/bin/ar-infra

macOS (Apple Silicon)

curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-macos-arm64
curl -LO https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-macos-arm64.sha256
shasum -a 256 -c ar-infra-macos-arm64.sha256
chmod +x ar-infra-macos-arm64
sudo mv ar-infra-macos-arm64 /usr/local/bin/ar-infra

Windows (PowerShell as Administrator)

Invoke-WebRequest -Uri "https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-windows-amd64.exe" -OutFile "ar-infra.exe"
Invoke-WebRequest -Uri "https://github.com/Abega1642/ar-infra-cli/releases/download/v0.2.0/ar-infra-windows-amd64.exe.sha256" -OutFile "ar-infra.exe.sha256"
certutil -hashfile ar-infra.exe SHA256
Move-Item ar-infra.exe C:\Windows\System32\ar-infra.exe

Python Package Installation

Using pipx (recommended for CLI tools):

pipx install ar-infra-cli

Using pip:

pip install ar-infra-cli

Usage

The ar-infra-cli provides two main commands: ar-infra init for project generation and ar-infra add-dependency for dependency management.

Interactive Mode

The interactive mode guides you through project setup with prompts for each configuration option. This is the recommended approach for first-time users.

ar-infra init

The CLI will ask you to provide:

  • Group ID (e.g., com.example)
  • Artifact ID (e.g., myapp)
  • Project version (e.g., 1.0.0)
  • Output path
  • Database choice (PostgreSQL, MySQL, or none)
  • Additional features to include or exclude
  • GitHub repository setup (optional)

When you choose to push your project to a repository, the CLI will guide you through automated authorization via the ar-infra-bot GitHub App, ensuring your CI/CD workflows work immediately.

Command Line Mode

For automation or quick generation, all options can be provided directly via command-line flags.

ar-infra init --group=com.example --artifact=myapp --project-version=1.0.0

Generate a project with MySQL and specific features:

ar-infra init \
  --group=com.example \
  --artifact=backend-api \
  --features=mysql,rabbitmq,s3_bucket

Generate a minimal project with no infrastructure features:

ar-infra init \
  --group=com.example \
  --artifact=minimal-app \
  --no-feature

Skip GitHub App integration if you don't need CI/CD setup:

ar-infra init \
  --group=com.example \
  --artifact=backend-api \
  --skip-github-app

Adding Dependencies

The add-dependency command allows you to add Gradle dependencies to existing projects.

Add a single dependency

ar-infra add-dependency "implementation 'io.jsonwebtoken:jjwt-api:0.13.0'"

Add multiple dependencies

ar-infra add-dependency \
  "implementation 'io.jsonwebtoken:jjwt-api:0.13.0'" \
  "runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'" \
  "runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'"

Add dependency to specific project

ar-infra add-dependency \
  --project-path /path/to/project \
  "implementation 'org.springframework.boot:spring-boot-starter-data-jpa'"

Available Options

init Command Options

Option Description Example
--group Maven group ID for the project com.example
--artifact Maven artifact ID for the project backend-api
--project-version Version of the generated project 1.0.0
--path Directory where the project will be created /home/user/projects
--project-dir Name of the project directory my-project
--features Comma-separated list of features to include mysql,rabbitmq
--disable-features Comma-separated list of features to exclude rabbitmq,email
--no-feature Generate project without any features N/A
--no-cache Skip template caching and fetch fresh N/A
--skip-github-app Skip GitHub App integration N/A

add-dependency Command Options

Option Description Example
--project-path Path to the project root /path/to/project
Dependencies One or more Gradle dependency strings See examples above

Feature Flags

The following features can be enabled or disabled during project generation:

Database Options (Choose One or None)

Feature Description
postgresql PostgreSQL database support with Flyway migrations
mysql MySQL database support with Flyway migrations

Additional Infrastructure Features

Feature Description
rabbitmq RabbitMQ message broker integration
s3_bucket AWS S3-compatible storage integration (BackBlaze)
email Email sending capabilities

By default, all features are enabled. Use --disable-features to exclude specific components, or use --no-feature to generate a minimal Spring Boot application.


Examples

Basic Usage

Generate a project with default settings in interactive mode:

ar-infra init

Quick Start with MySQL

Generate a project with MySQL database:

ar-infra init --group=com.mycompany --artifact=backend-api --features=mysql

Full Customization

Generate a project with all options specified:

ar-infra init \
    --group=dev.razafindratelo \
    --artifact=cool-project \
    --project-version=2.0.0 \
    --path=/home/user/projects \
    --project-dir=cool-project \
    --features=postgresql,s3_bucket,rabbitmq

Minimal Configuration

Generate a minimal Spring Boot project without any infrastructure:

ar-infra init \
    --group=com.example \
    --artifact=minimal-api \
    --no-feature

Fresh Template Fetch

Generate a project with fresh template (bypass cache):

ar-infra init \
    --group=com.example \
    --artifact=myapp \
    --no-cache

Add JWT Dependencies

Add JWT authentication dependencies to an existing project:

ar-infra add-dependency \
  "implementation 'io.jsonwebtoken:jjwt-api:0.13.0'" \
  "runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.13.0'" \
  "runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.13.0'"

Generated Project Structure

Projects generated by ar-infra-cli include:

  • Complete Spring Boot application structure
  • Gradle build configuration
  • Docker and Docker Compose setup
  • CI/CD workflows (GitHub Actions)
  • Integration tests with Testcontainers
  • Health check endpoints
  • OpenAPI documentation (dynamically configured)
  • Security configuration
  • Database migration scripts (Flyway)
  • Message broker configuration (optional)
  • S3 storage integration (optional)
  • Email service configuration (optional)

System Requirements

Binary Distribution

  • Linux: x86_64 architecture, GLIBC 2.17+
  • macOS: 10.13+ (Intel), 11.0+ (Apple Silicon)
  • Windows: Windows 10/11, x86_64 architecture

Python Package

  • Python: 3.11 or higher
  • Package Manager: pip or pipx

Additional Requirements

  • Internet connectivity for GitHub App integration (optional)
  • Git installed for repository operations

Conclusion

The ar-infra-cli is the entry point for teams adopting the ar-infra architecture. By combining the solid foundation of ar-infra-template with the automation of a CLI tool, it enables developers to start new backend projects quickly, consistently, and securely.

With v0.2.0, MySQL support provides database flexibility, the new add-dependency command simplifies dependency management, and tag-based template versioning ensures long-term compatibility across CLI versions.

This tool is maintained by Abegà Razafindratelo. For questions, issues, or contributions, please refer to the project repository or contact directly at a.razafindratelo@gmail.com.

For more information, visit the ar-infra-template repository.


Support and Documentation


Security Considerations

  • Binary integrity verification via SHA256 checksums is strongly recommended
  • All binaries are built via GitHub Actions with full transparency
  • Secrets are injected at build time rather than bundled, improving security
  • The ar-infra-bot GitHub App uses minimal, scoped permissions
  • No code signing is provided; users should verify checksums before execution
  • Source code is available for audit
  • Template version tags ensure predictable and auditable project generation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ar_infra_cli-0.2.0.tar.gz (62.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ar_infra_cli-0.2.0-py3-none-any.whl (78.1 kB view details)

Uploaded Python 3

File details

Details for the file ar_infra_cli-0.2.0.tar.gz.

File metadata

  • Download URL: ar_infra_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 62.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ar_infra_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b106358aefb8314bdcd72f14ac2347afb8a6b1ba803494547083bff718258cbb
MD5 05422b5c696895d1fdfa43a0e7a6db99
BLAKE2b-256 db1c2c9f59cee342f658ca10f704b19ec6f567eecce787cfbf4fa9896f23570c

See more details on using hashes here.

File details

Details for the file ar_infra_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ar_infra_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 78.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ar_infra_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df472954deedb6f2749246b4adb8c526cd1ad70259a5f3fce8ca242d1525e75e
MD5 8d143defcf5703e03b7ee87c6cfbdd14
BLAKE2b-256 20a566dfd4b3953b62c9aea29ed6ed9a7687e0691b92c0096b93f746062e00f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page