Skip to main content
Version: 0.6.0 (Latest)

🔧 Common Blocks

Common blocks provide reusable schemas, routes, handlers, and features that can be used across multiple entities in Nodeblocks applications. These blocks are designed to be shared and reused to maintain consistency and reduce duplication.


🎯 Overview

Common blocks are designed to:

  • Provide reusable components across multiple entities
  • Maintain consistency in data validation and API patterns
  • Reduce code duplication through shared schemas and utilities
  • Support standardization of common operations like pagination and responses
  • Enable composition with entity-specific blocks

📦 Block Types

🔍 Schemas

JSON Schema definitions for common data validation:

  • Address Schemas: Address validation for different formats and regions
  • Pagination Schemas: Standardized pagination parameters and metadata
  • Response Schemas: Common API response structures
  • Utility Schemas: Reusable utility schemas for common operations

View Common Schema Blocks →

🔧 Blocks

Reusable logic shared across domains:

  • redirectTo: Issue HTTP redirects in route chains
  • generateRandomPassword: Create secure random passwords

View Common Blocks →

Validators

Generic validation functions for reuse across domains:

  • checkIdentityType: Gate access based on identity type configuration
  • validateResourceAccess: Generic access control validator for any resource type (deprecated)
  • some: Compose validators with OR semantics
  • requireParam: Factory function to create parameter requirement validators
  • isUUID: Factory function to create UUID format validators
  • isNumber: Factory function to create numeric format validators

View Common Validator Blocks →