Official documentation v1.1

NovaQR Developer Documentation

Welcome to the official technical specification and deployment guide for NovaQR. Built on modern Android architecture with Kotlin, Jetpack Compose, Gemini AI models, and Supabase cloud infrastructure, NovaQR delivers high-speed artistic QR code generation, real-time scanning, context-aware AI assistance, and instant profile synchronization.

Join the Private PayFopus Community

Connect directly with core developers, request priority white-label features, access pre-release APK builds, and receive instant implementation assistance in our Telegram channel.

Core System Architecture

The application strictly adheres to Clean MVVM Architecture, ensuring complete separation between UI components, business logic, domain models, and external service repositories.

Architecture Layer Technology Stack Technical Functionality
UI Framework Jetpack Compose & Material 3 Declarative reactive UI, seamless dark/light theme switching, and custom canvas rendering.
Language Runtime Kotlin 2.2+ (Coroutines & Flow) Asynchronous non-blocking pipeline with type-safe StateFlow state management.
Backend Services Supabase Kotlin SDK 2.x Real-time PostgreSQL connection, OAuth 2.0 session tokens, and secure Row-Level Security.
AI Subsystem Google Gemini API (3.6 Flash / 3.1 Pro) Context-aware prompt generation, automated troubleshooting, and interactive chat assistance.
QR Processing Engine ZXing Core & Native Compose Canvas Matrix calculation, dot/eye customization, embedded logos, and dynamic vector exporting.

PayFopus Developer Portal & Community

We maintain an active developer portal on Telegram to provide immediate technical support, early beta releases, source code updates, and custom white-label branding inquiries.

Official Developer Telegram

Access official updates, source repositories, and direct chat support through our verified portal:

https://t.me/payfopus

Developer Privileges

24/7 Deployment Assistance

Get direct technical assistance regarding Android Studio build synchronization, Supabase RLS policies, and OAuth keys.

Early Release Access

Download preview APKs, experimental vector QR styling engines, and advanced Gemini prompt templates.

White-Label Request Pipeline

Submit custom branding specs, package name reconfigurations, and enterprise database connector requests.

Security & Policy Advisories

Stay updated on Google Play Store publishing guidelines, OAuth 2.0 policy updates, and Gemini API changes.

Important Notice for Buyers

Third-Party Service Dependencies & Account Configuration

NovaQR is a full-featured, production-ready Android application. To enable real-time user authentication, cloud profile database synchronization, AI assistant queries, and live support chat, the application integrates with external third-party services.

  • Supabase PostgreSQL Database & Auth (Third-party Service): Used for cloud account profiles, saved QR vault, and remote agent configs. You must create a free or paid Supabase account at supabase.com (Third-party Service).
  • Google Cloud Console (Third-party Service): Used for native Google CredentialManager OAuth 2.0 authentication. You must create a Google Cloud project and generate an OAuth Web Client ID and SHA-1 certificate fingerprints at console.cloud.google.com (Third-party Service).
  • Google Gemini AI API (Third-party Service): Used by the NOVA AI Assistant engine. You must retrieve a Google Gemini API Key from aistudio.google.com (Third-party Service).
  • Tawk.to Live Support (Third-party Service): Used for optional in-app real-time live customer support chat widget at tawk.to (Third-party Service).

⚠️ Buyer Responsibility Disclaimer: Buyers are strictly responsible for setting up their own developer accounts, configuring API keys, maintaining quota limits, and managing any third-party subscription or usage fees. The source code does not include pre-configured private production keys.

System & Software Requirements

Before unzipping and building NovaQR, ensure your development computer meets the following software, SDK, and compiler specifications:

Requirement Specification / Version Notes & Compatibility
Android Studio (Third-party Software) Android Studio Ladybug (2024.2.1+) / Jellyfish (2024.1.1+) Required IDE to import, build, and sign the Kotlin project.
Minimum Android SDK API Level 24 (Android 7.0 Nougat) Ensures backward compatibility across 98%+ of global Android devices.
Target Android SDK API Level 36 (Android 16) Fully compliant with latest Google Play Store target API requirements.
Compile Android SDK API Level 36 (Android 16) Compiled with the newest Android 16 framework libraries.
Kotlin Compiler Version Kotlin 2.2.10 (with Compose Compiler plugin) Supports Kotlin Coroutines 1.10.2 & Flow non-blocking reactive pipelines.
Java Development Kit (JDK) JDK 17 LTS (Minimum) / JDK 21 LTS (Recommended) Set as the Gradle JDK in Android Studio Settings.
Gradle Build System Gradle 8.9 / AGP 9.1.1+ (Kotlin DSL) Managed automatically via the included Gradle Wrapper.
Recommended OS Windows 10/11 (64-bit), macOS 14+ (Sonoma/Sequoia), Linux Ubuntu 22.04+ macOS Apple Silicon (M1/M2/M3) or Windows 11 recommended for best emulator speeds.

AI Services & Third-Party Notice

This section provides a clear, mandatory disclosure regarding external Artificial Intelligence APIs integrated into NovaQR.

Third-Party AI Service Integration Disclosure

NovaQR incorporates AI features (NOVA Assistant, smart content recommendations, writing polishing, and contextual QR generation assistance) powered by Google Gemini AI (Third-party Service).

  • Google Gemini API Key Required: AI functionality requires buyers to generate and configure their own Google Gemini API Key from Google AI Studio (Third-party Service).
  • Not Included with Purchase: External AI service usage, API tokens, and subscription quotas are not included with the application purchase price.
  • Potential Usage Costs: Google provides a free development quota for Gemini API, but high-volume commercial production usage may incur separate usage fees billed directly by Google.
  • Buyer Account Management: Buyers are strictly responsible for managing their own Google Cloud / Gemini API accounts, setting up billing details, monitoring usage quotas, and enforcing rate limits.

Beginner-Friendly Installation Guide

Setting up NovaQR does not require Git knowledge or complex terminal commands. Follow these 4 simple steps to open and run the app in Android Studio:

Step 1: Extract Downloaded Package

Unzip the downloaded package file (e.g., NovaQR_App_Full_Source_Code.zip) on your computer. Inside, you will find the main project folder NovaQR.

Step 2: Open Project in Android Studio

  1. Launch Android Studio on your machine.
  2. On the welcome screen, click Open (or go to File > Open).
  3. Browse to the extracted NovaQR project directory and click OK.
  4. Wait 1–2 minutes while Android Studio automatically downloads dependencies and performs Gradle Sync.

Step 3: Create & Configure Your .env Credentials File

  1. In the left-hand Project explorer, locate the file named .env.example in the project root.
  2. Duplicate or rename it to create a new file named .env (with a leading dot).
  3. Paste your own credentials for Supabase, Google Cloud Web Client ID, and Gemini API Key:
SUPABASE_URL=https://your-project-ref.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
GEMINI_API_KEY=your_gemini_api_key
GOOGLE_LOGIN_KEY=your_web_client_id.apps.googleusercontent.com

Step 4: Run the Application

  1. Connect a physical Android phone via USB with USB Debugging enabled, OR start an Android Virtual Device (Emulator).
  2. Click the green Run 'app' button (Play icon) in the top toolbar of Android Studio.
  3. Your app will compile and launch immediately on the device!

Step 5: App Evaluation & Guest Access

For instant evaluation during setup, tap "Continue as Guest" on the welcome screen or register a new test account directly within the application. No pre-configured login credentials required.

Application Assembly & APK Build Guide

Learn how to compile, assemble, and export signed Android binaries (APK and AAB) after making code or asset modifications.

Two Output Formats: APK vs AAB

APK (.apk): Android Package file used for direct device installation, side-loading, website downloads, or beta distribution.
AAB (.aab): Android App Bundle used strictly for uploading and publishing to the official Google Play Console.

1. Assembling a Debug APK (Instant Testing)

To compile a debug binary for local testing without keystore signing setup, run this Gradle command in Android Studio Terminal:

./gradlew assembleDebug

Output File Path: app/build/outputs/apk/debug/app-debug.apk

2. Configuring Release Keystore Signing

Before assembling a production Release APK or Play Store Bundle, configure your release keystore inside app/build.gradle.kts:

android {
    signingConfigs {
        create("release") {
            storeFile = file("your-release-key.jks") // Place your .jks file in project root or app folder
            storePassword = "YOUR_KEYSTORE_PASSWORD"
            keyAlias = "YOUR_KEY_ALIAS"
            keyPassword = "YOUR_KEY_PASSWORD"
        }
    }
    buildTypes {
        getByName("release") {
            isMinifyEnabled = true
            isShrinkResources = true
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
            signingConfig = signingConfigs.getByName("release")
        }
    }
}

3. Assembling a Production Release APK

To compile the optimized, production-ready Release APK file, execute:

./gradlew assembleRelease

Output File Path: app/build/outputs/apk/release/app-release.apk

4. Assembling an Android App Bundle (.aab) for Google Play

To generate the official App Bundle binary required by Google Play Console:

./gradlew bundleRelease

