Features
Your Blocklet can leverage a range of built-in features provided by Blocklet Server to enhance functionality, security, and user experience. This section details how to enable and configure optional features such as custom capabilities, authentication, navigation, theming, resource sharing, and custom events directly within your blocklet.yml
file.
Capabilities#
The capabilities
object is a collection of boolean flags that declare the supported features and operational modes of your Blocklet. These settings inform Blocklet Server how to manage and integrate your component.
name: my-feature-rich-blocklet
did: z8iZpkyb3tpp1kF1aB1f123456789abcdef
version: 1.0.0
description: A blocklet demonstrating various features.
capabilities:
clusterMode: false
didSpace: 'owner'
navigation: true
serverless: false
component: true
sitemap: true
mcp: false
Key | Type | Description |
---|---|---|
|
| Indicates if the Blocklet is designed to run in a multi-instance, clustered environment. |
|
| Specifies the DID Space requirement. Valid values are |
|
| If |
|
| Specifies if the Blocklet is compatible with serverless deployment environments. |
|
| If |
|
| Indicates that the Blocklet supports a composable sitemap. |
|
| Indicates that the Blocklet supports the MCP server sitemap. |
Authentication#
Blocklet Server provides a built-in authentication service that you can configure for any of your web interfaces. To enable it, add an auth
service to an interface's services
array and specify its configuration.
interfaces:
- type: 'web'
name: 'publicUrl'
path: '/'
prefix: '*'
services:
- name: 'auth'
config:
whoCanAccess: 'invited'
blockUnauthenticated: true
allowSwitchProfile: true
ignoreUrls:
- '/api/public/*'
- '/assets/*'
Configuration Options (config
):
Key | Type | Description |
---|---|---|
|
| Defines access control. Options: |
|
| If |
|
| If |
|
| If |
|
| An array of URL patterns that are exempt from authentication checks. |
|
| Deprecated. Defines which user profile fields your Blocklet requires. |
Navigation#
The navigation
field allows your Blocklet to add entries to the Blocklet Server's main navigation menu, creating a seamless user experience. You can define a hierarchy of links, complete with icons, roles, and internationalization.
navigation:
- id: 'home'
title: 'Home'
link: '/'
icon: 'home'
role: ['owner', 'guest']
- id: 'settings'
title: 'Settings'
icon: 'cog'
items:
- title: 'Profile'
link: '/settings/profile'
role: ['owner']
- title: 'Billing'
link: '/settings/billing'
role: ['owner']
- id: 'docs'
title: 'Documentation'
link: 'https://docs.arcblock.io'
visible: true
Navigation Item Properties:
Key | Type | Description |
---|---|---|
|
| A unique identifier for the navigation item, following JavaScript variable naming rules. |
|
| The text displayed for the menu item. Can be a string or a key-value object for localization (e.g., |
|
| A tooltip or description for the menu item. Can also be localized. |
|
| The destination URL. Can be a relative path (e.g., |
|
| The name of a component Blocklet that provides the content for this navigation item. |
|
| Assigns the item to a specific navigation section. |
|
| An array of user roles that can see this item (e.g., |
|
| The name of an icon to display next to the title. |
|
| Controls the visibility of the navigation item. |
|
| An array of nested navigation items to create submenus. |
Theming#
The theme
object allows you to specify basic visual styles for your Blocklet to better integrate with the overall UI.
theme:
background:
header: '#FFFFFF'
footer: '#F8F8F8'
default: '#FAFAFA'
Key | Type | Description |
---|---|---|
|
| Sets the background color. It can be a single string for the entire Blocklet or an object specifying colors for |
Resource Sharing#
The resource
object enables your Blocklet to define and export data bundles that other Blocklets can consume. This is useful for sharing configurations, assets, or other structured data.
resource:
types:
- type: 'site.config'
description: 'General site configuration'
bundles:
- did: 'z2qa...'
type: 'site.config'
public: true
Key | Type | Description |
---|---|---|
|
| An array defining the kinds of resources the Blocklet provides. Each object has a |
|
| An array of the actual resource bundles being shared. Each object has a |
Custom Events#
Declare the custom events your Blocklet can emit. This allows other services or Blocklets within the system to subscribe and react to these events, creating powerful, loosely-coupled integrations.
events:
- type: 'post.published'
description: 'Triggered when a new post is published.'
- type: 'user.registered'
description: 'Triggered when a new user completes registration.'
Event Properties:
Key | Type | Description |
---|---|---|
|
| A unique event name, typically in |
|
| A clear, human-readable explanation of what the event signifies. Must be between 1 and 256 characters. |
By leveraging these features, you can significantly enhance your Blocklet's integration and functionality. Once you have configured these options, you can proceed to prepare your Blocklet for distribution. To learn more, see the Publishing guide.