Building Enterprise-Grade Apps with qBits

Learn how to leverage qBits - pre-built, composable modules - to add enterprise features like authentication, caching, notifications, and more to your qqq applications.

Building Enterprise-Grade Apps with qBits

Building enterprise software means implementing features that every business application needs: authentication, audit trails, notifications, file storage, and more. With qBits, you don't build these from scratch. You compose them.

qBits are pre-built, tested modules that snap into your qqq application. Think of them as plugins that add enterprise capabilities without the enterprise complexity.

What Are qBits?

qBits are packaged qqq metadata and code that provide specific functionality. They're not libraries you call - they're modules that integrate directly into your application's metadata layer.

There are three types:

  1. Platform Extensions: Authentication, caching, search, notifications
  2. Application qBits: Complete business modules like OMS, WMS, CRM
  3. Data qBits: Database connectors, API integrations, import/export

Adding Your First qBit

Let's add the Auth Provider qBit to handle authentication:

java
// In your QInstanceEnricher
qInstance.addQBit(new AuthProviderQBit()
   .withSupportedProviders(List.of(
      AuthProvider.EMAIL_PASSWORD,
      AuthProvider.GOOGLE_OAUTH,
      AuthProvider.SAML
   ))
   .withUserTableName("user")
   .withSessionDuration(Duration.ofHours(24))
);

This single call adds:

  • Login/logout endpoints
  • Session management
  • Password reset flow
  • OAuth2 integration
  • SAML SSO support
  • User management UI

No need to write token handling, session storage, or authentication middleware. The qBit handles it all.

Composing Multiple qBits

qBits are designed to work together. Here's an enterprise stack:

java
// Authentication - who are you?
qInstance.addQBit(new AuthProviderQBit()
   .withSupportedProviders(List.of(AuthProvider.SAML))
   .withUserTableName("user")
);
 
// Authorization - what can you do?
qInstance.addQBit(new RBACQBit()
   .withRoleTableName("role")
   .withPermissionTableName("permission")
   .withUserRoleTableName("userRole")
);
 
// Audit logging - what did you do?
qInstance.addQBit(new AuditLogQBit()
   .withLogLevel(AuditLevel.FIELD)
   .withRetentionDays(365)
);
 
// Notifications - tell someone about it
qInstance.addQBit(new NotificationQBit()
   .withEmailProvider(new SMTPProvider(config))
   .withSlackProvider(new SlackProvider(webhook))
);
 
// File storage - where do files go?
qInstance.addQBit(new FileStorageQBit()
   .withProvider(new S3Provider(bucket, region))
   .withMaxFileSize(50 * 1024 * 1024)  // 50MB
);

Each qBit knows how to interact with the others. The Notification qBit can send emails when audit events occur. The Auth qBit respects RBAC permissions. They compose cleanly.

Application qBits: Complete Modules

Beyond infrastructure, qBits can be entire application modules. The Order Management qBit adds:

java
qInstance.addQBit(new OrderManagementQBit()
   .withWarehouseTableName("warehouse")
   .withProductTableName("product")
   .withCustomerTableName("customer")
   .withFulfillmentProvider(new ShipStationProvider(apiKey))
);

This gives you:

  • Orders, line items, and shipments tables
  • Order lifecycle processes (create, approve, fulfill, ship)
  • Inventory allocation logic
  • Carrier integration
  • Customer notifications
  • Admin dashboards

A complete order management module in one line of configuration.

Customizing qBit Behavior

qBits aren't black boxes. You can extend and override:

java
// Extend the OrderManagementQBit with custom validation
qInstance.addQBit(new OrderManagementQBit()
   .withOrderValidation(new CustomOrderValidator())
   .withPricingStrategy(new DiscountedPricingStrategy())
   .withFulfillmentRules(new RegionalFulfillmentRules())
);
 
// Custom order validator
public class CustomOrderValidator implements OrderValidator {
   @Override
   public void validate(Order order) throws ValidationException {
      if (order.getTotal().compareTo(BigDecimal.valueOf(50000)) > 0) {
         throw new ValidationException("Orders over $50,000 require manual review");
      }
      // Add your business rules
   }
}

Data qBits: External Integrations

Data qBits connect to external systems:

java
// Salesforce integration
qInstance.addQBit(new SalesforceQBit()
   .withCredentials(credentials)
   .withSyncTables(List.of("Contact", "Account", "Opportunity"))
   .withSyncDirection(SyncDirection.BIDIRECTIONAL)
   .withConflictResolution(ConflictResolution.REMOTE_WINS)
);
 
// Shopify integration
qInstance.addQBit(new ShopifyQBit()
   .withStoreUrl("mystore.myshopify.com")
   .withAccessToken(token)
   .withSyncProducts(true)
   .withSyncOrders(true)
);

Your qqq application now has tables that stay in sync with external systems. Query them like local tables, and changes propagate automatically.

Building Your Own qBits

qBits follow a simple pattern. Here's the structure:

java
public class MyQBit implements QBitInterface {
 
   @Override
   public void enhance(QInstance qInstance) {
      // Add tables
      qInstance.addTable(buildMainTable());
 
      // Add processes
      qInstance.addProcess(buildMainProcess());
 
      // Add widgets
      qInstance.addWidget(buildDashboardWidget());
 
      // Add scheduled jobs
      qInstance.addAutomation(buildDailyJob());
   }
 
   private QTableMetaData buildMainTable() {
      return new QTableMetaData()
         .withName("myQbitTable")
         .withFields(List.of(
            // Your fields
         ));
   }
}

Package it as a JAR, publish to Maven Central, and others can use it:

xml
<dependency>
   <groupId>com.mycompany</groupId>
   <artifactId>my-qbit</artifactId>
   <version>1.0.0</version>
</dependency>

qBit Best Practices

1. Start with Platform qBits Add authentication, audit logging, and caching before building application features. These are foundational.

2. Use Data qBits for Integrations Don't write custom API clients. Use or create data qBits that abstract the integration.

3. Extend, Don't Fork If a qBit doesn't quite fit, extend it with custom validators, strategies, or rules rather than copying and modifying.

4. Version Your qBits qBits should follow semantic versioning. Breaking changes require major version bumps.

5. Test qBit Composition Test that your qBits work together. The Auth qBit + RBAC qBit + Audit qBit should compose without conflicts.

Available qBits

Platform Extensions:

  • Auth Provider (email, OAuth, SAML)
  • Cache Layer (Redis, Memcached)
  • Search (Elasticsearch, OpenSearch)
  • Notification (email, SMS, Slack, webhooks)
  • File Storage (S3, GCS, local)
  • Audit Logging

Application qBits:

  • Order Management (OMS)
  • Warehouse Management (WMS)
  • Customer Relationship (CRM)
  • Content Management (CMS)

Data qBits:

  • Salesforce Connector
  • Shopify Connector
  • QuickBooks Connector
  • Custom API Connector

Browse the full catalog at /qbits.

Conclusion

Enterprise applications share common needs. With qBits, you don't reinvent authentication, audit trails, or integrations for every project. You compose them from tested, maintained modules.

This isn't just about saving time (though you will). It's about building on proven patterns rather than custom implementations that need to be maintained forever.

Ready to explore qBits? Check out the qBits catalog or learn how to build your own.

Read next

Ready to build faster?