Output File Path: app/build/outputs/bundle/release/app-release.aab

5. Obtaining the Ready APK via Android Studio GUI (No Terminal Required)

If you prefer using the Android Studio graphic interface instead of terminal commands:

  1. In the top menu bar, click Build > Build APK(s) / Bundle(s) > Build APK(s).
  2. Wait for Android Studio to finish compiling (a pop-up notification will appear at the bottom right).
  3. Click the blue locate link inside the notification pop-up.
  4. Android Studio will automatically open your operating system file manager directly to the folder containing your compiled, ready app-debug.apk or app-release.apk!

Visual Application & User Interaction Flow

Below is a visual flow diagram mapping how users interact with NovaQR from launch to cloud synchronization:

1
Splash & Launch

App Initialization & Credentials Load

→
2
Google / Guest Auth

CredentialManager Sign-In

→
3
Home Dashboard

Quick Scanner & Generator Cards

→
4
QR Studio & AI

Custom QR Styling & Gemini Chat

→
5
Cloud Vault & Export

Supabase Database & SVG/PNG

Application Screens & Feature Walkthrough

NovaQR delivers a cohesive, Material 3 design experience across all primary user touchpoints:

Home Dashboard

1. Home Dashboard

Screen 01

Presents user status, daily scan/generation counters, quick launch shortcuts to Scanner and Generator, and system notification alerts fetched dynamically from Supabase.

Artistic QR Studio

2. Artistic QR Studio

Screen 02

The main QR generation engine. Supports custom dot matrix styles (square, rounded, dots), eye frame designs, linear gradients, center logo image embedding, and instant SVG/PNG exports.

Real-Time Camera Scanner

3. Real-Time Camera Scanner

Screen 03

High-speed ZXing camera scanner with flash toggle, touch auto-focus, image picking from photo gallery, instant URL previewing, and action buttons (Copy, Open URL, Save).

NOVA AI Assistant

4. NOVA AI Assistant

Screen 04

Powered by Gemini 3.6 Flash model. Provides real-time streaming conversational assistant for QR optimization tips, Wi-Fi configuration formatting, vCard help, and context-aware guidance.

Saved History & Cloud Vault

5. Saved History & Cloud Vault

Screen 05

Displays all generated and scanned QR codes. Features offline caching, favorite bookmarks, category filtering, and automatic Supabase cloud profile synchronization across devices.

User Profile & Settings

6. Settings & Live Support

Screen 06

Includes user profile settings, Dark/Light theme switching, legal compliance policies (GDPR/CCPA), and an embedded live Tawk.to chat widget for instant customer help.

Pro Membership & Plan Upgrades

7. Pro Membership & Upgrades

Screen 07

Presents subscription options, feature comparison tables, instant plan upgrading via Supabase profile status, and unlimited QR code generation access.

Business Card Studio Showcase

8. Business Card Studio Showcase

Screen 08

Interactive digital business card creator featuring 7 executive templates, multi-side card preview tabs, embedded vCard QR codes, and 300 DPI lossless PNG export.

Digital Business Card Builder

9. Digital Business Card Builder

Screen 09

Comprehensive card builder customization suite allowing real-time contact detail editing, transparent company logo uploads, custom background image opacity sliders, and tier gating.

Advanced QR & Geo Studio

10. Advanced QR & Geo Studio

Screen 10

Full suite of 12 specialized QR code generators including Geo location GPS mapping, Wi-Fi credentials, vCard contact cards, Barcode formats, and artistic customization options.

Package & Identity Configuration

NovaQR is pre-configured with the standard production namespace com.example.novaqr. Follow these instructions to modify application identifiers for custom releases.

1. Application Identifier & SDK Versioning

The application package namespace and SDK target configurations are managed in app/build.gradle.kts:

android {
    namespace = "com.example.novaqr"
    compileSdk = 36

    defaultConfig {
        applicationId = "com.example.novaqr"
        minSdk = 24
        targetSdk = 36
        versionCode = 1
        versionName = "1.0.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary = true
        }
    }
}

2. App Display Name & Resource Strings

The primary application launcher label displayed on the Android system home screen is defined in app/src/main/res/values/strings.xml:

<resources>
    <string name="app_name">NovaQR</string>
    <string name="app_description">Intelligent QR Generator & AI Scanner</string>
</resources>

Google Authentication Specification

NovaQR implements modern dual-layer Google Authentication architecture on Android. The system attempts primary authentication via native on-device Google CredentialManager, falling back smoothly to Browser OAuth 2.0 with custom deep links when required.

1. Authentication Architecture

Native CredentialManager (Primary)

Invokes Android's native bottom-sheet account picker. Retrieves a cryptographically signed Google ID Token directly within the app and passes it to Supabase Auth without opening external browser windows.

Browser OAuth 2.0 (Fallback)

If CredentialManager is unsupported on older Play Services versions, the app opens Chrome Custom Tabs to complete OAuth authorization, returning via deep link com.example.novaqr://callback.

2. Google Cloud Console Provisioning

To enable Google Authentication for your build, set up your OAuth parameters in Google Cloud Console:

  1. Log into Google Cloud Console and create or select your project.
  2. Navigate to APIs & Services > OAuth consent screen.
  3. Set User Type to External and fill in required app contact details.
  4. Configure mandatory authorization scopes:
    • openid
    • https://www.googleapis.com/auth/userinfo.email
    • https://www.googleapis.com/auth/userinfo.profile
  5. Publish your consent screen status to In Production or register developer emails under Test Users.
  6. Navigate to Credentials > Create Credentials > OAuth client ID.
  7. Select Web application (This Web Client ID will be used as GOOGLE_LOGIN_KEY in Supabase and .env).

3. Generating Required SHA Fingerprints

Google CredentialManager requires linking your Android app's signing certificate fingerprints (SHA-1 and SHA-256) to an Android Client ID entry in Google Cloud Console.

Generating Debug SHA Fingerprints via Terminal:

# Linux / macOS
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

# Windows
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

# Alternatively via Gradle inside project:
./gradlew signingReport

Copy both SHA-1 and SHA-256 keys and paste them into your Android Client ID configuration in Google Cloud Console under matching package name com.example.novaqr.

4. Redirect URI Whitelisting in Supabase

To accept deep link redirects from Browser OAuth, register your custom schemes in Supabase Dashboard > Authentication > URL Configuration > Redirect URLs:

com.example.novaqr://callback
novaqr://callback

5. Environment Variables Configuration

Add your Web Client ID and Redirect scheme to your project .env file:

GOOGLE_LOGIN_KEY=YOUR_GOOGLE_WEB_CLIENT_ID.apps.googleusercontent.com
GOOGLE_CUSTOM_REDIRECT_URL=com.example.novaqr://callback

Environment Variables (.env & .env.example)

NovaQR utilizes strict secret isolation. All API credentials, database keys, and configuration parameters are loaded dynamically at compile time through the Secrets Gradle Plugin into BuildConfig constants.

Active Environment File (.env)

########################################
# Application Settings
########################################
APP_NAME=NovaQR
PACKAGE_NAME=com.example.novaqr

########################################
# Gemini AI Configuration
########################################
GEMINI_API_KEY=YOUR_GEMINI_API_KEY
GEMINI_MODEL=gemini-3.6-flash
GEMINI_FALLBACK_MODEL=gemini-3.1-pro
GEMINI_SYSTEM_PROMPT=You are NOVA, an intelligent assistant for NovaQR.

########################################
# Supabase Database & Auth
########################################
SUPABASE_URL=YOUR_SUPABASE_URL
SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY

########################################
# External Database (Optional)
########################################
# EXTERNAL_DATABASE_URL=postgresql://user:password@localhost:5432/novaqr_db

########################################
# Google Authentication
########################################
GOOGLE_LOGIN_KEY=YOUR_GOOGLE_WEB_CLIENT_ID.apps.googleusercontent.com
GOOGLE_CUSTOM_REDIRECT_URL=com.example.novaqr://callback

########################################
# Tawk.to Live Support
########################################
TAWK_PROPERTY_ID=YOUR_TAWK_PROPERTY_ID
TAWK_WIDGET_ID=YOUR_TAWK_WIDGET_ID

########################################
# OpenRouter AI (Fallback Provider)
########################################
OPENROUTER_API_KEY=YOUR_OPENROUTER_API_KEY
OPENROUTER_MODEL=YOUR_OPENROUTER_MODEL

Template Master File (.env.example)

The repository includes .env.example containing clean template placeholders. Never commit populated .env files to version control repositories.

Supabase Database & Security Policies

NovaQR relies on Supabase PostgreSQL for persistent user storage, saved QR code history, dynamic remote agent configuration, user plan management, and in-app system alerts.

Critical Security Alert: Resolving Table Publicly Accessible (rls_disabled_in_public)

If you receive an email or notification from Supabase warning about "Table publicly accessible (rls_disabled_in_public)", do not panic! This occurs when new tables are created without enabling Row-Level Security (RLS).

