Converting Browser Pool into a multi-tenant SaaS platform for screenshot-as-a-service.
- Runtime: Node.js with TypeScript
- Web Framework: Hono
- Database: PostgreSQL
- ORM: Prisma
- Browser Automation: Playwright
- Authentication: API Key-based
- Logging: Winston
- id (UUID)
- email (unique)
- password_hash
- name
- plan (FREE, PRO, ENTERPRISE)
- status (ACTIVE, SUSPENDED, DELETED)
- created_at
- updated_at
- id (UUID)
- user_id (FK to Users)
- key (unique, hashed)
- name (user-defined label)
- last_used_at
- created_at
- revoked_at (nullable)
- id (UUID)
- api_key_id (FK to API Keys)
- user_id (FK to Users)
- endpoint
- url_requested
- status_code
- response_time_ms
- error_message (nullable)
- created_at
- id (UUID)
- user_id (FK to Users)
- period_start
- period_end
- requests_made
- requests_limit
- created_at
- 100 screenshots/month
- 5 requests/minute
- Standard support
- Basic features
- 5,000 screenshots/month
- 30 requests/minute
- Priority support
- Advanced cookie handling
- Webhook notifications
- 100,000 screenshots/month
- 100 requests/minute
- Dedicated support
- Custom features
- SLA guarantee
POST /auth/register- Register new userPOST /auth/login- Login userGET /health- Health check
POST /screenshot- Take screenshotGET /usage- Get current usage statsGET /api-keys- List user's API keysPOST /api-keys- Create new API keyDELETE /api-keys/:id- Revoke API key
GET /admin/users- List all usersGET /admin/users/:id- Get user detailsPATCH /admin/users/:id- Update userGET /admin/analytics- System-wide analyticsGET /admin/health- Detailed health metrics
- API key hashing (bcrypt)
- Rate limiting per API key
- Input validation and sanitization
- CORS configuration
- Request size limits
- IP-based rate limiting (optional)
- Request success/failure rates
- Average response times
- Popular URLs requested
- User growth metrics
- Resource utilization
- Database connection pooling
- Browser pool per user/plan tier
- Horizontal scaling support
- CDN for static assets
- Queue system for high-volume requests (future)
- ✅ Phase 1: Database setup and Prisma integration
- ✅ Phase 2: Authentication and API key management
- ✅ Phase 3: Rate limiting and usage tracking
- ✅ Phase 4: Subscription management
- ✅ Phase 5: Admin dashboard
- ✅ Phase 6: Production deployment config