Backend Integration
BrowseGenius now integrates with a Cloudflare Workers backend for cloud sync, user management, and cross-device access to your projects and test plans.
Features
- Cloud Sync: Projects and test plans automatically sync to the backend
- User Accounts: Secure authentication with subscription tiers
- Cross-Device: Access your data from any browser
- Screenshot Storage: Cloudflare R2 for efficient image storage
- API Credits: Track usage with built-in credit system
Setup
1. Create an Account
Sign up at the BrowseGenius API to get started:
# Using the API directly
curl -X POST https://api.browsegenius.com/api/v1/auth/signup \
-H "Content-Type: application/json" \
-d '{"email":"your@email.com","password":"your_password","name":"Your Name"}'You'll receive:
- User ID
- JWT token for authentication
- Initial API credits (100 for free tier)
2. Generate Extension API Key
Once logged in, create an extension API key:
curl -X POST https://api.browsegenius.com/api/v1/extension-keys \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{"name":"My Browser Extension"}'Save the returned API key (format: bgx_...) securely.
3. Configure Extension
- Open the BrowseGenius popup
- Click the Settings icon
- Enter your Extension API Key (starts with
bgx_) - Click Save Keys
The extension will now sync your data automatically.
How It Works
Local-First Architecture
BrowseGenius uses a local-first approach:
- All operations work offline
- Data is stored in browser localStorage
- Changes sync to backend when online
- No data loss if backend is unavailable
Automatic Sync
Background sync runs every 5 minutes and:
- Uploads new projects to backend
- Syncs evals, phases, and test cases
- Fetches updates from other devices
- Updates user info (credits, subscription)
Data Flow
User Action (Create Eval)
↓
Local State Updated (Instant)
↓
API Call to Backend
↓
Backend Stores in D1 Database
├─ Evals (test_plans table)
├─ Phases (phases table)
├─ Test Cases (eval_test_cases table)
└─ Test Results (eval_test_results table)
↓
Local State Marked as "Synced"Eval Workflow
The new eval workflow follows this structure:
- Create Eval - Initialize a new evaluation for a project
- Discover Phases - Identify navigation sections (Dashboard, Settings, etc.)
- Capture Screenshots - Take screenshots for each phase
- Discover Tests - Generate test cases for each phase (up to 10 per phase)
- Run Tests - Execute test cases and record results
- Generate Report - Compile results across all phases
Data Hierarchy:
Project
└─ Eval (Test Plan)
├─ Phase 1 (Dashboard)
│ ├─ Capture 1
│ ├─ Test Case 1
│ ├─ Test Case 2
│ └─ Test Results
├─ Phase 2 (User Management)
│ ├─ Capture 1
│ └─ Test Cases...
└─ Phase N...User Info Badge
When connected, the extension displays:
- Subscription Tier: Free, Pro, or Enterprise
- API Credits: Remaining credits for AI operations
- Refresh Button: Manually update user info
Subscription Tiers
| Tier | API Credits | Projects | Test Plans | Support |
|---|---|---|---|---|
| Free | 100/month | 10 | 50 | Community |
| Pro | 1,000/month | Unlimited | Unlimited | |
| Enterprise | Custom | Unlimited | Unlimited | Priority |
API Endpoints
The backend provides RESTful APIs for all operations:
Projects
GET /api/v1/projects- List all projectsGET /api/v1/projects/:id- Get single projectPOST /api/v1/projects- Create projectPUT /api/v1/projects/:id- Update projectDELETE /api/v1/projects/:id- Delete projectPOST /api/v1/projects/by-hostname- Get/create by hostname
Evals (Test Plans)
GET /api/v1/test-plans?projectId=...- List evals for projectGET /api/v1/test-plans/:id- Get eval with phasesPOST /api/v1/test-plans- Create evalPUT /api/v1/test-plans/:id- Update evalPATCH /api/v1/test-plans/:id/status- Update eval statusDELETE /api/v1/test-plans/:id- Delete eval
Eval Statuses: new, discovering, testing, completed
Phases
Phases represent navigation sections within an eval (e.g., Dashboard, User Management).
GET /api/v1/phases/eval/:evalId- List phases for evalGET /api/v1/phases/:id- Get phase details (includes test case count)POST /api/v1/phases- Create phasePUT /api/v1/phases/:id- Update phasePATCH /api/v1/phases/:id/status- Update phase statusDELETE /api/v1/phases/:id- Delete phase
Phase Statuses: new, discovering, tests_discovered, tests_running, completed
Create Phase Example:
{
"evalId": "eval-uuid",
"name": "Dashboard Navigation",
"navigationUrl": "/dashboard",
"navigationGroup": "navbar",
"orderIndex": 0
}Test Cases
Individual test cases within a phase.
GET /api/v1/eval-test-cases/phase/:phaseId- List test cases for phaseGET /api/v1/eval-test-cases/:id- Get test casePOST /api/v1/eval-test-cases- Create test casePUT /api/v1/eval-test-cases/:id- Update test casePATCH /api/v1/eval-test-cases/:id/status- Update test case statusDELETE /api/v1/eval-test-cases/:id- Delete test case
Test Case Statuses: pending, running, passed, failed, skipped
Create Test Case Example:
{
"phaseId": "phase-uuid",
"title": "Verify dashboard loads correctly",
"description": "Test that the dashboard page loads without errors",
"steps": [
"Navigate to /dashboard",
"Wait for page to load",
"Verify main widgets are visible"
],
"expectedResult": "Dashboard displays all widgets without errors",
"domSelector": ".dashboard-widget",
"orderIndex": 0
}Test Results
Execution results for test cases.
GET /api/v1/eval-test-results/test-case/:testCaseId- Results for test caseGET /api/v1/eval-test-results/phase/:phaseId- Results for phaseGET /api/v1/eval-test-results/eval/:evalId- Results for evalGET /api/v1/eval-test-results/:id- Get single resultPOST /api/v1/eval-test-results- Submit test resultGET /api/v1/eval-test-results/phase/:phaseId/stats- Phase statisticsGET /api/v1/eval-test-results/eval/:evalId/stats- Eval statistics
Submit Result Example:
{
"testCaseId": "test-case-uuid",
"status": "passed",
"executionTimeMs": 1250,
"errorMessage": null,
"screenshotR2Key": null
}Result Statuses: passed, failed, error
Captures (Screenshots)
POST /api/v1/captures/upload- Upload screenshotGET /api/v1/captures?projectId=...- List capturesGET /api/v1/captures/:id- Get capture metadataGET /api/v1/captures/:id/image- Get imagePATCH /api/v1/captures/:id- Update capture metadataDELETE /api/v1/captures/:id- Delete capture
Upload Capture (with Phase/Eval):
{
"projectId": "project-uuid",
"phaseId": "phase-uuid",
"evalId": "eval-uuid",
"imageData": "data:image/png;base64,...",
"url": "https://example.com/dashboard",
"title": "Dashboard Screenshot",
"notes": "Initial state",
"domSnapshot": {...}
}User Info
GET /api/v1/info- Get user info and credits
All requests require the X-Api-Key header:
curl https://api.browsegenius.com/api/v1/projects \
-H "X-Api-Key: bgx_your_api_key_here"Offline Mode
Without an Extension API Key:
- Extension works normally
- All data stored locally
- No sync to backend
- No cross-device access
This is perfect for:
- Privacy-sensitive work
- Air-gapped environments
- Testing without account
Troubleshooting
Sync Failures
Symptom: Projects not appearing on other devices
Solutions:
- Check API key is correct in Settings
- Verify backend is reachable:
https://api.browsegenius.com/health - Check browser console for errors
- Click refresh button in user badge
- Try manual sync by reloading extension
Authentication Errors
Symptom: "Invalid or revoked extension API key"
Solutions:
- Regenerate API key via backend
- Clear localStorage and re-enter key
- Verify key starts with
bgx_ - Check key hasn't been revoked
Credits Not Updating
Symptom: Credit count stays the same
Solutions:
- Click refresh button in user badge
- Wait for background sync (5 minutes)
- Check subscription status
- Contact support if credits should renew
Security
Data Protection
- API keys stored only in browser localStorage
- HTTPS encryption for all API calls
- Authentication required for all operations
- Keys scoped to single user
Best Practices
- Never share your Extension API Key
- Revoke unused keys regularly
- Use different keys for different browsers
- Keep backup of important projects
Privacy
- Screenshots stored in Cloudflare R2
- DOM snapshots never leave backend
- No analytics or tracking
- Data deleted on account closure
Migration from Local-Only
If you've been using BrowseGenius without backend:
- Backup existing data: Export all projects and test plans
- Set up account: Create account and get API key
- Configure extension: Enter API key in settings
- Verify sync: Check projects appear in backend
- Cross-device: Install on other browsers with same key
Your local data will automatically upload on first sync.
Rate Limits
To ensure fair usage:
- 100 requests/minute per API key
- 10,000 requests/day per user
- Screenshot uploads limited to 10MB per file
Exceeded limits return 429 Too Many Requests.
Roadmap
Coming soon:
- Team sharing and collaboration
- Project templates
- Scheduled test execution
- Webhooks for CI/CD integration
- Real-time sync via WebSockets
Support
Need help?
- Check Troubleshooting
- View API Status
- Email: support@browsegenius.com
- GitHub Issues: Report Bug