Resolution Steps: Copy and run the complete SQL script below inside your Supabase Dashboard > SQL Editor. This enables RLS across all tables and restricts access so users can only read/write their own records.

1. Complete Database Schema Setup & RLS Policies

Execute this complete SQL initialization script in Supabase Dashboard > SQL Editor to automatically construct all 7 required tables, indexes, triggers, and Row-Level Security (RLS) policies:

-- 1. Create User Profiles Table (with plan expiry & trial metadata)
CREATE TABLE IF NOT EXISTS public.profiles (
  id uuid REFERENCES auth.users ON DELETE CASCADE PRIMARY KEY,
  email text,
  full_name text,
  plan text DEFAULT 'free', -- Options: 'free', 'pro', 'enterprise'
  plan_expires_at timestamp with time zone,
  is_trial boolean DEFAULT false,
  avatar_base64 text,
  created_at timestamp with time zone DEFAULT timezone('utc'::text, now())
);

ALTER TABLE public.profiles ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can view own profile" ON public.profiles FOR SELECT USING (auth.uid() = id);
CREATE POLICY "Users can insert own profile" ON public.profiles FOR INSERT WITH CHECK (auth.uid() = id);
CREATE POLICY "Users can update own profile" ON public.profiles FOR UPDATE USING (auth.uid() = id);

-- 2. Automatic User Profile Creation & Default Plan Trigger
CREATE OR REPLACE FUNCTION public.handle_new_user()
RETURNS trigger AS $$
BEGIN
  INSERT INTO public.profiles (id, email, full_name, plan, plan_expires_at, is_trial)
  VALUES (
    new.id,
    new.email,
    COALESCE(new.raw_user_meta_data->>'full_name', split_part(new.email, '@', 1)),
    'free', -- Set to 'pro' if you want a 100% free app for all users
    NULL,   -- e.g. NOW() + INTERVAL '30 days' for an automatic $0 30-day Pro trial
    false
  )
  ON CONFLICT (id) DO NOTHING;
  RETURN new;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

DROP TRIGGER IF EXISTS on_auth_user_created ON auth.users;
CREATE TRIGGER on_auth_user_created
  AFTER INSERT ON auth.users
  FOR EACH ROW EXECUTE FUNCTION public.handle_new_user();

-- 3. Saved QR Code Vault Table
CREATE TABLE IF NOT EXISTS public.saved_qrs (
  id SERIAL PRIMARY KEY,
  title text NOT NULL,
  content text NOT NULL,
  type_name text NOT NULL,
  timestamp bigint NOT NULL,
  is_favorite boolean NOT NULL DEFAULT false,
  style_json text NOT NULL,
  user_id uuid REFERENCES auth.users NOT NULL DEFAULT auth.uid()
);

ALTER TABLE public.saved_qrs ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users can view own qrs" ON public.saved_qrs FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Users can insert own qrs" ON public.saved_qrs FOR INSERT WITH CHECK (auth.uid() = user_id);
CREATE POLICY "Users can update own qrs" ON public.saved_qrs FOR UPDATE USING (auth.uid() = user_id);
CREATE POLICY "Users can delete own qrs" ON public.saved_qrs FOR DELETE USING (auth.uid() = user_id);

-- 4. Broadcast System Notifications Table (Global App Alerts)
CREATE TABLE IF NOT EXISTS public.app_notifications (
  id SERIAL PRIMARY KEY,
  title text NOT NULL,
  message text NOT NULL,
  type text DEFAULT 'info', -- 'info', 'promo', 'update', 'alert'
  action_url text,
  is_active boolean DEFAULT true,
  created_at timestamp with time zone DEFAULT timezone('utc'::text, now()),
  expires_at timestamp with time zone
);

ALTER TABLE public.app_notifications ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Anyone can view notifications" ON public.app_notifications FOR SELECT USING (true);

-- 5. Targeted Customer Notifications Table (Specific User Messages)
CREATE TABLE IF NOT EXISTS public.user_notifications (
  id SERIAL PRIMARY KEY,
  user_id uuid REFERENCES auth.users ON DELETE CASCADE NOT NULL,
  title text NOT NULL,
  message text NOT NULL,
  type text DEFAULT 'system', -- 'system', 'billing', 'reward', 'alert'
  action_url text,
  is_read boolean DEFAULT false,
  created_at timestamp with time zone DEFAULT timezone('utc'::text, now())
);

ALTER TABLE public.user_notifications ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users view own notifications" ON public.user_notifications FOR SELECT USING (auth.uid() = user_id);
CREATE POLICY "Users update own notifications" ON public.user_notifications FOR UPDATE USING (auth.uid() = user_id);

-- 6. Remote App Settings & Feature Flags Table
CREATE TABLE IF NOT EXISTS public.app_settings (
  id SERIAL PRIMARY KEY,
  enable_paid_plans boolean DEFAULT true,
  enable_ads boolean DEFAULT false,
  admob_banner_id text,
  free_qr_limit int DEFAULT 5,
  default_signup_plan text DEFAULT 'free',
  updated_at timestamp with time zone DEFAULT timezone('utc'::text, now())
);

ALTER TABLE public.app_settings ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Anyone view app settings" ON public.app_settings FOR SELECT USING (true);

INSERT INTO public.app_settings (enable_paid_plans, enable_ads, free_qr_limit, default_signup_plan)
VALUES (true, false, 5, 'free')
ON CONFLICT DO NOTHING;

-- 7. AI Agent Remote Configuration Table
CREATE TABLE IF NOT EXISTS public.agent_config (
  id SERIAL PRIMARY KEY,
  system_prompt text,
  model_name text DEFAULT 'gemini-1.5-flash',
  is_enabled boolean DEFAULT true
);

ALTER TABLE public.agent_config ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Anyone view agent config" ON public.agent_config FOR SELECT USING (true);

-- 8. Plan Subscriptions & Upgrade Audit Table
CREATE TABLE IF NOT EXISTS public.plan_subscriptions (
  id SERIAL PRIMARY KEY,
  user_id uuid REFERENCES auth.users ON DELETE CASCADE NOT NULL,
  plan_name text NOT NULL,
  amount_paid numeric(10,2) DEFAULT 0.00,
  payment_method text DEFAULT 'manual_admin',
  started_at timestamp with time zone DEFAULT timezone('utc'::text, now()),
  expires_at timestamp with time zone
);

ALTER TABLE public.plan_subscriptions ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Users view own subscriptions" ON public.plan_subscriptions FOR SELECT USING (auth.uid() = user_id);

-- 9. Remote Plan Catalog & Pricing Table (Dynamic Prices & Descriptions)
CREATE TABLE IF NOT EXISTS public.plan_catalog (
  plan_id text PRIMARY KEY, -- 'free', 'pro', 'enterprise'
  title text NOT NULL,
  description text,
  price_monthly numeric(10,2) DEFAULT 0.00,
  price_yearly numeric(10,2) DEFAULT 0.00,
  currency_symbol text DEFAULT '$',
  badge_text text,
  features text[], -- Array of feature string bullet points
  is_active boolean DEFAULT true,
  updated_at timestamp with time zone DEFAULT timezone('utc'::text, now())
);

ALTER TABLE public.plan_catalog ENABLE ROW LEVEL SECURITY;
CREATE POLICY "Anyone view plan catalog" ON public.plan_catalog FOR SELECT USING (true);

INSERT INTO public.plan_catalog (plan_id, title, description, price_monthly, price_yearly, currency_symbol, badge_text, features)
VALUES 
  ('free', 'Free Starter', 'Basic QR generation for everyday personal use', 0.00, 0.00, '$', 'Basic', ARRAY['PNG Export', 'Standard QR Types', 'Scan Barcodes & QRs']),
  ('pro', 'Pro Studio', 'Professional QR studio with AI & vector exports', 4.99, 39.99, '$', 'POPULAR', ARRAY['SVG & PDF Vector Export', 'Logo Embedding', 'Unlimited AI Prompts', 'Ad-Free Experience', 'Priority Support'])
ON CONFLICT (plan_id) DO UPDATE SET 
  title = EXCLUDED.title,
  price_monthly = EXCLUDED.price_monthly,
  price_yearly = EXCLUDED.price_yearly,
  features = EXCLUDED.features;

2. User Account Management Guide

Supabase provides built-in user administration tools through both the web dashboard and SQL commands:

  • Viewing Registered Users: Navigate to Supabase Dashboard > Authentication > Users to search, filter, or view all signed-up accounts.
  • Banning or Disabling Accounts: In the Users list, click the ... menu next to a user and select Ban User or Disable User to temporarily or permanently revoke login access.
  • Deleting Accounts & Data (GDPR Compliance): Selecting Delete User removes the user record from auth.users. Because of the ON DELETE CASCADE rule, their corresponding profiles record and saved_qrs entries are automatically wiped clean.

3. Upgrading & Managing User Plans in Supabase

User access tiers ('free', 'pro', 'enterprise') dictate feature gates and generation limits inside NovaQR:

