# Walkthrough - TGBOT Builder Pro & Master Admin Suite

## Overview
We have built and deployed the production **Two-APK Platform Architecture**:
1. **Client APK (`TGBOT-Builder-pro.apk`)**: Dedicated for regular users and creators (`com.tgbotbuilder.app`). Strictly public with **ZERO admin consoles, zero admin navigation, and zero admin buttons**. Includes **Google Sign-In**, Telegram MTProto Session Login, Bot Token guides, Pro modules marketplace, and DPDP/Indian IT Act compliance.
2. **Master Admin APK (`TGBOT-Admin-pro.apk`)**: A standalone master application exclusively for the platform administrator (`com.tgbotbuilder.admin`). Includes **Google Admin Sign-In**, Master Feature Switchboard, Server Infrastructure Controls, Bot fleet management, User tier & quota controls, Global push notifications, and Dynamic Firebase API URL management.

Both APKs strictly adhere to the app's native cyan/purple Material 3 theme and contain **ZERO EMOJIS** across all UI text, cards, buttons, and notifications.

---

## 1. Master Admin Full Control Suite

The Master Admin APK (`TGBOT-Admin-pro.apk`) gives full, total control over every aspect of the platform:

### A. Master Feature Switchboard (Live Real-Time Toggles)
Inside the **Settings** tab, the admin can toggle platform features on or off in real-time. Toggling any feature immediately updates Redis and Firebase Firestore:
- **AI Bot Synthesizer**: Enable or disable AI-powered bot generation.
- **Telegram Session Login**: Enable or disable direct MTProto phone code verification.
- **Telegram Web Widget Auth**: Enable or disable official Telegram web login.
- **Bot Marketplace & Store**: Enable or disable community templates and pre-built bots.
- **Billing & Payment Gateways**: Enable or disable Razorpay, Stripe, and UPI checkout.
- **MCP & Advanced Plugins**: Enable or disable Model Context Protocol tool execution.
- **Broadcast Studio**: Enable or disable global announcements.
- **Public User Registrations**: Open or close new user account signups.
- **Free Tier Access**: Allow or disallow zero-cost bot creation.

### B. Server Infrastructure Controls
One-click administrative actions directly from the phone:
- **Flush Cache**: Clears Redis configuration and platform cache.
- **Restart Workers**: Restarts background Celery / PM2 worker processes.
- **Sync Firestore**: Forcefully syncs all configuration documents to Firebase Firestore.

### C. User Management
- View, search, and filter all platform users.
- Change subscription tiers (Free, Starter, Pro, Enterprise).
- Update status (Active, Suspended, Banned).
- Direct delete / account wipe.

### D. Bot Fleet Control
- View every bot created on the entire server across all users.
- Start, Stop, Restart, and Force-kill any bot.
- Purge rogue bots.

### E. Dynamic Firebase API Endpoint
- View and update the Server API Base URL with 1 tap.
- Writes directly to Firebase Firestore document `config/server`.
- All client apps dynamically fetch and route to the new URL without requiring an APK update.

---

## 2. Google Sign-In Integration

Google Authentication is now fully implemented on both frontend and backend:
- **Client App**: Users can tap **"Continue with Google"** for seamless 1-tap sign-in and account auto-provisioning.
- **Admin App**: Admin can tap **"Sign In with Google Admin"**. Verified Google accounts matching the master admin (`admin@tgbotbuilder.com`) or superusers gain instant Master Admin privileges. Unauthorized Google accounts are strictly rejected with 403 Forbidden.
- **Backend Endpoints**:
  - `POST /api/v1/auth/google`: Verifies Google credentials, auto-registers user, and issues JWT access & refresh tokens.
  - `POST /api/v1/admin/auth/google`: Authenticates master admin via Google account.
- **Firebase Fingerprints Linked**:
  - Debug Keystore SHA-1 (`87:6C:ED:FF:53:64:86:AF:74:6B:96:3C:5B:B9:A4:BF:30:17:8B:CC`) and SHA-256 registered in Firebase project `tgbot-bulder-app`.

---

## 3. Official Production Domain & APK Download Links

Both APKs are compiled, tested, and live for direct download over Cloudflare Edge SSL:

| Application | Package Name (`applicationId`) | File Name | Size | Official HTTPS Download Link |
| :--- | :--- | :--- | :--- | :--- |
| **Client App APK** (Public Users) | `com.tgbotbuilder.app` | `TGBOT-Builder-pro.apk` | 48.9 MB | [Download TGBOT-Builder-pro.apk](https://app.tgbotbuilder.com/TGBOT-Builder-pro.apk) |
| **Master Admin APK** (Aapka Control) | `com.tgbotbuilder.admin` | `TGBOT-Admin-pro.apk` | 48.9 MB | [Download TGBOT-Admin-pro.apk](https://app.tgbotbuilder.com/TGBOT-Admin-pro.apk) |

---

## 4. Master Admin Credentials

- **Admin Email**: `admin@tgbotbuilder.com`
- **Master Password**: `Admin@2026!`
- **Google Sign-In**: Supported via Google account `admin@tgbotbuilder.com`
- **Production API URL**: `https://api.tgbotbuilder.com/api/v1`
- **Firebase Project**: `tgbot-bulder-app` (Firestore location: `asia-south1` Mumbai)

---

## 5. Live Production Verification Results

| Endpoint / Target | Method | Status | Result |
| :--- | :--- | :--- | :--- |
| `https://api.tgbotbuilder.com/api/v1/health` | GET | `HTTP/2 200 OK` | `{"status": "healthy"}` |
| `https://api.tgbotbuilder.com/api/v1/admin/public-config` | GET | `HTTP/2 200 OK` | Dynamic Firestore config returned |
| `https://api.tgbotbuilder.com/api/v1/admin/auth/login` | POST | `HTTP/2 200 OK` | Master Admin JWT issued |
| `https://api.tgbotbuilder.com/api/v1/auth/google` | POST | `HTTP/2 200 OK` | User Google Auth successful |
| `https://api.tgbotbuilder.com/api/v1/admin/auth/google` | POST | `HTTP/2 200 OK` | Admin Google Auth successful |
| `https://api.tgbotbuilder.com/api/v1/admin/config` | GET | `HTTP/2 200 OK` | Master Feature Switchboard active |
| `https://api.tgbotbuilder.com/api/v1/admin/server/action` | POST | `HTTP/2 200 OK` | Server ops (cache/workers/sync) active |
| `https://app.tgbotbuilder.com/TGBOT-Builder-pro.apk` | GET | `HTTP/2 200 OK` | 48.9 MB binary served via Edge SSL |
| `https://app.tgbotbuilder.com/TGBOT-Admin-pro.apk` | GET | `HTTP/2 200 OK` | 48.9 MB binary served via Edge SSL |
