> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prisme.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Framework Architecture

> Understand the technical architecture and design principles behind Builder

Builder is built on a modern, event-driven architecture that enables scalable, flexible, and maintainable AI applications. This page explains the core architectural principles and components that power the platform.

## Three-Tier Architecture

Builder follows a classic three-tier architecture pattern, modernized for cloud-native, event-driven applications:

<Tabs>
  <Tab title="Presentation Tier">
    The UI layer that users interact with, built using:

    * **React**: For component-based UI development
    * **Vite**: For compiling the page source during preview and deployment
    * **Tailwind CSS**: For styling and responsive design
    * **Radix UI**: For accessible interface primitives

    This tier is represented by **Pages** in the Builder interface. Pages are edited as source files and rendered through Builder's native preview.
  </Tab>

  <Tab title="Application Tier">
    The business logic layer that processes data and orchestrates workflows:

    * **Event Processing Engine**: For handling asynchronous operations
    * **API Gateway**: For external system integration
    * **Runtime**: For automation runtime

    This tier is represented by Automations in the Builder interface.
  </Tab>

  <Tab title="Data Tier">
    The storage layer that maintains state and persists information:

    * **Memory Stores**: For session, user, and global variables
    * **Event Log**: For activity tracking and debugging
    * **Vector Databases**: For AI knowledge storage (with Knowledges)
    * **Relational Databases**: For structured data connected through imports or custom workflows

    This tier is accessed through variables and specialized apps.
  </Tab>
</Tabs>

## Event-Driven Architecture (EDA)

Builder's core interaction model is built around events, enabling loose coupling and asynchronous communication between components:

### Key Components of the EDA

<AccordionGroup>
  <Accordion title="Event Types">
    <Card title="System Events">
      **Description:** Platform-generated events for key operations\
      **Examples:** page load, automation start/end, error occurrence
    </Card>

    <Card title="Custom Events">
      **Description:** User-defined events for application-specific logic\
      **Examples:** form submission, data request, process completion
    </Card>

    <Card title="UI Events">
      **Description:** User interaction events from pages\
      **Examples:** button click, selection change, data input
    </Card>

    <Card title="External Events">
      **Description:** Webhooks and API calls from outside systems\
      **Examples:** third-party notifications, scheduled triggers, external system callbacks
    </Card>
  </Accordion>

  <Accordion title="Event Communication Channels">
    <Card title="WebSocket">
      **Description:** Real-time communication between frontend and backend\
      **Used for:** UI updates, event streaming, long-running processes
    </Card>

    <Card title="HTTP">
      **Description:** Request-response communication for APIs\
      **Used for:** External system integration, data fetching, authentication
    </Card>

    <Card title="Event Broker">
      **Description:** Internal communication between automations\
      **Default implementation:** Redis Streams for reliable, ordered event delivery
    </Card>
  </Accordion>

  <Accordion title="Event Processing">
    <Card title="Synchronous Processing">
      **Description:** Immediate handling with response\
      **Used for:** Direct API calls, user-facing operations requiring immediate feedback
    </Card>

    <Card title="Asynchronous Processing">
      **Description:** Queued handling without waiting\
      **Used for:** Background tasks, long-running operations, scheduled processes
    </Card>

    <Card title="Event Correlation">
      **Description:** Tracking related events across the system\
      **Implementation:** Correlation IDs to trace event chains through the system
    </Card>
  </Accordion>
</AccordionGroup>

### Event Flow in Builder

<Steps>
  <Step title="Event Emission">
    Events can originate from multiple sources:

    * Page components emitting user interaction events
    * Pages emitting lifecycle and navigation events
    * Automations emitting custom process events
    * External systems emitting webhook events
  </Step>

  <Step title="Event Routing">
    The event router determines where events should be delivered:

    * UI events are routed to relevant automations
    * Automation events may be routed to other automations
    * System events are routed to appropriate handlers
    * Events can be filtered and transformed during routing
  </Step>

  <Step title="Event Handling">
    Recipients process events according to their type:

    * Pages may update state, navigate, or render automation results
    * Automations execute logic sequences in response to events
    * System components update state or perform operations
  </Step>

  <Step title="Event Logging">
    All events are recorded in the Activity log:

    * Event metadata (timestamp, source, type)
    * Event payload (data content)
    * Correlation information (related events)
    * Processing results and any errors
  </Step>