-- Manual Plan Upgrade via Supabase SQL Editor:
UPDATE public.profiles 
SET plan = 'pro' 
WHERE email = 'user@example.com';

-- Bulk Upgrade for Beta Testers:
UPDATE public.profiles 
SET plan = 'pro' 
WHERE email LIKE '%@demo.com';

Automated Payment Webhooks (Stripe / RevenueCat / Play Billing): When integrating in-app purchases or subscription webhooks, send a secure server-side POST request to your Supabase Database or Edge Function to update the user's plan attribute automatically upon successful payment.

Monetization, Revenue Model & Subscription Plans Guide

Understand how NovaQR generates revenue from source code execution, how to modify subscription plan pricing and feature lists, and how to configure Google Play In-App Purchases or external payment gateways.

How App Owners Collect Revenue from Source Code

NovaQR is engineered as a commercial micro-SaaS application. All subscription revenue generated when end-users upgrade to the Pro Studio plan flows directly into your bank account or payment processor. No revenue shares or commission cuts are taken by the source code!

1. Revenue Generation Channels

A. Google Play Billing (Subscriptions)

End users pay via Google Play payment methods (Credit Card, Play Balance, PayPal). Google processes payouts directly into your linked developer bank account (85%–90% net revenue to app owner).

B. Direct Web Payment Gateway (PayPal / Stripe)

When users tap Upgrade to Pro in PlansScreen.kt, the app launches your custom PayPal or Stripe checkout link. Upon payment completion, a web webhook automatically activates the Pro license in Supabase.

C. B2B Enterprise & Manual Admin Licenses

Sell bulk corporate licenses or VIP access to clients offline, then activate their account instantly via Supabase SQL Console by setting plan = 'pro'.

2. Modifying Plan Prices, Descriptions & Features

NovaQR supports dual configuration: live remote database cataloging and fast local source code fallbacks.

Method A: Modifying Live Prices via Supabase SQL Editor (Recommended)

To change plan pricing (e.g., setting Pro to $9.99/mo or $49.99/yr) without republishing the APK, execute this query in Supabase Dashboard > SQL Editor:

-- Update Pro Plan Prices and Feature List in Supabase:
UPDATE public.plan_catalog
SET price_monthly = 9.99,
    price_yearly = 49.99,
    currency_symbol = '$',
    description = 'Unlimited AI QR studio with vector PDF/SVG exports',
    features = ARRAY[
        'All Advanced QR Types (WiFi, Crypto, Social)',
        'Custom Colors, Gradients & Embedded Logo',
        'Unlimited Daily Generations',
        'High-Resolution Vector Export (PDF & SVG)',
        'NOVA Gemini 3.6 Flash AI Assistant',
        'Cloud Vault Sync across Devices'
    ]
WHERE plan_id = 'pro';

Method B: Modifying Fallback Prices in Source Code

If the user is offline, the app reads fallback values defined inside app/src/main/java/com/example/ui/screens/PlansScreen.kt:

// Located inside PlansScreen.kt:
val proPriceFormatted = proPlan?.getFormattedPrice() ?: "$9.99"
val proFeatures = proPlan?.getFeaturesList()?.takeIf { it.isNotEmpty() } ?: listOf(
    TranslationHelper.t("All Advanced QR Types (WiFi, Crypto, Social)"),
    TranslationHelper.t("Custom Colors, Gradients & Logos"),
    TranslationHelper.t("Unlimited Generations"),
    TranslationHelper.t("Cloud Sync with Supabase"),
    TranslationHelper.t("Premium High-res Exports (PDF, SVG)")
)

3. Feature Locking & Privilege Enforcement Matrix

Feature / Capability Free Starter Tier Pro Studio Tier Code Enforcement Location
Daily QR Generation Quota 5 Basic Generations / Day Unlimited Generations UsageLogDao.kt & QrStudioScreen.kt
QR Content Types Text & Standard URL WiFi, VCard, Crypto, Phone, Email, Social QrContentInput.kt
Custom Styling & Logo Monochrome Black & White Custom Colors, Gradients, Eye Shapes & Logo Embedding QrStudioScreen.kt
Export Resolution & Formats Standard PNG (1x) High-Res PNG (4x), Vector SVG & Print-Ready PDF QrStudioScreen.kt
NOVA AI Assistant Chat 3 Prompts / Day Unlimited Gemini AI Queries & Prompt Enhancements AIChatScreen.kt & GeminiApiClient.kt
Cloud Vault Storage Local Device Room DB Automatic Multi-Device Supabase Cloud Sync SupabaseClient.kt

4. Step-by-Step Google Play In-App Purchase Integration

To accept automated Google Play Subscriptions directly inside your published app:

  1. Ensure com.android.billingclient:billing-ktx is included in app/build.gradle.kts dependencies.
  2. Open Google Play Console > Monetize > Products > Subscriptions and create a subscription product with ID novaqr_pro_monthly.
  3. Inside PlansScreen.kt, replace the payment dialog handler with the standard Play Billing launcher:
    val billingClient = BillingClient.newBuilder(context)
        .setListener(purchasesUpdatedListener)
        .enablePendingPurchases()
        .build()
    
    val flowParams = BillingFlowParams.newBuilder()
        .setProductDetailsParamsList(productDetailsParamsList)
        .build()
    
    billingClient.launchBillingFlow(activity, flowParams)
  4. Upon successful purchase verification callback, call SupabaseClient.db.updateProfile("eq.$userId", mapOf("plan" to "pro")) to unlock Pro features instantly!

5. Comprehensive Application Settings Guide

NovaQR exposes a full suite of user controls, developer options, and system settings across UI menus and environment constants:

Setting Category Available Settings & Controls Configuration / File Location
Theme & Styling 8 Dynamic Color Schemes (Cyan, Purple, Emerald, Sunset, Crimson, Gold, Cyberpunk, Midnight) + Dark/Light Mode. Settings > Theme Options (ThemeState.kt)
Language & Localization 7 Languages (English, Arabic, French, German, Korean, Turkish, Chinese) + Automatic Right-to-Left (RTL) layout switching. Settings > Language (TranslationHelper.kt & res/values-*/)
Camera & Scanner Haptic vibration feedback on scan, Auto-open scanned URLs toggle, Flashlight toggle state, Camera permission prompt. Settings > Scanner Options (ScannerScreen.kt)
NOVA AI Assistant System prompt customization, Gemini Model selection (gemini-3.6-flash / gemini-3.1-pro), OpenRouter fallback key. Settings > AI Agent Config (.env & GeminiApiClient.kt)
Export & Rendering PNG scale resolution multiplier (1x to 4x), Vector SVG format toggle, Transparent canvas background toggle. QR Studio > Export Dialog (QrStudioScreen.kt)
Auth & Cloud Account Google CredentialManager OAuth, Email/Password login, Password recovery, Guest mode fallback, Account logout. Auth & Profile Screens (AuthScreens.kt & SupabaseClient.kt)
Support & Live Chat Tawk.to live customer support widget property ID (TAWK_PROPERTY_ID), Direct email intent, Telegram portal link. Settings > Help & Support (SettingsScreens.kt)

External Database Integration

If your enterprise deployment requires self-hosted PostgreSQL, AWS RDS, GCP Cloud SQL, or custom REST APIs, NovaQR supports flexible database architecture adapters.

Option 1: Connecting External Postgres to Supabase

Supabase allows wrapping existing external PostgreSQL instances using Foreign Data Wrappers (FDW) or pgBouncer connection pooling under Database Settings > Connection Strings.

Option 2: Self-Hosting Supabase Stack

Deploy a self-hosted Supabase engine using Docker Compose on any cloud server:

cd supabase/docker
cp .env.example .env
docker compose up -d

Update your client .env file to point directly to your custom server endpoint:

SUPABASE_URL=YOUR_CUSTOM_SUPABASE_HOST
SUPABASE_ANON_KEY=YOUR_CUSTOM_ANON_KEY

Comprehensive Branding & Identity Customization Guide

Customize the visual identity, launcher icons, package identifiers, logos, color palettes, subscription plans, pricing options, and third-party credentials.

1. Changing App Display Name & Application ID

To rename the application and re-package it under your unique domain identifier:

  • App Launcher Name: Open app/src/main/res/values/strings.xml and update <string name="app_name">Your Brand Name</string>. Also update the name field in metadata.json at project root to keep Android Studio project name in sync.
  • Application ID / Package ID: Open app/build.gradle.kts and update defaultConfig { applicationId = "com.yourdomain.brandapp" }.

2. Changing App Logo & Home Launcher Icon (Adaptive Icons)

NovaQR implements modern Android Adaptive Icons (ic_launcher.xml and ic_launcher_round.xml) supporting vector foreground layers, custom background colors, and dynamic launcher masking across all Android versions.

