Architecture
Overview
Tarobase combines traditional backend services with web3 technology to provide a hybrid solution for modern web and mobile applications. This architecture allows developers to leverage the benefits of both centralized and decentralized systems.
Key Components
- Tarobase SDK: The client-side library that applications use to interact with Tarobase services.
- API Layer: Handles requests from the SDK and routes them to the appropriate services.
- Authentication Service: Manages user authentication and session handling.
- Data Storage:
- Off-chain storage that aggregates blockchain-based data and traditional data into a single data store
- On-chain storage for blockchain-based data
- Smart Contract Layer: Manages on-chain data and executes blockchain transactions.
- Policy Engine: Enforces access rules and data validation based on defined policies regardless if data is being set on-chain or off-chain.
Data Flow
- Client application makes a request through the Tarobase SDK.
- The SDK formats the request and sends it to the API Layer.
- The API Layer authenticates the request and applies any necessary transformations.
- The Policy Engine checks the request against the defined policies.
- For off-chain data, the request is routed to the appropriate data storage service.
- For on-chain data, the request is sent to the Smart Contract Layer for on-chain policy engine verification and processing.
- The response is sent back through the API Layer to the SDK.
- The SDK returns the data to the client application.
On-Chain vs. Off-Chain Storage
Tarobase allows developers to choose between on-chain and off-chain storage for different types of data:
-
On-Chain Storage:
- Used for data that requires high transparency and immutability
- Stored directly on the blockchain (all data is public)
- Slower and more expensive for frequent updates
- Ideal for critical application state, ownership records, etc.
-
Off-Chain Storage:
- Used for data that doesn't require blockchain features
- Stored in traditional databases
- Faster and more cost-effective for frequent updates
- Ideal for user profiles, application metadata, etc.
- Private data can be stored privately
Smart Contract Integration
Tarobase's Smart Contract Layer manages the interaction with blockchain networks:
- Deploys and manages application-specific smart contracts
- Handles transaction signing and submission
- Manages gas fees and transaction optimization
- Provides abstraction for complex blockchain operations
Security Considerations
- Authentication: Uses secure, blockchain-based authentication methods
- Data Encryption: Applies encryption to sensitive off-chain data
- Access Control: Enforces granular access control through the Policy Engine
- Smart Contract Auditing: Regularly audits and updates smart contracts for security
- Rate Limiting: Implements rate limiting to prevent abuse of the API and blockchain resources
Scalability
Tarobase's architecture is designed for scalability:
- Horizontal Scaling: API and off-chain storage layers can be scaled horizontally
- Caching: Implements caching strategies to reduce blockchain queries
- Optimistic Updates: Uses optimistic updates for improved user experience
- Batch Processing: Aggregates multiple on-chain transactions when possible
For more detailed information on Tarobase's architecture and best practices for building scalable applications, refer to our Advanced Topics section.