Event Driven APIs
Building event driven applications with the Stateset API
Stateset One provides an event driven API for building autonomous commerce applications.
Core Architecture Principles
StateSet’s architecture is built upon a Three-Factor App model with a Durable Execution OS, ensuring scalability, reliability, and maintainability. Here’s how StateSet achieves this:
Three-Factor App Architecture with Durable Execution OS
- Single-Point GraphQL API for remote data joins across multiple data sources
- Event Triggers and Webhooks for seamless integration and automation
- Realtime Search capabilities for customer service and warehouse operations
- Data Validation and Synchronization to maintain data integrity
- Workflow Orchestration, Execution, and Automation using Temporal
- Automated Processes such as label printing and refund processing
- Comprehensive Testing with QA paths for all serverless functions
Three Factors of StateSet Architecture
Factor #1: Realtime GraphQL API
GraphQL serves as the backbone of StateSet’s flexible and realtime data interactions, providing an exceptional developer experience and efficient data retrieval.
Low-Latency Responses: Ensures users receive instant feedback on actions like state manipulation without noticeable delays. Support for Subscriptions: Enables realtime data streaming to clients via GraphQL Subscriptions, eliminating the need for continuous polling and enhancing scalability.
Factor #2: Reliable Eventing System
StateSet employs a robust event-driven architecture where business logic is triggered by events, ensuring decoupled and maintainable code.
Atomic Operations: All state mutations atomically generate corresponding events, maintaining consistency. Reliable Delivery: Guarantees at-least-once delivery of events to any consumer, ensuring no event is lost and enabling comprehensive state history for observability.
Factor #3: Asynchronous Serverless Functions
Business logic is implemented as small, cohesive event-handling functions deployed on a serverless architecture, optimizing for scalability and cost-efficiency.
Idempotent Functions: Designed to handle duplicate event deliveries gracefully, ensuring consistent outcomes. Out-of-Order Event Handling: Functions are built to operate correctly regardless of the order in which events are received, enhancing reliability.
Detailed Architecture Components
Three-Factor App Architecture with Durable Execution OS
StateSet’s architecture emphasizes separation of concerns, scalability, and reliability through:
- Modular Design: Segregates different business domains into distinct services, facilitating independent development and deployment.
- Durable Execution OS: Ensures that workflows and state transitions are reliably executed and persisted, preventing data loss and enabling recovery from failures.
Single-Point GraphQL API
The GraphQL API acts as a unified interface for clients, allowing:
- Remote Data Joins: Combines data from multiple sources efficiently, reducing the need for multiple API calls.
- Flexible Querying: Clients can request exactly the data they need, optimizing network usage and performance.
Event Triggers and Webhooks
StateSet leverages event triggers and webhooks to enable:
- Seamless Integrations: Connects with external systems and services effortlessly, facilitating real-time data exchange.
- Automated Workflows: Initiates automated processes based on specific events, enhancing operational efficiency.
Realtime Search Capabilities
Provides powerful search functionalities for:
- Customer Service: Enables support teams to access and manage customer information swiftly.
- Warehouse Operations: Facilitates efficient inventory management and order fulfillment processes.
Data Validation and Synchronization
Ensures data integrity and consistency through:
- Comprehensive Validation: Validates incoming data to prevent errors and inconsistencies.
- Synchronization Mechanisms: Keeps data across different services and databases in sync, maintaining a single source of truth.
Workflow Orchestration with Temporal
Utilizes Temporal for:
- Complex Workflow Management: Orchestrates intricate business processes with ease.
- Automated Execution: Ensures workflows are executed reliably and can recover from failures seamlessly.
Automated Processes
StateSet automates critical operations such as:
- Label Printing: Automatically generates and prints shipping labels for regions like the US and Canada.
- Refund Processing: Streamlines the handling of refund requests, ensuring quick and accurate transactions.
Comprehensive Testing and QA
Maintains high reliability through:
- Test QA Paths: Implements rigorous testing for all serverless functions, ensuring they perform as expected under various scenarios.