Skip to main content
Building Chrome extensions with Para requires special considerations for state persistence and user experience. This walkthrough covers how to implement Chrome storage overrides, background workers, and seamless authentication flows.

Chrome Extension Challenges

Chrome extensions present unique challenges for web applications:
  • State resets - Clicking outside a popup can close and reset the application state
  • Limited popup space - Small popup windows aren’t ideal for complex authentication flows
  • Background execution - Background workers need access to authentication state
  • Storage limitations - Standard localStorage/sessionStorage APIs work differently in extensions

Solution Overview

Para addresses these challenges through:
  1. Storage overrides - Custom storage implementations using Chrome extension APIs
  2. Singleton promise pattern - Shared Para instance across popup and background
  3. Smart routing - Background worker decides between popup vs tab based on auth state
  4. State persistence - Authentication state survives popup closures

Setup and Configuration

Install Dependencies

Create Chrome Storage Overrides

Create a storage implementation that uses Chrome extension storage APIs:
lib/chrome-storage.ts

Configure Para Client

Create a singleton Para client with Chrome storage overrides:
lib/para/client.ts

Background Worker Implementation

Create a background worker that manages authentication flows:
background.ts

Manifest Configuration

Create a manifest.json file for your Chrome extension:
manifest.json

Application Setup

Main Application Component

components/App.tsx

Para Provider Setup

components/ParaProvider.tsx

User Experience Patterns

Smart Authentication Flow

The background worker implements smart routing based on authentication state:

State Persistence

Para state persists across popup sessions:

Error Handling

Implement robust error handling for extension-specific scenarios:

Building and Deployment

Build Configuration

Configure your build tool (Webpack, Vite, etc.) for Chrome extension:
webpack.config.js

Development Testing

  1. Build your extension:
  2. Load in Chrome:
    • Open chrome://extensions/
    • Enable “Developer mode”
    • Click “Load unpacked”
    • Select your dist folder
  3. Test authentication flows:
    • Click extension icon when logged out (should open tab)
    • Complete authentication
    • Click extension icon when logged in (should open popup)

Production Considerations

  • Permissions: Only request necessary permissions in manifest
  • CSP: Configure Content Security Policy for WASM and external resources
  • Error reporting: Implement error tracking for production
  • Performance: Optimize background worker to minimize resource usage

Advanced Features

Tab Communication

Communicate between popup and tabs:

Context Menus

Add context menu integration:

Troubleshooting

Common Issues

Storage not persisting:
  • Ensure useStorageOverrides: true is set
  • Check Chrome storage permissions in manifest
  • Verify storage override functions are async
Background worker not receiving state:
  • Confirm paraReady promise is properly awaited
  • Check console for initialization errors
  • Verify manifest background configuration
Popup closing unexpectedly:
  • This is expected Chrome behavior
  • Use tabs for complex flows
  • Implement state persistence with storage overrides

Next Steps

React Integration

Learn more about Para’s React integration

Session Management

Understand Para’s authentication system

Bulk Wallet Pregeneration

Intermediate · 25 min · Large-scale wallet generation

Ethereum Transfers

Intermediate · 20 min · Send ETH with Ethers and Viem

EIP-712 Typed Data Signing

Intermediate · 20 min · Structured data signing