π οΈ Development Setup
SuperSafe Wallet development guide for setting up the development environment and building the extension.
Getting Startedβ
Prerequisitesβ
- Node.js: 18.x or higher
- npm: 9.x or higher
- Chrome/Brave: Latest version
- Git: For version control
Installationβ
# Clone repository
git clone https://github.com/SuperSafeWallet/SuperSafe.git
cd SuperSafe
# Install dependencies
npm install
# Build extension
npm run build
# Or build in development mode
npm run build:debug
Loading Extensionβ
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top right)
- Click Load unpacked
- Select the
dist/directory - Extension should appear in your extensions list
Project Structureβ
SuperSafe/
βββ src/ # Source code
β βββ background/ # Background service worker
β βββ components/ # React components
β βββ contexts/ # React contexts
β βββ hooks/ # Custom React hooks
β βββ controllers/ # Controller layer
β βββ handlers/ # Request handlers
β βββ services/ # Service layer
β βββ utils/ # Utilities
β βββ App.jsx # Main app component
β βββ main.jsx # React entry point
β βββ background.js # Background entry point
β βββ content-script.js # Content script
βββ public/ # Static assets
β βββ assets/ # Images, fonts, configs
βββ dist/ # Build output (generated)
βββ Docs/ # Documentation
βββ scripts/ # Build scripts
βββ vite.config.js # Frontend build config
βββ vite.config.worker.js # Background worker config
βββ vite.config.content.js # Content script config
βββ tailwind.config.js # TailwindCSS config
βββ package.json # Dependencies & scripts
Development Workflowβ
Development Modeβ
# Build with debug mode (more verbose logging)
npm run build:debug
# Watch mode (rebuild on file changes) - Not available
# Manual rebuild required after code changes
Hot Reloadβ
Chrome extensions don't support traditional hot reload. After code changes:
- Rebuild:
npm run build - Go to
chrome://extensions/ - Click the refresh icon on SuperSafe extension
- Reload any open dApp pages
Development Tipsβ
Console Logging:
- Background logs:
chrome://extensions/β Click "service worker" link - Popup logs: Right-click popup β Inspect
- Content script logs: Open dApp page β F12 Console
Debug Mode:
// Enable verbose logging
localStorage.setItem('SUPERSAFE_DEBUG', 'true');
// Check logs
console.log('[Component] Debug message');
Build Systemβ
Build Commandsβ
Location: package.json
{
"scripts": {
"build": "npm run clean && npm run build:frontend && npm run build:background && npm run build:content",
"build:dev": "NODE_ENV=development npm run build",
"build:prod": "NODE_ENV=production npm run build",
"build:debug": "npm run build:frontend && vite build --config vite.config.worker.js --mode debug && npm run build:content",
"build:frontend": "vite build",
"build:background": "npm run build:worker",
"build:content": "vite build --config vite.config.content.js",
"clean": "rm -rf dist"
}
}
Script Descriptions:
| Script | Purpose | Output |
|---|---|---|
build | Full production build (all bundles) | dist/ with all files |
build:dev | Development build (verbose logging) | dist/ with source maps |
build:prod | Production build (optimized) | dist/ minified |
build:debug | Debug build (background only) | dist/ with debug symbols |
build:frontend | Frontend only | dist/popup.js, dist/provider.js |
build:background | Background only | dist/background.js |
build:content | Content script only | dist/content-script.js |
Environment Variablesβ
Required Environment Variables (.env file):
# Moralis API Keys (for transaction history)
MORALIS_API_KEY=your_moralis_api_key_here
MORALIS_API_KEY_BACKUP=backup_key_1 # Optional
MORALIS_API_KEY_BACKUP2=backup_key_2 # Optional
# WalletConnect Project ID
WALLETCONNECT_PROJECT_ID=your_project_id_here
# Alchemy API Keys (for RPC endpoints)
ALCHEMY_API_KEY_ETHEREUM=your_key_here
ALCHEMY_API_KEY_OPTIMISM=your_key_here
ALCHEMY_API_KEY_BASE=your_key_here
ALCHEMY_API_KEY_ARBITRUM=your_key_here
Code Standardsβ
Architecture Complianceβ
- β NO ethers imports: Frontend never imports ethers.js
- β Uses Adapters only: All crypto operations via adapters
- β Thin client pattern: Zero business logic in frontend
- β All crypto in background: Private keys never exposed
Code Styleβ
- JavaScript: Follow Airbnb JavaScript Style Guide
- TypeScript: Follow TypeScript Deep Dive Guide
- Comments: Use Better Comments style (
// * Important,// ! Warning,// TODO:) - Docstrings: Use JSDoc for functions
Document Status: β
Current as of November 15, 2025
Code Version: v3.0.0+
Maintenance: Review after major development changes