Overview
The Blocklet SDK is a library for building applications, also known as Blocklets, that run on Blocklet Server. It acts as a bridge between your application and the server's core functionalities, offering a comprehensive set of tools for tasks ranging from user authentication to inter-component communication. The SDK is available as an npm package for easy installation.
This SDK simplifies development by offering a high-level API over the underlying GraphQL interface of Blocklet Server. This abstraction allows you to focus on your application's logic instead of the complexities of direct server interaction.
For a quick path to a working example, refer to the Get Started guide.
Role in Blocklet Development#
The Blocklet SDK is integral to the development lifecycle. It enables your Blocklet to:
- Access Server APIs: Perform administrative operations, manage users and permissions, and configure node settings.
- Handle User Authentication: Securely integrate with DID Connect for a decentralized user login experience.
- Manage Notifications: Send and receive various types of notifications, keeping users and other services informed.
- Facilitate Component Communication: Interact with other Blocklets or components running on the same server instance.
- Access Environment Configuration: Retrieve runtime environment variables and dynamic application settings provided by Blocklet Server.
Architecture Overview#
The Blocklet SDK is positioned between your application code and Blocklet Server, abstracting the communication layer. The diagram below illustrates this relationship:
Core Features#
The Blocklet SDK is organized into several key modules, each providing a specific set of functionalities.
Module | Description |
---|---|
| Manages user authentication, sessions, and role-based access control. |
| Enables sending notifications to users via various channels. |
| Utilities for handling DID Wallet interactions and authentication flows. |
| Manages authentication flows specific to Blocklets within the DID Connect framework. |
| Provides an interface for Blocklet-specific data storage using a NeDB-like API. |
| Accesses the Blocklet's internal wallet for cryptographic operations. |
| Provides runtime access to environment variables and dynamic configurations. |
| A collection of Express.js middleware for auth, CSRF protection, and sitemaps. |
| Facilitates communication and data exchange between different components. |
| Includes utilities for data encryption and decryption. |
By providing a streamlined interface to these core services, the Blocklet SDK helps you build decentralized applications more efficiently. To start building your first Blocklet, proceed to the Get Started chapter.