</Steps>

## Microservices Architecture

Builder is built on a microservices foundation, providing scalability and resilience:

<CardGroup cols={2}>
  <Card title="Service Isolation" icon="box">
    **Description:** Each functional area operates as an independent service

    * UI rendering service
    * Automation execution service
    * Event processing service
    * Storage and persistence services
    * Integration services
  </Card>

  <Card title="API-First Design" icon="code">
    **Description:** All services communicate through well-defined APIs

    * RESTful HTTP interfaces
    * Event-based messaging
    * Versioned API contracts
    * Standardized error handling
  </Card>

  <Card title="Containerization" icon="box-open">
    **Description:** Services are packaged as containers for consistent deployment

    * Docker containers for all services
    * Kubernetes orchestration
    * Horizontal scaling capabilities
    * Resource isolation
    * Deployment consistency
  </Card>

  <Card title="Service Discovery" icon="magnifying-glass">
    **Description:** Dynamic service location and communication

    * Automatic service registration
    * Load balancing between instances
    * Health monitoring
    * Circuit breaking for fault tolerance
    * Failover mechanisms
  </Card>
</CardGroup>

## Cloud-Native Architecture

Builder is designed as a cloud-native application with key characteristics:

<Tabs>
  <Tab title="Infrastructure as Code">
    All infrastructure components are defined as code:

    * **Terraform**: For provisioning cloud resources
    * **Helm Charts**: For Kubernetes deployments
    * **GitOps**: For configuration management
    * **Declarative Specifications**: For resource definitions

    This enables consistent deployments across environments and clouds.
  </Tab>

  <Tab title="Multi-Cloud Support">
    Builder can run on multiple cloud providers:

    * **AWS**: Amazon Web Services
    * **Azure**: Microsoft Azure
    * **GCP**: Google Cloud Platform
    * **OpenShift**: For hybrid cloud environments

    The platform is designed to leverage cloud-native services while maintaining portability.
  </Tab>

  <Tab title="Scalability">
    The architecture supports both vertical and horizontal scaling:

    * **Auto-scaling**: Based on load and resource utilization
    * **Stateless Design**: For easy replication
    * **Caching**: For performance optimization
    * **Distributed Processing**: For workload distribution

    This ensures the platform can handle varying loads efficiently.
  </Tab>
</Tabs>

## Security Architecture

Security is built into every layer of the Builder framework:

<AccordionGroup>
  <Accordion title="Authentication & Authorization">
    <Card title="SSO Integration">
      Description:

      Enterprise single sign-on support
      Supports:

      SAML-v2 & OpenID Connect
    </Card>

    <Card title="RBAC">
      Description:

      Role-based access control
      Features:

      Granular permission model, custom role definitions, inheritance
    </Card>

    <Card title="API Security">
      Description:
      Secure API communication
      Implementation:
      API keys, JWT tokens, scoped permissions
    </Card>

    <Card title=" Workspace Isolation">
      Description:
      Secure separation between workspaces
      Approach:
      Logical and physical isolation of resources and data
    </Card>
  </Accordion>

  <Accordion title="Data Protection">
    <Card title="Encryption">
      Description:
      Data protection at rest and in transit
      Methods:
      TLS 1.3, AES-256, envelope encryption for secrets
    </Card>

    <Card title="Secrets Management">
      Description:

      Secure storage of sensitive information
      Implementation:

      Vault integration, key rotation, least privilege access
    </Card>

    <Card title="Data Residency">
      Description:
      Control over data location
      Features:
      Region selection, data sovereignty compliance
    </Card>

    <Card title="Privacy by Design">
      Description:
      Built-in privacy controls
      Implementation:
      Data minimization, purpose limitation, consent management
    </Card>
  </Accordion>

  <Accordion title="Security Monitoring">
    <Card title="Audit Logging">
      Description:
      Comprehensive activity tracking
      Captures:
      User actions, system changes, authentication events
    </Card>

    <Card title="Threat Detection">
      Description:

      Identifying potential security issues
      Methods:

      Anomaly detection, pattern recognition, behavior analysis
    </Card>

    <Card title="Compliance Reporting">
      Description:
      Documentation for regulatory requirements
      Features:
      Pre-built reports, evidence collection, control mapping
    </Card>

    <Card title="Vulnerability Management">
      Description:
      Identifying and addressing weaknesses
      Approach:
      Regular scanning, dependency analysis, patch management
    </Card>
  </Accordion>
