Normalized for Mintlify from
knowledge-base/aiconnected-business-platform/legacy-business-platform-specification.mdx.ORIGINAL PROMPT INSTRUCTIONS
From the start, the Secure Chat system will be a white label product, intended to be sold to agencies, and resold to business owners. First for the settings page, you will need to add seven types of user account pairs:- Super Admin (me/Oxford Pierpont)
- Super Admin Staff
- Agency Admin (white label client)
- Agency Staff
- Business Admin (end user clients) white-label-domain.com/secure-login
- Business Admin Staff
- Business Customers (end users)
- 7 user levels from Super Admin → Customer
- 2 separate login routes
- Staff roles inherit parent permissions
- Full schema with RLS policies
- Agencies → Businesses → Sessions → Messages chain
- Knowledge bases stored per business
- Encrypted API keys
- Simple mode: Just 2 colors + logo
- Advanced mode: 100+ customizable properties
- Organized by section: Sidebar, Header, Chat Window, Chat Input
- Separate light/dark mode configs
- Google Fonts integration
- Custom CSS upload
- 8 premade color themes (grayscale default)
- All labels/headings editable
- Role-based tab visibility
- All tabs you specified are mapped
- “Switch Services” grayed out for future
/chat/[account_id]for public access/admin/*for all admin functions- Session-based chat (no customer login)
- 7 phases from core platform → billing
securechat Platform Specification
Product Requirements Document v1.0
Platform Name: securechat Staging URL: staging.authAPI.net Production URL: securechat.sec-admn.com Product Type: White-label AI Chat Platform for Agencies1. PLATFORM OVERVIEW
1.1 Business Model
securechat is a B2B2B white-label platform:- Oxford Pierpont (Super Admin) operates the platform
- Agencies purchase white-label access and resell to their clients
- Businesses are the end clients who use the AI chat for their customers
- Customers interact with the chat interface (no account required)
1.2 Core Value Proposition
Agencies can offer branded AI chat solutions to their clients without building the technology. Each business gets a customized chat interface powered by their own knowledge base.2. USER HIERARCHY & AUTHENTICATION
2.1 User Types (7 Levels)
| Level | Role | Description | Login Route |
|---|---|---|---|
| 1 | Super Admin | Platform owner (Oxford Pierpont) | /auth-login |
| 2 | Super Admin Staff | Platform team members | /auth-login |
| 3 | Agency Admin | White-label client (reseller) | /agency-login |
| 4 | Agency Staff | Agency team members | /agency-login |
| 5 | Business Admin | End client (business owner) | /business-login or custom domain |
| 6 | Business Staff | Business team members | /business-login or custom domain |
| 7 | Customer | Chat end-user | No login (session-based) |
2.2 Authentication Routes
2.3 Account Identification
- Every account (Agency, Business) has a unique
account_id - Chat access via:
[domain]/chat/[account_id] - Session tracking via
session_id(UUID, no login required) - No user can access another user’s chat history
3. DATABASE SCHEMA
3.1 Core Tables
3.2 Row Level Security
4. ROUTE STRUCTURE
4.1 Authentication Routes
4.2 Admin Routes (Role-Based Access)
4.3 Public Routes
5. ADMIN SIDEBAR NAVIGATION
5.1 Super Admin Tabs
5.2 Agency Admin Tabs
5.3 Business Admin Tabs
6. BRANDING & STYLING SYSTEM
6.1 Customization Modes
Simple Mode
- Primary color
- Secondary color
- Logo upload
- (Auto-generates compatible theme)
Advanced Mode
Full granular control over every component.6.2 Styling Structure
6.3 Advanced Styling Schema
6.4 Premade Themes
6.5 Styling Inheritance
7. KNOWLEDGE BASE MANAGEMENT
7.1 Generation Flow
7.2 Editing Interface
- View mode: Read-only display of generated content
- Edit mode: Editable with warnings
Warning System
7.3 Crawl Settings
8. CHAT SETTINGS
8.1 Behavior Settings
9. INTEGRATIONS
9.1 AI Provider
9.2 Webhooks
9.3 Email (SMTP)
10. BILLING
10.1 Metrics Tracked
- Messages sent (AI API calls)
- Active sessions
- Leads captured
- sc generations
- Storage used
10.2 Billing Levels
- Platform → Agency: Usage-based or flat monthly
- Agency → Business: Agency controls pricing
11. SECURITY
11.1 Data Isolation
- Row Level Security on all tables
- Account ID + Session ID prevents cross-user access
- API keys encrypted at rest
- Audit logging for admin actions
11.2 Session Security
- Chat sessions are anonymous (no PII required)
- Session ID is UUID, not guessable
- Sessions expire after inactivity
- No session can access another session’s data
12. IMPLEMENTATION PHASES
Phase 1: Core Platform
- Database schema
- Authentication (all user types)
- Admin sidebar navigation
- Basic dashboard for each role
- Business management (CRUD)
Phase 2: Knowledge Base
- sc generator integration
- sc storage and retrieval
- sc editing interface
- Crawl scheduling
Phase 3: Chat Interface
- Public chat route
- Session management
- Message storage
- Lead capture
Phase 4: Styling System
- Simple mode
- Advanced mode
- Premade themes
- Live preview
Phase 5: Agency Features
- Agency management
- Client management
- Custom domains
- Agency-level branding
Phase 6: Integrations
- Webhook system
- Email notifications
- Multi-provider AI
Phase 7: Billing & Reporting
- Usage tracking
- Stripe integration
- Analytics dashboard
13. FILE STRUCTURE
14. NEXT STEPS
- Review this spec - Confirm structure and features
- Set up Supabase project - New project for securechat
- Implement database schema - Run migrations
- Build auth system - All login routes
- Create admin layout - Sidebar + role-based tabs
- Build first admin pages - Dashboard, Business Info
- Integrate styling system - Simple mode first
- Connect chat interface - Public route with styling
Document Version: 1.0 Created: January 10, 2026 Author: Claude + Bob (Oxford Pierpont)