Skip to main content
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:
  1. Super Admin (me/Oxford Pierpont)
  2. Super Admin Staff
  3. Agency Admin (white label client)
  4. Agency Staff
  5. Business Admin (end user clients) white-label-domain.com/secure-login
  6. Business Admin Staff
  7. Business Customers (end users)
In the Admin interface, you will also need to create a sidebar for the admin tabs so that it can be uncluttered. Different user types will see different tabs. Super Admin tabs might include Dashboard, Agencies (with feature access toggles & settings access), Sub-Accounts, Business Information, Integrations (webhooks, API keys, tokens, licenses, etc.), Branding & Styling, Email Settings, Embed Snippets, Billing, Reporting, Switch Services (Grayed Out), Sign Out Agency Admin tabs might include Dashboard, Clients (with feature access toggles & Settings Access), Business Information, Integrations (webhooks, API keys, tokens, licenses, etc.), Branding & Styling, Email Settings, Embed Snippets, Billing, Reporting, Switch Services (grayed out), Sign Out Business Admin tabs might include Dashboard, Live Sessions, Session History, Leads, Business Information, Integrations (webhooks, API keys, tokens, licenses, etc.), Branding & Styling, Chat Settings, Prompts & Training, Knowledge Base, Email Settings, Embed Snippets, Billing, Reporting, Switch Services (Grayed Out) For each of these tabs, obviously there will be a variety of fields and components, for example, Billing would have things like usage, invoices, payment methods, etc. I think you can handle that part without me, and my main concern is the granular control of the chat interface. Users can choose simple edits where they only need to choose primary and secondary colors, or advanced edits where nearly every component can be changed individually. No layout structural layout changes. Customizations should be broken down by section (Sidebar, Header, Chat Window, Chat Input), and then into components, like backgrounds, buttons, fonts, and finally granular changes like component color, stroke, corner radius, thickness, weight. Last, users should be able to upload logos, custom CSS. All of these settings should be separately customizable for light mode and dark mode. Users can only modify surface level aesthetics, not structural layout changes. They should also be an option to enable/disable emoji icons. Google Fonts also need to be integrated. If a color picker can be integrated, let’s do that. Otherwise, HEX and RGB fields will be fine. Widgets and icons should also be customizable, as well as all headings and labels. Agency admins should be able to access these theming settings for their clients, as many clients may choose to skip this process. The default setting for all interfaces should be black/white/grayscale. It would also be nice to have premade themes for the major colors, like red, green, blue, yellow, etc. Moving on, I want all users to have an Account ID, and this can be used to access the live chat without embedding. So the link would be “domain/chat/Account-ID”. Agencies should also have the option to set agency-level branding, custom domains, add/remove clients, customize billing options, provide API keys to clients Knowledge base content should be editable with red warnings that modifying the prompts can degrade performance. There should also be an option to periodically crawl the business’s website for new pages or content. No user should ever see another user’s chat history on the front end. The Account ID and Session ID should prevent this. User Hierarchy
  • 7 user levels from Super Admin → Customer
  • 2 separate login routes
  • Staff roles inherit parent permissions
Database
  • Full schema with RLS policies
  • Agencies → Businesses → Sessions → Messages chain
  • Knowledge bases stored per business
  • Encrypted API keys
Styling System (Section 6)
  • 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
Admin Sidebar
  • Role-based tab visibility
  • All tabs you specified are mapped
  • “Switch Services” grayed out for future
Route Structure
  • /chat/[account_id] for public access
  • /admin/* for all admin functions
  • Session-based chat (no customer login)
Implementation Phases
  • 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 Agencies

1. 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)

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

  1. Review this spec - Confirm structure and features
  2. Set up Supabase project - New project for securechat
  3. Implement database schema - Run migrations
  4. Build auth system - All login routes
  5. Create admin layout - Sidebar + role-based tabs
  6. Build first admin pages - Dashboard, Business Info
  7. Integrate styling system - Simple mode first
  8. Connect chat interface - Public route with styling

Document Version: 1.0 Created: January 10, 2026 Author: Claude + Bob (Oxford Pierpont)