Skip to content

QBit Development

James Maes edited this page Dec 28, 2025 · 1 revision

QBit Development

QBits are modular extensions that add functionality to QQQ applications. This guide covers QBit types, creation, development, and publishing.

Quick Links

QBit Types

QBits fall into three categories based on their purpose and scope:

Type Purpose Provides Template
Extension Framework infrastructure Backends, integrations, capabilities qbit-template-extension
Data Reference data Entities, sync processes, seed data qbit-template-data
Application Mini-applications Complete features with UI qbit-template-application

Extension QBits

Extend QQQ's infrastructure with new backends, authentication methods, or framework capabilities.

Examples:

  • qbit-sftp-data-integration - SFTP file import/export
  • qbit-webhooks - Inbound/outbound webhook support
  • qbit-standard-process-trace - Process execution tracing

Use When:

  • Adding new backend types (databases, APIs, storage)
  • Implementing authentication/authorization systems
  • Extending framework capabilities

Data QBits

Provide reference data that applications commonly need, with sync processes to keep data current.

Examples:

  • US States and cities data
  • Currency codes and exchange rates
  • Industry classification codes

Use When:

  • Sharing standardized reference data
  • Data requires periodic synchronization
  • Multiple applications need the same data

Application QBits

Complete mini-applications with entities, processes, and UI components.

Examples:

  • qbit-user-role-permissions - Role-based access control
  • qbit-workflows - User-defined workflow automation
  • qbit-customizable-table-views - Table view customization

Use When:

  • Building reusable application features
  • Functionality includes user interface components
  • Feature is complete and self-contained

Creating a QBit

1. Choose Template

Select the appropriate template for your QBit type:

# For extension QBits
gh repo create my-qbit --template QRun-IO/qbit-template-extension

# For data QBits
gh repo create my-qbit --template QRun-IO/qbit-template-data

# For application QBits
gh repo create my-qbit --template QRun-IO/qbit-template-application

2. Configure pom.xml

Update Maven coordinates and dependencies:

<parent>
   <groupId>com.kingsrook.qqq</groupId>
   <artifactId>qbit-bom</artifactId>
   <version>LATEST</version>
</parent>

<artifactId>qbit-your-qbit-name</artifactId>
<name>QBit: Your QBit Name</name>

3. Implement QBit Interface

Each QBit must implement QBitInterface:

public class YourQBit implements QBitInterface
{
   @Override
   public String getName()
   {
      return "yourQBit";
   }

   @Override
   public QBitMetaData getMetaData()
   {
      return new QBitMetaData()
         .withName(getName())
         .withDescription("Description of your QBit")
         .withVersion("1.0.0");
   }

   @Override
   public void register(QInstance qInstance) throws QException
   {
      // Register tables, processes, widgets, etc.
   }
}

4. Add Components

Depending on QBit type, add:

  • Tables - Define entities and their metadata
  • Processes - Business logic and workflows
  • Widgets - Dashboard components
  • Scripts - Automation scripts
  • Reports - Report definitions

QBit Architecture

Package Structure

src/main/java/com/kingsrook/qqq/qbit/yourqbit/
├── YourQBit.java           # Main QBit class
├── model/
│   └── YourEntity.java     # Entity classes
├── metadata/
│   └── YourTableMetaDataProducer.java
├── process/
│   └── YourProcess.java
└── widget/
    └── YourWidget.java

Registration Pattern

QBits register their components during application startup:

@Override
public void register(QInstance qInstance) throws QException
{
   // Register tables
   qInstance.addTable(new YourTableMetaDataProducer().produce(qInstance));

   // Register processes
   qInstance.addProcess(new YourProcessMetaDataProducer().produce(qInstance));

   // Register widgets
   qInstance.addWidget(new YourWidgetMetaDataProducer().produce(qInstance));
}

Dependencies

QBits can depend on other QBits:

@Override
public List<QBitDependency> getDependencies()
{
   return List.of(
      new QBitDependency("qbit-user-role-permissions", "1.0.0")
   );
}

Best Practices

Naming

  • Repository: qbit-descriptive-name
  • Package: com.kingsrook.qqq.qbit.descriptivename
  • Class: DescriptiveNameQBit
  • Metadata names: Use lowerCaseFirstCamelStyle

Configuration

Make QBits configurable:

public class YourQBitConfig
{
   private Boolean enableFeatureX = true;
   private String defaultValue = "default";

   // Fluent setters
   public YourQBitConfig withEnableFeatureX(Boolean enable)
   {
      this.enableFeatureX = enable;
      return this;
   }
}

Testing

  • Minimum 80% instruction coverage
  • Minimum 95% class coverage
  • Test all registration paths
  • Test integration with other QBits

Documentation

Each QBit should include:

  • README.md - Overview, installation, configuration
  • CHANGELOG.md - Version history
  • Javadoc - API documentation

Publishing

Version Management

QBits follow semantic versioning aligned with QQQ core:

  • Use qbit-bom as parent POM
  • Inherit version management from BOM
  • Release alongside QQQ when breaking changes occur

Maven Central

QBits are published to Maven Central:

<dependency>
   <groupId>com.kingsrook.qqq</groupId>
   <artifactId>qbit-your-qbit-name</artifactId>
   <version>1.0.0</version>
</dependency>

Release Process

  1. Update version in pom.xml
  2. Update CHANGELOG.md
  3. Create release branch
  4. Run CI/CD pipeline (uses qqq-orb)
  5. Tag and publish to Maven Central

Existing QBits

QBit Type Description Min QQQ
qbit-user-role-permissions Application Role-based access control 0.24.0
qbit-workflows Application User-defined workflows 0.25.0
qbit-webhooks Extension Webhook support 0.24.0
qbit-standard-process-trace Extension Process tracing 0.24.0
qbit-sftp-data-integration Extension SFTP import/export 0.24.0
qbit-customizable-table-views Application Table view customization 0.25.0

See Also

Clone this wiki locally