This document provides step-by-step flows and sequence diagrams for key Orbito operations.
-
Developer visits Orbito Platform Dashboard
- Goes to the Orbito admin portal
-
Register New Website
- Fills form: domain, website name, owner email
- Clicks "Register Website"
-
Backend Generates API Key
- Creates UUID for
website_id - Generates unique
api_key - Stores in
websitescollection
- Creates UUID for
-
Developer Receives API Key
- Dashboard displays API key
- Developer copies key for SDK installation
Developer Dashboard Backend MongoDB
| | | |
|--Register Form--->| | |
| |--POST /register->| |
| | |--Insert website-->|
| | |<--Success---------||
| |<--API Key--------| |
|<--Display Key-----| | |
| | | |
-
Developer Installs SDK
npm install orbito-react-sdk
-
Developer Wraps App with OrbitoProvider
<OrbitoProvider apiKey="orbito_key_..." domain="shop.example.com"> <App /> </OrbitoProvider>
-
SDK Initializes on Page Load
- Creates WebSocket/message listener
- Initializes local action registry
- Sends
ORBITO_SDK_READYmessage to window
-
Developer Wraps UI Components
const { register } = useOrbitoAction({ actionId: 'add-to-cart', intent: 'addToCart', description: 'Add product to cart', // ... }); <button {...register(() => handleAddToCart())}> Add to Cart </button>
-
SDK Registers Actions with Backend
- On component mount, SDK calls
POST /api/v1/actions/register - Backend stores action in MongoDB
- On component mount, SDK calls
Page Load SDK Backend MongoDB
| | | |
|--Mount---->| | |
| |--Initialize-->| |
| | | |
| |<--Ready-------| |
|<--Ready----| | |
| | | |
[Component Mount] | |
| | | |
|--Mount---->| | |
| |--Register---->| |
| | Action |--Upsert----->|
| | |<--Success----|
| |<--Success-----| |
| | | |
-
User Opens Orbito-enabled Website
- Website loads with SDK initialized
-
Extension Content Script Detects SDK
- Listens for
ORBITO_SDK_READYmessage - Sends message to extension popup
- Listens for
-
User Opens Extension Popup
- Popup UI displays "Orbito Enabled" badge
- Shows loading state
-
Extension Fetches Actions from Backend
- Extracts domain from current tab URL
- Calls
GET /api/v1/actions?domain=shop.example.com
-
Backend Returns Available Actions
- Queries MongoDB for active actions
- Returns action list with metadata
-
Extension Displays Actions in UI
- Lists actions with descriptions
- Groups by intent or page
- Shows action parameters
User Extension(Popup) Content Script SDK Backend MongoDB
| | | | | |
|--Open Tab--->| | | | |
| | | | | |
| | |<--SDK Ready--| | |
| |<--SDK Detected--| | | |
| | | | | |
|--Click Ext-->| | | | |
| | | | | |
| |--Get domain---->| | | |
| | | | | |
| |----------GET /actions?domain=...------------>| |
| | | | |--Query---->|
| | | | |<--Actions--|
| |<-------------------Action List---------------| |
| | | | | |
|<--Display----| | | | |
| Actions | | | | |
| | | | | |
-
User Selects Action in Extension
- Types natural language: "add 2 items to cart"
- OR clicks action from list
-
Extension Parses Intent & Parameters
- Matches prompt to action intent
- Extracts parameters (quantity: 2)
-
Extension Highlights Target Element (Optional)
- Sends
ORBITO_HIGHLIGHT_ACTIONto content script - Content script forwards to SDK
- SDK adds visual highlight to element
- Sends
-
Extension Sends Execution Request
- Content script sends
ORBITO_EXECUTE_ACTIONmessage - Includes
action_idandparameters
- Content script sends
-
SDK Executes Action
- Looks up action in local registry
- Validates parameters
- Calls registered callback function
- Triggers actual UI interaction
-
SDK Returns Result
- Sends
ORBITO_ACTION_RESULTmessage - Includes success status and return data
- Sends
-
Extension Displays Feedback
- Shows success notification
- Removes highlight
- Updates usage analytics
-
SDK Reports Usage to Backend
- Calls
POST /api/v1/actions/{action_id}/usage - Backend increments
usage_countin MongoDB
- Calls
User Extension Content SDK Page/App Backend MongoDB
| | Script | | | |
|--Type--| | | | | |
| "add"---> | | | | |
| | | | | | |
| |--Match--| | | | |
| | Intent | | | | |
| | | | | | |
| |------HIGHLIGHT---->| | | |
| | |--------->| | | |
| | | |--Highlight->| | |
| | | | Element | | |
| | | | | | |
| |------EXECUTE------>| | | |
| | | ACTION | | | |
| | |--------->| | | |
| | | |--Validate-->| | |
| | | | Params | | |
| | | | | | |
| | | |--Execute--->| | |
| | | | Callback | | |
| | | | | | |
| | | | |--Update-->| |
| | | | | State | |
| | | | | | |
| | | |<--Result----| | |
| | | | | | |
| | | |----POST /usage-------->| |
| | | | | |--Inc---->|
| | | | | | Count |
| | | | | |<---------||
| | | | | | |
| | |<--RESULT-| | | |
| |<-----------| | | | |
| | Success | | | | |
| | | | | | |
|<--Show-| | | | | |
| Success| | | | | |
| | | | | | |
-
Admin Logs into Dashboard
- Authenticates with owner credentials
-
Dashboard Displays Registered Websites
- Lists all websites with action counts
-
Admin Selects Website
- Clicks on domain to view details
-
Dashboard Shows Website Actions
- Fetches
GET /api/v1/actions?domain=... - Displays table with:
- Action ID
- Intent
- Description
- Usage count
- Status (active/inactive)
- Fetches
-
Admin Toggles Action Status
- Clicks toggle switch
- Dashboard sends
PATCH /api/v1/actions/{action_id}/status - Backend updates
is_activefield
-
Extension Respects Active Status
- Only active actions appear in extension
- Inactive actions are filtered out by backend
Admin Dashboard Backend MongoDB
| | | |
|--Login-->| | |
| | | |
| |--GET Websites---------->|
| | |<--List-----|
|<--Show---| | |
| Websites | | |
| | | |
|--Select->| | |
| Website | | |
| |--GET Actions---------->||
| | |<--List-----|
|<--Show---| | |
| Actions | | |
| | | |
|--Toggle->| | |
| Status | | |
| |--PATCH Status--------->|
| | |--Update--->|
| | |<--Success--|
| |<--Success--| |
|<--Updated| | |
| | | |
-
User Navigates to New Page in SPA
- React Router changes route
-
New Components Mount
- Components with
useOrbitoActioninitialize
- Components with
-
SDK Detects New Actions
- Adds to local registry
- Registers with backend (debounced)
-
Previous Page Components Unmount
- SDK removes from local registry
- Backend actions remain (marked as inactive or kept)
-
Extension Updates Available Actions
- Optionally polls backend for updated list
- Or SDK sends
ORBITO_ACTION_STATE_CHANGEDmessage
User SPA/Router Component SDK Backend
| | | | |
|--Click-->| | | |
| Link | | | |
| |--Navigate->| | |
| | | | |
| | |--Mount--->| |
| | | | |
| | | |--Register->|
| | | | Action |
| | | |<--Success--|
| | | | |
| |<--Unmount--| | |
| | (Old Comp) | | |
| | |---------->| |
| | | Unregister| |
| | | (local) | |
| | | | |
Extension SDK Backend
| | |
|--Execute-| |
| Action | |
| |--Validate->|
| | Params |
| | |
| |<--Invalid--|
| | Parameter |
| | |
|<--Error--| |
| Result | |
| | |
[Show Error Notification] |
Extension Content Page
| Script |
|--Check-->| |
| SDK | |
| |--Listen->|
| | 5s |
| | |
|<--Timeout| |
| | |
[Show "SDK Not Detected"]|
SDK Backend
| |
|--Register
| Action |
| X (503)
| |
|--Retry-->|
| (3x) |
| X
| |
[Queue locally, retry later]
| |
|--Retry-->|
| (1 min) |
| |
|<--Success|
These flows ensure:
- Decoupled development: Each team can work independently using contracts
- Reliable communication: Message protocol handles all edge cases
- Data consistency: Backend serves as single source of truth
- User experience: Visual feedback and error handling throughout
- Scalability: Async operations and debouncing prevent overload