HSuite Libraries
HbarSuite Smart Engines Libraries
A comprehensive suite of libraries for building enterprise-grade applications on the Hedera Hashgraph network.
Overview
The HbarSuite Smart Engines library collection provides a robust and modular framework for developing applications on the Hedera Hashgraph network. Each library is designed to handle specific aspects of blockchain interaction, network management, and distributed systems.
Core Libraries
Authentication & Security
@hsuite/auth
: Authentication and authorization system@hsuite/auth-types
: Type definitions for authentication@hsuite/api-key
: API key management and validation
Client & SDK
@hsuite/client
: Core client implementation@hsuite/client-types
: Type definitions for client operations@hsuite/smartnode-sdk
: SDK for smart node interactions
Distributed Systems
@hsuite/dkg-types
: Type definitions for DKG operations@hsuite/hashgraph-types
: Type definitions for Hashgraph operations
Network & Transactions
@hsuite/smart-config
: Configuration management@hsuite/smart-network-types
: Network type definitions@hsuite/smart-transaction-types
: Transaction type definitions
System Management
@hsuite/health
: Health check and monitoring@hsuite/helpers
: Common utility functions@hsuite/ipfs
: IPFS integration@hsuite/snapshots
: System state snapshots
User & Access Control
@hsuite/users
: User management and operations@hsuite/users-types
: Type definitions for user management@hsuite/validators-types
: Type definitions for validators@hsuite/throttler
: Rate limiting and request throttling@hsuite/throttler-types
: Type definitions for throttling@hsuite/subscriptions
: Subscription management@hsuite/subscriptions-types
: Type definitions for subscriptions
Installation
Each library can be installed individually using npm:
For example:
Documentation
Each library includes detailed documentation that can be generated using Compodoc:
Development
Prerequisites
Node.js ≥ 14
npm or yarn
NestJS framework knowledge
Hedera network access
Setup
Clone the repository
Install dependencies:
yarn install
Build all libraries:
yarn build
Run tests:
yarn test
Architecture
The libraries follow a modular architecture with clear separation of concerns:
Core Services: Client, Authentication, and Network integration
Support Services: Throttling, Validation, and User Management
Utility Services: Configuration, Health Checks, and Helpers
Type Definitions: Separate -types packages for type safety
Best Practices
Use TypeScript for type safety
Follow NestJS patterns and practices
Implement proper error handling
Include comprehensive documentation
Write unit and integration tests
Follow semantic versioning
Contributing
Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request
License
This project is part of the HbarSuite ecosystem and is covered by its license terms.
Built with ❤️ by the HbarSuite Team Copyright © 2024 HbarSuite. All rights reserved.
HbarSuite Core Libraries Documentation
📁 Library Structure
This directory contains modular, reusable libraries that form the foundation of the HbarSuite ecosystem. Each library is designed to be independently usable while providing seamless integration with other ecosystem components.
🔍 Validators Ecosystem
The validators ecosystem provides comprehensive transaction validation capabilities for the Hedera Hashgraph network.
Purpose: Comprehensive NestJS validation library for Hedera Hashgraph transactions and operations
Key Features:
✅ Multi-Entity Support: Consensus topics, tokens, and accounts
✅ Transaction Validation: All major Hedera transaction types
✅ REST API: Complete HTTP API for validator management
✅ Type-Safe: Full TypeScript support with comprehensive definitions
✅ Modular Architecture: Easy NestJS integration
✅ Rule Management: Dynamic validation parameters via API
Core Components:
Supported Operations:
Purpose: Complete TypeScript type system for validators with comprehensive interfaces and models
Key Features:
🏷️ Namespace Architecture: Organized type hierarchy by domain
📝 Interface Definitions: Comprehensive validation interfaces
🔧 Model Implementations: Concrete validation model classes
📊 Transaction Enums: Standardized transaction type constants
🎨 Design Patterns: Factory, Strategy, and Interface Segregation patterns
Core Components:
Type Hierarchy:
🔗 Integration Example
Basic Validator Setup
Transaction Validation Usage
REST API Usage
🔧 Other Core Libraries
Authentication & Security
auth
- Core authentication module supporting Web2 and Web3 methodsauth-types
- Type definitions for authentication systemsapi-key
- API key management with rate limiting capabilities
Client & Network
client
- Main HSUITE client module with connection poolingclient-types
- Type definitions for client operationssmart-network
- Smart Network ecosystem implementationsmart-network-types
- Type definitions for network operationshashgraph
- Hedera Hashgraph integration layerhashgraph-types
- Type definitions for Hashgraph operations
Security & Access Control
throttler
- Rate limiting and DDoS protection mechanismsthrottler-types
- Type definitions for throttling operationslicense-manager
- License generation and verification for enterprise
User Management
users
- User management functionality with profile managementusers-types
- Type definitions for user data structuressubscriptions
- Subscription and service tier managementsubscriptions-types
- Type definitions for subscription models
Distributed Systems
dkg
- Distributed Key Generation for secure multi-party operationsdkg-types
- Type definitions for DKG operationssmartnode-sdk
- SDK for SmartNode infrastructure interactionipfs
- IPFS integration for decentralized storagecluster
- Clustering and distributed processing capabilities
System Utilities
smart-config
- Configuration management with secure storagesmart-transaction
- Transaction processing with atomicity guaranteessmart-transaction-types
- Type definitions for transactionshealth
- Health checks and system monitoringhelpers
- Common utility functions and shared toolssnapshots
- System state snapshot managementmirrors
- Mirror node integration with query optimizationtrust-score
- Trust scoring and reputation systems_tools
- Command-line utilities for development and deployment
🛠️ Development Guidelines
Library Development Standards
Type Safety: Use corresponding
-types
libraries for consistent interfacesDocumentation: Include comprehensive JSDoc comments and README files
Modularity: Design for independent importability with minimal dependencies
Testing: Implement thorough unit and integration tests
Performance: Optimize for production use with efficient algorithms
Adding New Libraries
Create library structure with
src/
,README.md
,package.json
,tsconfig.lib.json
Define public API in
src/index.ts
with comprehensive exportsImplement corresponding
-types
library if type definitions are extensiveAdd library to main
libs/README.md
with proper categorizationUpdate main project README with library description and usage
Documentation Standards
README.md: Library overview, features, installation, usage examples
src/README.md: Detailed implementation documentation
JSDoc: Comprehensive inline code documentation
Examples: Practical usage examples with explanations
API Documentation: Generated documentation using Compodoc
📋 Integration Patterns
Module Registration Pattern
Service Injection Pattern
Type-Safe Usage Pattern
🔄 Library Lifecycle
Development Phase
Design interfaces in
-types
libraryImplement core functionality
Add comprehensive tests
Document API and usage
Review and refactor
Integration Phase
Register module in main application
Configure dependency injection
Test integration points
Validate type safety
Performance testing
Maintenance Phase
Monitor performance metrics
Update dependencies regularly
Maintain documentation
Handle bug reports
Plan feature enhancements
🚀 Getting Started
For Library Users
Read the library-specific README for overview and features
Check
src/README.md
for detailed implementation documentationReview code examples and integration patterns
Set up configuration based on your requirements
Start with basic usage and gradually explore advanced features
For Library Developers
Study existing library patterns and conventions
Follow TypeScript and NestJS best practices
Implement comprehensive error handling
Add thorough test coverage
Document all public APIs with JSDoc
📚 Additional Resources
Last updated