</AccordionGroup>

## Memory Architecture

Builder implements a multi-tiered memory system for state management:

<Card title="Variable Scopes">
  **Description:** Different persistence levels for different needs

  * **Global Scope:** Workspace-wide variables available to all users and sessions
  * **User Scope:** User-specific variables persisted across sessions
  * **Session Scope:** Variables tied to the current user session
  * **Run Scope:** Temporary variables for the current automation execution
</Card>

<Card title="Storage Implementations">
  **Description:** Appropriate data storage based on scope

  * **In-memory Cache:** For temporary, high-speed access
  * **Redis:** For distributed, persistent session data
  * **Database:** For long-term user and global variables
  * **Specialized Storage:** Vector databases, document stores via apps
</Card>

<Card title="Access Patterns">
  **Description:** How variables are referenced and used

  * **Variable Syntax:** `{{scope.variable}}` notation
  * **Expression Evaluation:** Dynamic evaluation in automations and templates
  * **CRUD Operations:** Set, get, update, delete operations
  * **Reactive Updates:** Real-time UI updates on variable changes
</Card>

## Integration Architecture

Builder's integration capabilities connect with external systems through multiple approaches:

<Tabs>
  <Tab title="HTTP/REST">
    Direct HTTP communication with external APIs:

    * **HTTP Methods**: GET, POST, PUT, DELETE, PATCH
    * **Authentication**: Basic, Bearer Token, OAuth, API Key
    * **Content Types**: JSON, XML, Form-data, Binary
    * **Response Handling**: Status codes, body parsing, error management

    Used for most modern API integrations.
  </Tab>

  <Tab title="Webhooks">
    Event-based callbacks for real-time notifications:

    * **Inbound Webhooks**: Receiving events from external systems
    * **Outbound Webhooks**: Sending events to external listeners
    * **Security**: HMAC verification, IP filtering, rate limiting
    * **Payload Processing**: Transformation, validation, routing

    Used for event-driven integration patterns.
  </Tab>

  <Tab title="Imports">
    Pre-built integration packages for common systems:

    * **Data access**: data access to external databases
    * **API Catalog**: Curated collection of integration applications
    * **Legacy**: Connect AI to legacy applications without rewriting them
    * **Custom code**: Add reusable code packages and integration logic
    * **Updates**: Version management and compatibility

    Used for standard enterprise integrations.
  </Tab>
</Tabs>

## Development Approach

Builder supports a range of development approaches to accommodate different skill levels and requirements:

<CardGroup cols={3}>
  <Card title="Builder UI" icon="palette">
    **Description:** Product interface for configuring workspaces, automations, imports, files, and deployment

    **Key Features:**

    * Workspace sidebar
    * Native page preview
    * Automation graph preview
    * Activity trace views
  </Card>

  <Card title="Source Files" icon="file-code">
    **Description:** React page source edited from Builder

    **Key Features:**

    * React and TypeScript
    * Vite and Tailwind CSS
    * File tree and code editor
    * Desktop, tablet, and mobile preview
  </Card>

  <Card title="Automation Definitions" icon="code">
    **Description:** Declarative backend logic and advanced custom code

    **Key Features:**

    * YAML automation definitions
    * Version control friendly
    * Custom JavaScript or TypeScript
    * Endpoint, event, and schedule triggers
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Pages" icon="file-code" href="/products/ai-builder/pages">
    Discover page creation and management
  </Card>

  <Card title="Automations" icon="gears" href="/products/ai-builder/automations">
    Explore backend process development
  </Card>

  <Card title="Integrations" icon="plug" href="/products/ai-builder/integrations">
    Learn about connecting to external systems
  </Card>
</CardGroup>