Method A: Using Android Studio Asset Studio (Recommended)

  1. In Android Studio left sidebar, right-click the app directory folder.
  2. Select New > Image Asset to launch Android Asset Studio.
  3. Select Icon Type: Launcher Icons (Adaptive and Legacy).
  4. Under Foreground Layer tab: Set Asset Type to Image and choose your high-resolution PNG or SVG logo (512x512px recommended). Adjust resize slider to center your logo.
  5. Under Background Layer tab: Choose a solid background color (e.g., dark canvas #050711) or image background.
  6. Click Next, verify target paths, and click Finish. Android Studio automatically generates adaptive vector assets across all density buckets (mipmap-hdpi, mipmap-xhdpi, mipmap-xxhdpi, mipmap-xxxhdpi, mipmap-anydpi-v26).

Method B: Direct Resource File Replacement

  • Foreground Asset: Replace app/src/main/res/drawable/ic_launcher_foreground.xml with your own brand vector XML asset.
  • Background Color: Edit app/src/main/res/values/colors.xml or ic_launcher_background.xml to set your background hex color.

3. Customizing Splash Screen Logo

Replace the vector splash logo located at app/src/main/res/drawable/ic_splash_logo.xml with your custom brand logo. The Android splash screen automatically scales this asset smoothly during app launch.

4. Modifying Credentials & API Keys

All third-party credentials and server endpoints are isolated inside environment keys. Update your .env file or Android Studio project configuration:

Environment Key Purpose / Description Source Location
SUPABASE_URL Supabase project HTTPS endpoint URL Supabase Dashboard > Settings > API
SUPABASE_ANON_KEY Public anonymous client API key Supabase Dashboard > Settings > API
GEMINI_API_KEY Google Gemini AI Assistant Key Google AI Studio (aistudio.google.com)
GOOGLE_WEB_CLIENT_ID Google OAuth 2.0 Web Client ID Google Cloud Console > Credentials
TAWK_PROPERTY_ID Live Support Chat Property ID Tawk.to Dashboard > Direct Chat Link
TAWK_WIDGET_ID Live Support Chat Widget ID Tawk.to Dashboard > Widget Settings

Customizable Themes & Style Customization Guide

NovaQR features an advanced, built-in dynamic theme engine in Jetpack Compose, supporting 8 distinctive color schemes and real-time theme switching.

Modular Theme Architecture

All color schemes are centrally declared inside app/src/main/java/com/example/ui/theme/Theme.kt using Material 3 darkColorScheme. Theme selection is managed reactively through ThemeState.kt, enabling instant app-wide visual updates without restarting the application!

1. The 8 Built-In Color Schemes Matrix

Theme Identifier Primary Accent Color Secondary Accent Background Canvas Visual Personality
cyan (Default) #00F0FF (Vivid Cyan) #B062FF (Electric Violet) #050711 (Midnight Dark) Futuristic Cyberpunk & Sleek Android Studio
purple #D08BFF (Vivid Purple) #00F0FF (Cyan Glow) #0A0514 (Deep Purple Dark) Creative, Regal & Modern Digital
emerald #10B981 (Emerald Green) #0EA5E9 (Sky Blue) #020906 (Deep Forest) Eco, Financial & Fresh Organic
sunset #FF5A36 (Solar Orange) #FFB300 (Warm Amber) #140707 (Warm Twilight) Energetic, Warm & High Impact
crimson #FF1A40 (Crimson Red) #FF4D6D (Neon Rose) #0F0406 (Ruby Dark) Bold, Passionate & Gaming Aesthetic
gold #FFD700 (Luxury Gold) #E5E4E2 (Platinum) #0A0A0A (Rich Obsidian) Premium Luxury & Enterprise VIP
cyberpunk #FAED27 (Cyber Yellow) #FF003C (Neon Pink) #050510 (Synthwave Black) High-Contrast Retro-Futurism
midnight #4A90E2 (Deep Ocean) #81E6D9 (Teal Wave) #030A14 (Navy Night) Professional, Calm & Corporate

2. How Users Switch Themes in the App

Users can select their favorite color scheme anytime by navigating to Settings > Theme Options inside the app. Tapping any color circle instantly updates ThemeState.currentTheme.value and persists the user preference in local storage.

3. Modifying Color Schemes & Creating New Custom Themes

To customize an existing theme or add a brand-new theme, edit app/src/main/java/com/example/ui/theme/Theme.kt:

// Example: Adding a custom "Ocean Mint" color scheme in Theme.kt:
val OceanMintColorScheme = darkColorScheme(
    primary = Color(0xFF00E676),        // Mint Green Accent
    onPrimary = Color(0xFF003818),
    primaryContainer = Color(0xFF005B29),
    onPrimaryContainer = Color(0xFFB9F6CA),
    secondary = Color(0xFF00B0FF),      // Ocean Blue Accent
    background = Color(0xFF03100B),     // Dark Deep Mint Canvas
    surface = Color(0xFF03100B),
    surfaceVariant = Color(0xFF082117)
)

// Register your custom scheme inside NovaQRTheme composable in Theme.kt:
@Composable
fun NovaQRTheme(
    themeName: String = "cyan",
    content: @Composable () -> Unit
) {
    val colorScheme = when(themeName.lowercase()) {
        "mint" -> OceanMintColorScheme  // New theme case!
        "purple" -> PurpleColorScheme
        "emerald" -> EmeraldColorScheme
        "sunset" -> SunsetColorScheme
        "crimson" -> CrimsonColorScheme
        "gold" -> LuxuryGoldColorScheme
        "cyberpunk" -> CyberpunkColorScheme
        "midnight" -> MidnightColorScheme
        else -> CyanColorScheme
    }

    MaterialTheme(
        colorScheme = colorScheme,
        typography = Typography,
        content = content
    )
}

Business Card Builder Setup & Feature Guide

NovaQR includes an interactive, production-grade Business Card Builder built in Jetpack Compose, allowing users to create, customize, preview, and export high-resolution digital and printable business cards with embedded vCard QR codes.

Unified Reactive Architecture (TemplateStyle)

The Business Card Studio relies on a reactive state model powered by TemplateStyle and the rememberTemplateStyle(card) state producer. All card elements—including background brushes, corner radii, borders, drop shadow spot colors, font families, contrast colors, and embedded QR code frame styling—update instantly and synchronously as the user edits any field or toggles styling parameters.

1. Core Features & Customization Parameters

Customization Module Configurable Properties Implementation Detail & Behavior
Card Templates Modern Minimal, Sleek Mint, Executive Glass, Luxury Gold, Tech Dark, Creative Gradient, Standard Default Template IDs (card.templateId) trigger distinct TemplateStyle presets with customized frame borders, corner radii, backdrop brushes, and QR container styling.
Color Palette & Contrast Primary Color, Accent Color, Background Color, Gradient End Color, Text Color Hex color pickers with automatic contrast legibility protection (via rememberLegibleColors and luminance checks for dark vs light backgrounds).
Background Gradient Enable/Disable Toggle, Dual Hex Colors Linear gradient interpolation between Background Color and Gradient End Color. Managed via polished Material 3 Switch with distinct checkedThumbColor and checkedTrackColor contrast.
Typography Styling Default, Serif, Sans-Serif (Modern), Monospace Font family selector applies dynamically across card full name, job title, company name, contact labels, and exported PNG canvas rendering.
Company Logo & Branding Upload Image Logo vs Write Name Instead Dual-mode branding with FilterChip selector. Uploaded logos render directly on card surfaces with 100% transparent backgrounds (no solid white box artifact). Includes Change Logo, Remove Logo, and text-based Company Name fallback.
Custom Media Overlays Gallery Background Image, Opacity Slider, Avatar Photo Custom gallery photo overlay with real-time opacity adjustment (0.1f to 1.0f) and automated legibility backdrop gradient overlay. Avatar photo picker with initial fallback badge.
Interactive Card Preview Front Side, Back Side (QR Code), Digital Contact Info, Full Card View Real-time multi-side tab preview with smooth animated transitions (AnimatedContent) and live vCard QR bitmap rendering.
Lossless PNG Card Export High-DPI Canvas Rasterization Custom Android Canvas draw pipeline duplicating Compose visual hierarchy for high-resolution 300 DPI printable card export.

2. Free vs. Pro Tier Capability Matrix

The Business Card Builder features built-in plan gating controlled by profile.isPro or global configuration in AppConfig.kt:

Business Card Builder Capability Free Tier Users Pro / Premium Users Configuration & Paywall Behavior
Standard Card Templates Unlocked (Modern Minimal, Standard Default) Unlocked (All Templates) Free users can build and edit standard cards without restrictions.
Premium Executive Templates Locked (Paywall Preview) Full Unlimited Access Templates like Executive Glass, Luxury Gold, Sleek Mint, Tech Dark, Creative Gradient display a Pro badge and trigger upgrade prompt for Free users.
Company Logo Upload & Text Branding Text Name Branding Included / Standard Logo Full Transparent Logo Upload Free users can enter company names or upload logos; Pro users unlock unwatermarked, high-resolution logo uploads.
Custom Background Image Overlay & Opacity Restricted / Preview Only Unlimited Gallery Overlays Gated in BusinessCardBuilderScreen.kt check for profile.isPro.
High-DPI Lossless Card PNG Export Standard PNG Export Ultra High-Res Lossless Output Pro users export ultra high-DPI cards with crisp vector QR graphics for printing.

3. Business Card Data Model & Code Configuration

To inspect or tweak card structure and template styling rules in source code:

// Location: app/src/main/java/com/example/ui/screens/BusinessCardBuilderScreen.kt

// 1. Template Style Definition & Parameter Customization:
data class TemplateStyle(
    val cornerRadius: Dp,
    val borderWidth: Dp,
    val borderBrush: Brush,
    val shadowElevation: Dp,
    val shadowSpotColor: Color,
    val qrBgColor: Color,
    val qrBorderBrush: Brush,
    val qrCornerRadius: Dp,
    val textColor: Color,
    val primaryColor: Color,
    val accentColor: Color,
    val fontFamily: FontFamily,
    val isDarkBackground: Boolean,
    val shadowStyle: Shadow
)

// 2. Modifying Pro Template Gate Rules:
val isTemplateLocked = !isProUser && when (templateId) {
    "executive_glass", "luxury_gold", "sleek_compact", "tech_dark", "creative_gradient" -> true
    else -> false
}

Multi-Language Localization & RTL Guide

NovaQR includes full internationalization (i18n) support, complete right-to-left (RTL) layout compatibility for Arabic and Hebrew, and pre-translated string resources for 7 global languages.

1. Supported Built-In Languages

Language Resource Directory Text Direction Status
English (Default) res/values/strings.xml Left-to-Right (LTR) 100% Fully Translated
Arabic (العربية) res/values-ar/strings.xml Right-to-Left (RTL) 100% Fully Translated with Native RTL Layouts
French (Français) res/values-fr/strings.xml Left-to-Right (LTR) 100% Fully Translated
German (Deutsch) res/values-de/strings.xml Left-to-Right (LTR) 100% Fully Translated
Korean (한국어) res/values-ko/strings.xml Left-to-Right (LTR) 100% Fully Translated
Turkish (Türkçe) res/values-tr/strings.xml Left-to-Right (LTR) 100% Fully Translated
Chinese (中文) res/values-zh/strings.xml Left-to-Right (LTR) 100% Fully Translated

2. Adding a New Language Translation Step-by-Step

To add a new language translation (e.g., Spanish values-es):

  1. In Android Studio, right-click app/src/main/res directory folder.
  2. Select New > Android Resource Directory.
  3. Select Resource type: values, and add Locale qualifier: es: Spanish. This creates directory app/src/main/res/values-es/.
  4. Copy strings.xml from values/ into values-es/ and translate string values into Spanish.
  5. Android OS will now automatically serve Spanish strings to devices set to Spanish language!

3. Automatic Right-to-Left (RTL) Layout Adaptations

Jetpack Compose UI components in NovaQR use logical alignment modifiers (Alignment.Start, padding(start, end)). When the device locale is switched to Arabic or Hebrew, the entire application layout (navigation drawers, card paddings, back arrows, and text flows) automatically mirrors seamlessly without requiring duplicate code!

AI Model & Agent Security Configuration

Comprehensive documentation covering the NOVA AI Assistant security policies, user permission controls, system prompt customization, and Gemini model safety thresholds.

1. Agent Security Policy & Privacy Boundaries

AI Data Protection Policy

The NOVA AI Assistant communicates directly with Google Gemini endpoints (gemini-3.6-flash primary, gemini-3.1-pro secondary) over TLS 1.3 encrypted connections. User prompts and QR context are transmitted solely to compute context-aware recommendations. User identities are isolated, and no user payloads are ever saved by third parties or utilized for AI model re-training.

2. Granting & Managing Context Permissions

The AI Agent can be granted or restricted permissions to read specific user information inside AiAssistantViewModel.kt:

// Context Permission Flags in AiAssistantViewModel.kt
data class AgentPermissions(
    val canReadUserProfile: Boolean = true,      // Grants reading display name & plan status
    val canReadScanStatistics: Boolean = true,   // Grants reading daily scan counters
    val canReadQrVaultHistory: Boolean = false,  // Grants reading saved QR title/content payload
    val canReadDeviceInfo: Boolean = true        // Grants reading Android OS version
)

// Building System Context Payload
fun buildSystemContext(user: UserProfile, permissions: AgentPermissions): String {
    val builder = StringBuilder("You are NOVA, an AI QR Code Assistant. ")
    if (permissions.canReadUserProfile) {
        builder.append("User Name: ${user.fullName}, Tier: ${user.plan}. ")
    }
    if (permissions.canReadScanStatistics) {
        builder.append("Scans Today: ${user.dailyScanCount}. ")
    }
    return builder.toString()
}

3. Customizing System Prompts & Recommendation Rules

System prompts, assistant persona guidelines, recommendation rules, and prompt motifs can be configured locally or synced remotely:

  • Local System Prompt (.env): Set GEMINI_SYSTEM_PROMPT="You are NOVA, an expert design assistant for artistic QR codes." in .env.
  • Remote Supabase Agent Config: Update the agent_config table in Supabase to change system prompts dynamically for all installed apps without submitting a new APK build to Play Store:
UPDATE public.agent_config 
SET prompt = 'You are NOVA Pro, an expert marketing & QR consultant. Always suggest vibrant gradients and high-contrast error correction.'
WHERE id = 1;

4. Gemini Model Safety Thresholds & Moderation

Configure safety filters inside GeminiRepository.kt to prevent inappropriate or harmful prompt processing:

val safetySettings = listOf(
    SafetySetting(HarmCategory.HATE_SPEECH, HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE),
    SafetySetting(HarmCategory.HARASSMENT, HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE),
    SafetySetting(HarmCategory.SEXUALLY_EXPLICIT, HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE),
    SafetySetting(HarmCategory.DANGEROUS_CONTENT, HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE)
)

Security Architecture & Proxy Middleware

Detailed technical documentation covering API proxy routing, rate limiting middleware, system prompt protection, and AI context isolation.

Rate-Limiting Proxy Middleware Sample

// Middleware proxy execution (/proxy/index.js)
const express = require('express');
const rateLimit = require('express-rate-limit');
const app = express();

const apiLimiter = rateLimit({
    windowMs: 15 * 60 * 1000, // 15 Minute window
    max: 100 // Maximum 100 requests per IP
});

app.use('/v1/', apiLimiter);

app.post('/v1/ai/chat', async (req, res) => {
    // Process and forward requests securely to Gemini 3.6 Flash REST endpoints
});

Themes & Freeware Licensing Stack

NovaQR utilizes a 100% royalty-free open-source toolchain that allows white-label redistribution without licensing fees.

Component Open Source / Freeware License Commercial Rights
Jetpack Compose Apache License 2.0 Free commercial modification & bundling.
ZXing Core Apache License 2.0 Free commercial embedded QR processing.
Supabase SDK MIT License Free self-hosting and managed hosting usage.
Gemini API Google Developer Terms Free development tier quota.

In-App Customer Notifications & Broadcasts

NovaQR includes a real-time system notification engine that delivers broadcast announcements and targeted individual alerts directly to customers within the application.

Dual Notification Channels

The notification architecture supports two distinct messaging modes:

  • Broadcast System Announcements (All Users): Stored in public.app_notifications. Delivered to every active app user (e.g. holiday sales, version updates, maintenance notices).
  • Targeted Customer Alerts (Specific User): Stored in public.user_notifications. Delivered exclusively to a specific user_id (e.g. payment confirmations, account upgrade alerts, reward badges).

1. How to Send a Broadcast Announcement (All Users)

To broadcast a promotional message, app update, or alert to all installed devices, execute this query in Supabase SQL Editor:

-- Send a 7-day promotional banner announcement to ALL users:
INSERT INTO public.app_notifications (title, message, type, action_url, is_active, expires_at)
VALUES (
  '🎉 50% Off Lifetime Pro Upgrade!', 
  'Unlock unlimited SVG vector exports, custom logo embedding, and AI prompts today.', 
  'promo', 
  'novaqr://upgrade', 
  true, 
  NOW() + INTERVAL '7 days'
);

2. How to Send a Targeted Message to a Specific Customer

To send a private notification to a single registered user, specify their Supabase user_id (UUID):

-- Send a targeted alert to a specific customer:
INSERT INTO public.user_notifications (user_id, title, message, type, action_url)
VALUES (
  'e8f9b231-1234-4567-890a-bcdef1234567', -- Replace with customer's auth UUID
  'Account Upgraded to Pro!', 
  'Your Pro plan has been activated. Enjoy unlimited vector QR exports!', 
  'billing', 
  'novaqr://profile'
);

3. Client-Side Rendering & In-App UI Display

Inside the Android Kotlin application, the notification system automatically fetches unread messages via Supabase REST API & Realtime Kotlin Flows:

  • Home Screen Top Banner: Active announcements with is_active = true display as floating banner cards on the home dashboard.
  • Notification Center Screen: Users can tap the bell icon to open their personal Notification Inbox screen, view message history, mark alerts as read, or tap action buttons.

Premium Features & Plan Activation Guide

NovaQR includes a complete multi-tier plan management engine (Free vs Pro / Premium) for monetization, feature gating, and usage quota enforcement.

Subscription System (Optional)

The project includes a complete Free/Pro subscription system. By default, all features are enabled for the marketplace version, and the subscription system is disabled. Buyers who wish to operate a freemium or subscription-based application can enable the subscription system through the application configuration, as described in this documentation.

New users receive full access to all application features immediately after creating an account.

If you want to operate a freemium or subscription-based business, you can easily enable the subscription system by updating the configuration in "AppConfig" (ENABLE_PAID_PLANS = true) or the Supabase settings, as described in this documentation.

100% Source Code Provided — Total Operational Freedom

Full Access & Flexibility: The complete source code is provided without obfuscation. You have total freedom to activate paid subscription plans, run the application completely free ($0 for all users), display AdMob banner ads, or process manual upgrades via Supabase. Activating or deactivating paid features is completely optional and under your full control.

1. Three Flexible Deployment & Plan Activation Options

Choose the business model that best matches your strategy:

Option A: 100% Completely Free App ($0 for All Users)

To offer the entire application completely free without any paywalls or limits, update Supabase app_settings table set enable_paid_plans = false or change default_signup_plan = 'pro' in your database trigger. All users immediately receive full access to vector exports, logo embedding, and AI tools.

Option B: Freemium with Manual Admin Upgrades

Keep default_signup_plan = 'free'. Free users are limited to basic QR creation and standard templates. When a customer upgrades via external invoice, offline payment, or custom portal, manually set plan = 'pro' in Supabase SQL Editor.

Option C: Automatic $0 Trial / Auto-Upgrade (Recommended)

Automatically grant new users an automatic $0 trial upgrade on registration linked to a database expiry date (e.g. 30 days free Pro tier). Manage trial expirations automatically via Supabase PostgreSQL triggers.

2. Setting Up Automatic $0 Trial & Plan Expiry in Supabase

To implement an automatic $0 trial or automated plan upgrade linked to database expiration dates, update the handle_new_user() trigger in Supabase SQL Editor:

-- Trigger function for Automatic $0 30-Day Pro Trial on User Signup:
CREATE OR REPLACE FUNCTION public.handle_new_user()
RETURNS trigger AS $$
BEGIN
  INSERT INTO public.profiles (
    id, 
    email, 
    full_name, 
    plan, 
    plan_expires_at, 
    is_trial
  )
  VALUES (
    new.id,
    new.email,
    COALESCE(new.raw_user_meta_data->>'full_name', split_part(new.email, '@', 1)),
    'pro',                            -- Grants Pro plan automatically ($0 trial)
    NOW() + INTERVAL '30 days',       -- Sets plan expiry date 30 days in future
    true                              -- Marks user as active trial participant
  )
  ON CONFLICT (id) DO NOTHING;
  RETURN new;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;

3. Manual User Upgrade Query

To manually upgrade a specific user account to Pro or extend their expiration date in Supabase:

-- Upgrade specific user to Pro tier indefinitely:
UPDATE public.profiles 
SET plan = 'pro', plan_expires_at = NULL, is_trial = false
WHERE email = 'customer@example.com';

-- Extend user Pro trial for 1 year:
UPDATE public.profiles 
SET plan = 'pro', plan_expires_at = NOW() + INTERVAL '1 year'
WHERE email = 'customer@example.com';

4. Ad Monetization & AdMob Display Configuration

If you choose to monetize free tier users with advertisements, NovaQR includes built-in Google AdMob and custom banner ad placeholders:

  • Enabling Ads Remotely: Update enable_ads = true and set your admob_banner_id in the Supabase app_settings table.
  • Pro User Ad-Free Privilege: Pro users (where plan = 'pro') are automatically exempted from seeing banner ads across all screens.
  • Disabling Ads Completely: Set enable_ads = false to turn off all advertising in the app.

5. Feature Gate Matrix

Feature / Capability Free Tier Pro / Premium Tier How to Customize
PNG QR Code Export Unlimited Unlimited Standard core feature.
SVG & PDF Vector Exports Restricted / Gate Alert Full High-Res Vector Output Gated in ExportUtils.kt check profile.isPro.
Logo & Custom Icon Embedding Basic Standard Logos Custom Gallery / Brand Logos Gated in QRStudioViewModel.kt.
AI Assistant Generation Quotas 3 Requests / Day Unlimited AI Prompts Configurable in Supabase app_settings.
Ad-Free Experience Contains Banner Ads (if enabled) 100% Ad-Free UI Controlled by AdManager.kt.
Business Card Executive Templates Standard Templates Only Full Executive & Gold Templates Gated in BusinessCardBuilderScreen.kt.
Business Card Transparent Logo Upload Text Name Branding / Standard High-Res Transparent Logo Overlays Controlled by profile.isPro.
Card Custom Background Image Overlay Preview Mode Full Custom Gallery Image & Opacity Gated in BusinessCardBuilderScreen.kt.

6. Modifying Plan Prices, Descriptions, and Feature Lists Remotely from Supabase

You can update plan titles, monthly/yearly prices, currencies, badge tags, and feature list bullet points in real-time directly from Supabase Table Editor > public.plan_catalog or by executing SQL commands without recompiling or reissuing the APK:

-- Example 1: Update Pro Plan Price to $2.99/mo ($29.99/yr) with custom Euro (€) currency symbol:
UPDATE public.plan_catalog 
SET price_monthly = 2.99, price_yearly = 29.99, currency_symbol = '€', badge_text = 'BEST VALUE'
WHERE plan_id = 'pro';

-- Example 2: Update Pro Plan Feature Description Bullet Points:
UPDATE public.plan_catalog 
SET description = 'Ultimate QR Studio with Unlimited Gemini AI & Vector Output',
    features = ARRAY[
      'Unlimited High-Res SVG & PDF Exports', 
      'Custom Logo & Brand Watermarks', 
      'Unlimited Gemini AI Copywriting', 
      'Zero Banner Advertisements', 
      '24/7 Priority Support'
    ]
WHERE plan_id = 'pro';

-- Example 3: Enable a 100% Free Special Promotion Plan ($0.00/mo):
UPDATE public.plan_catalog 
SET price_monthly = 0.00, price_yearly = 0.00, badge_text = 'FREE PROMO'
WHERE plan_id = 'pro';

The NovaQR mobile app listens to the public.plan_catalog table using Supabase Realtime & REST APIs. Any price modification, description change, or promotional badge tweak updated in Supabase immediately reflects on the app's Upgrade / Paywall screen across all active user devices globally!

7. How to Re-Enable the Subscription System in Source Code (AppConfig.kt)

By default, all features are enabled for the marketplace version (AppConfig.ENABLE_PAID_PLANS = false), granting all newly registered users immediate, full access to all features. To re-enable subscription paywalls, usage limits, and plan tiers, simply update the configuration in com.example.util.AppConfig.kt:

// Location: com/example/util/AppConfig.kt
object AppConfig {
    /**
     * Controls whether Free/Pro subscription paywalls, limits, and plan tiers are enforced.
     * 
     * - false (Default for Marketplace): All features unlocked for all users ($0 required).
     * - true: Enables Free vs Pro plan gating, daily limits, and upgrade paywalls.
     */
    const val ENABLE_PAID_PLANS: Boolean = true // Set to true to re-enable subscription model

    /**
     * Controls whether banner ads are displayed for free-tier users.
     */
    const val ENABLE_ADS: Boolean = false
}

When ENABLE_PAID_PLANS is set to true, the subscription system instantly activates, enforcing plan limits, Pro badges, and paywall prompts across the application according to your Supabase plan rules!

Live Customer Support Integration

NovaQR embeds real-time live customer chat inside the Support screen using Tawk.to WebView integration.

Configuring Tawk.to Keys

TAWK_PROPERTY_ID=YOUR_TAWK_PROPERTY_ID
TAWK_WIDGET_ID=YOUR_TAWK_WIDGET_ID

Comprehensive Troubleshooting Guide

Diagnose and resolve common build, authorization, database, and API connection errors with this professional troubleshooting reference.

Error / Code Root Cause Resolution Procedure
ERR_CONNECTION_REFUSED Deep link redirect URL unwhitelisted in Supabase Auth. Add com.example.novaqr://callback to Supabase Dashboard > Auth > Redirect URLs.
Error 403: org_internal Google Cloud OAuth Consent screen configured as "Internal". Go to Google Cloud Console > OAuth Consent Screen, change User Type to External, and publish app.
Developer Error Code 10 SHA-1 / SHA-256 fingerprint missing or Web Client ID mismatch. Run ./gradlew signingReport, add generated SHA keys to Google Cloud Android Client ID, and verify GOOGLE_LOGIN_KEY.
Redirect URI Mismatch The URL in GOOGLE_CUSTOM_REDIRECT_URL does not match intent filters. Ensure manifest intent filters and .env match com.example.novaqr://callback identically.
Invalid SHA-1 / SHA-256 Keystore alias or password mismatch during release build. Verify release keystore credentials in build.gradle.kts and register production SHA keys in Google Cloud.
Gemini API 403 / 400 Error Invalid API key, model deprecation, or quota exhaustion. Verify GEMINI_API_KEY in .env, check quota usage in Google AI Studio, and ensure model is set to gemini-3.6-flash.
Supabase RLS Policy Violation Database query blocked by missing Row-Level Security policy. Execute the provided table schema SQL scripts in Supabase SQL Editor to grant proper auth.uid() = user_id permissions.
Gradle Sync / Android SDK Failure Outdated Android Studio, incompatible Android Gradle Plugin (AGP), unsupported Gradle version, or the required Android SDK Platform is not installed Update Android Studio, Android Gradle Plugin (AGP), and Gradle to the latest stable versions, then install the required Android SDK Platform through SDK Manager.
Kotlin DSL / JDK 21 Mismatch Gradle runner is configured with an incompatible JDK version (e.g., Java 17 or earlier). Configure the Gradle JDK to use JDK 21 or later in Android Studio. In Android Studio, go to Settings > Build, Execution, Deployment > Build Tools > Gradle and select JDK 17+.
ashmem: Pinning is deprecated since Android Q Standard low-level Android OS kernel / Ashmem shared memory manager log message on Android 10+ (API Level 29+). Normal OS runtime log emitted by the Android graphics memory manager. It is not an application error or crash, causes zero instability, and can be safely ignored.
Camera Preview Black Screen Runtime camera permissions not granted on target device. Check Manifest android.permission.CAMERA and accept the prompt on device.

Frequently Asked Questions (FAQ)

Comprehensive self-service solutions categorized by sub-system.

Google Authentication & OAuth

Q: How does Google CredentialManager differ from standard Browser OAuth?

Answer: Google CredentialManager provides native, zero-redirect authentication directly within Android. It presents a native system UI, retrieves a signed ID Token, and verifies it with Supabase without leaving the app. Browser OAuth serves as a fallback for older devices.

Q: Why is SHA-1 and SHA-256 configuration mandatory for Google Sign-In?

Answer: Google Play Services validates the calling APK's digital signature against the registered SHA fingerprints in Google Cloud Console to prevent unauthorized apps from spoofing your OAuth Web Client ID.

Supabase & AI Engine

Q: Which Gemini AI models are supported in NovaQR v2.0?

Answer: NovaQR supports gemini-3.6-flash for ultra-fast response generation and gemini-3.1-pro for advanced reasoning. You can configure active models via .env or remotely in Supabase agent_config.

Internationalization, RTL & Release Signing

Q: Does NovaQR support Arabic and Right-to-Left (RTL) screen layouts?

Answer: Yes! Jetpack Compose layouts in NovaQR utilize logical padding and alignment properties, making them fully compatible with Arabic, Persian, and Hebrew RTL rendering.

Q: How do I generate an Android App Bundle (.aab) for Google Play Store publication?

Answer: Execute ./gradlew bundleRelease via terminal after configuring your signing keystore credentials inside app/build.gradle.kts.

Binary Distribution & Release Download

Download compiled release binaries for NovaQR for testing, evaluation, and direct deployment.

⭐ Recommended Official Release Current Source Code Build

Download Official App — NovaQR.apk

This is the primary official build containing the exact application source code as provided in the repository. Highly recommended for standard deployment.

💎 Paid Plans & Payments Preview Upcoming Tier Demo

Download NovaQR PRO Preview — NovaQRPRO.apk

Download a special preview build demonstrating what the app looks like with its paid subscription plans, tier management, and payment system interface.

Note: This is an older build and does not include the latest updates or features. It is intended solely for previewing the subscription plans, payment flow, and the differences between Free and Pro user accounts.

Welcome to NovaQR

Welcome to NovaQR. We are dedicated to providing continuous, long-term product updates, new feature releases, and technical support. As market standards evolve, we will periodically release upgrades, extra UI themes, expanded Gemini AI capabilities, and database enhancements to ensure this application consistently exceeds all your operational expectations.

We wish you a pleasant, rewarding, and successful experience with our team!

payfopus

Release History & Change Log

Track releases, updates, bug fixes, and feature enhancements for NovaQR.

v1.1.0 Business Card & UI Update Latest Release
Production Stable

NovaQR v1.1.0 — Business Card Builder & UI Polish Release Notes

Summary of major updates, new features, logo rendering bug fixes, Material 3 switch color enhancements, and documentation upgrades:

FEATURE Business Card & QR Studios

  • Unified TemplateStyle Engine: Created a reactive state architecture (rememberTemplateStyle) that computes background brushes, borders, shadow spot colors, font families, and container metrics for instant re-renders.
  • Transparent Logo Rendering: Removed unwanted solid white box backdrops when uploading company logos, enabling clean, transparent logo display over custom card backgrounds.
  • Write Name Instead Branding: Added a FilterChip mode selector allowing users to switch between uploading an image logo and typing a company name, complete with Change Logo and Remove Logo controls.
  • Lossless PNG Canvas Export: Enhanced high-DPI Android Canvas draw pipeline to export 300 DPI business cards with crisp typography, avatar initial badges, and vCard QR graphics.
  • More features: Integrated Geo/Location QR Studio (GPS map coordinates), vCard Studio, WiFi Studio, AI Assistant, and Barcode Generator across 12 specialized QR creation modules.

POLISH Material 3 & Controls

  • Material 3 Switch Color Contrast: Fixed the "Enable Background Gradient" toggle across Business Card Builder and QR Studio screens, replacing solid yellow colors with distinct checkedThumbColor, checkedTrackColor, uncheckedThumbColor, and uncheckedTrackColor states.
  • Contrast Legibility Safeguard: Improved rememberLegibleColors logic for text and icon contrast over dark vs light card canvases.
  • Multi-Side Preview Tabs: Smooth animated transitions between Front Side, Back Side (QR Code), Digital Contact View, and Full Combined View.

DOCS Tier Gating & Documentation

  • Free vs. Pro Feature Gating: Clearly delineated Free tier capabilities (Standard cards, PNG downloads) from Pro tier features (Executive templates, custom image overlays, high-res exports).
  • Comprehensive Index.html Specification: Added complete Business Card Builder configuration guide, feature matrices, code snippets, and release documentation.
v1.0.0 Initial Version First Release
Production Stable

NovaQR v1.0.0 — Official Version Release Notes

Comprehensive breakdown of new additions, visual customizations, bug fixes, and core system capabilities in the initial release:

NEW Additions & Features

  • Full Guest Studio Mode: Unlocked complete QR code creation, design tweaking, and high-res PNG/SVG exports for guest users without forced login.
  • Expanded Logo Presets: Integrated center icons for 13 categories including Heart, Shopping, Location, Music, Camera, Crypto, Shield, Star, Wi-Fi, Email, Link, Phone, and Person.
  • New Pattern Shapes: Added Diamond, Star, and Grid matrix dots to complement Square, Dots, and Rounded.
  • Finder Eye Designs: Introduced Leaf and Diamond corner frame shapes.
  • One-Tap Style Presets: Added quick theme cards (Classic, Gold Lux, Cyberpunk, Emerald, Sunset, Neon Pink).
  • Custom Image Overlays: Capability to upload custom background images and gallery logos into generated QR codes.

CHANGE UI & Experience Updates

  • Horizontal Scroll Controls: Upgraded shape pickers and color chips with smooth horizontal swipe gestures for compact screens.
  • Dual Preview Sync: Synchronized real-time Compose Canvas renderer with Android Bitmap draw pipelines for exact export matching.
  • Gemini 3.6 AI Integration: Built-in AI Studio Assistant for automated design suggestions, color contrast verification, and tag generation.
  • Interactive Dashboard Analytics: Added distribution counters and visual category breakdowns for generated QR codes.
  • Gradient Canvas Controls: Linear two-color gradient support with angle controls for QR code foregrounds.

FIX Fixes & Stability

  • Enum Serialization Protection: Added safe fallback handling (runCatching) in JSON converters to prevent crash loops when reading modified or legacy style properties.
  • Bitmap Bounds Safeguard: Corrected clipping and center logo size constraints during high-resolution canvas bitmap generation.
  • RTL Layout Adjustments: Resolved text alignment and mirror flipping for 7 supported languages in right-to-left layout mode.
  • Navigation Backstack Fix: Fixed screen state retention when toggling between Dashboard, Studio, Scanner, and History tabs.

CORE Architecture & Localization

  • One-Tap Google OAuth2: Implemented Android CredentialManager API for fast login flow.
  • Supabase Security (RLS): Configured cloud synchronization with Row Level Security policies protecting personal QR history.
  • Local Room Database Vault: Offline-first storage keeping QR history accessible without active internet connection.
  • Multi-Language Engine: Native runtime localization supporting English, Arabic, French, German, Korean, Chinese, and Turkish.