DocuMind AI documentation
Run it, point it at your own accounts, ship it under your own brand. Written against version 1.2.0 of the download you get on CodeCanyon.
- Version v1.2.0
- Updated Apr 2026
- Platform Flutter
- Stack Flutter · OCR
On this page
Introduction
DocuMind AI is a premium Flutter application that lets users upload documents (PDF, TXT), scan physical pages via OCR, and then ask AI-powered questions about the content. Built with Firebase, OpenAI GPT-4o, RevenueCat subscriptions, and Google AdMob monetization.
Target users
Students, lawyers, researchers, business professionals, teachers — anyone who reads long documents and needs quick, AI-driven answers.
Tech stack
Requirements and dependencies
System requirements
External accounts required
- Firebase project — Auth, Firestore, Storage, Cloud Functions
- OpenAI API key — For GPT-4o document Q&A
- RevenueCat account — In-app subscription management
- Google AdMob account — Monetization via ads
- Apple Developer account — For iOS builds & Apple Sign-In
- Google Play Console — For Android distribution
Key dependencies
dependencies:
flutter_riverpod: ^3.2.1 # State management
hooks_riverpod: ^3.2.1 # Hooks + Riverpod
go_router: ^17.1.0 # Declarative routing
firebase_core: ^4.4.0 # Firebase initialization
firebase_auth: ^6.1.4 # Authentication
cloud_firestore: ^6.1.2 # Database
firebase_storage: ^13.0.6 # File uploads
cloud_functions: ^6.0.6 # Cloud Functions calls
google_sign_in: ^7.2.0 # Google OAuth
sign_in_with_apple: ^7.0.1 # Apple OAuth
file_picker: ^10.3.10 # Document picking
image_picker: ^1.2.1 # Camera capture
google_mlkit_text_recognition: ^0.15.1 # OCR
syncfusion_flutter_pdfviewer: ^32.2.7 # PDF viewing
syncfusion_flutter_pdf: ^32.2.7 # PDF parsing
purchases_flutter: ^9.12.2 # RevenueCat
google_mobile_ads: ^7.0.0 # AdMob
flutter_tts: ^4.2.5 # Text-to-Speech
speech_to_text: ^7.3.0 # Speech-to-Text
flutter_markdown: ^0.7.7+1 # Markdown rendering
share_plus: ^12.0.1 # Sharing
url_launcher: ^6.3.2 # Open URLsInstallation
- 01
Prerequisites — install Flutter
Download and install Flutter SDK from the official site. Ensure it’s on your PATH.
terminal# Verify installation flutter doctor -v # Expected output: all checkmarks ✓ for Flutter, Android, iOS - 02
Clone / extract the project
Unzip the source code package or clone from your repository into a working directory.
terminal# Extract the archive unzip documind_ai.zip -d ~/projects/documind_ai cd ~/projects/documind_ai - 03
Install Flutter dependencies
terminalflutter pub get - 04
Set up Firebase
Create a new Firebase project at console.firebase.google.com.
terminal# Install Firebase CLI npm install -g firebase-tools # Login to Firebase firebase login # Install FlutterFire CLI dart pub global activate flutterfire_cli # Configure Firebase for your project flutterfire configure --project=YOUR_FIREBASE_PROJECT_IDNoteThis will generatefirebase_options.dart,google-services.json(Android), andGoogleService-Info.plist(iOS) automatically. - 05
Enable Firebase services
In the Firebase Console, enable the following:
- Authentication → Enable Email/Password, Google, and Apple sign-in methods
- Cloud Firestore → Create a database in production mode
- Firebase Storage → Enable storage for document uploads
- Cloud Functions → Upgrade to Blaze plan (pay-as-you-go) for function deployment
- 06
Deploy Cloud Functions
The Cloud Functions serve as middleware to securely call the OpenAI API.
terminalcd functions # Install Node.js dependencies npm install # Create .env file with your OpenAI key echo "OPENAI_API_KEY=sk-your-openai-api-key-here" > .env # Deploy functions firebase deploy --only functions cd ..WarningNever commit your.envfile or expose your OpenAI API key in client-side code. The Cloud Functions act as a secure proxy. - 07
Configure RevenueCat (subscriptions)
See the detailed RevenueCat setup section below. - 08
Configure AdMob (ads)
See the detailed AdMob setup section below. - 09
Run the app
terminal# Run on Android emulator or device flutter run # Run on iOS simulator (macOS only) flutter run -d ios # Build release APK flutter build apk --release # Build iOS IPA flutter build ipa --release
Project structure
documind_ai/
├── lib/
│ ├── main.dart App entry point
│ ├── app.dart Router, theme, navigation
│ ├── firebase_options.dart Firebase config (auto-generated)
│ ├── core/
│ │ ├── constants/ App-wide constants
│ │ ├── providers/ Global providers (theme, prefs)
│ │ ├── services/ TTS, STT services
│ │ ├── widgets/ Main navigation scaffold
│ │ └── utils/ Helpers
│ └── features/
│ ├── ads/ ad_provider.dart (AdMob IDs)
│ ├── auth/ Login, Register, Onboarding
│ ├── chat/ AI Q&A chat interface
│ ├── document/ Upload, Library, OCR, Viewer
│ ├── home/ Home dashboard
│ ├── profile/ Profile & Settings
│ ├── quiz/ AI Quiz Mode
│ └── subscription/ subscription_provider.dart (RevenueCat)
├── android/ Android native config
├── ios/ iOS native config
├── functions/ Firebase Cloud Functions (Node.js)
└── pubspec.yaml DependenciesConfiguration
Theme and branding
The primary brand color is #00A6A6 (teal). The app uses Material 3 with Google Fonts (Figtree). Edit the theme in:
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF00A6A6), // ← Change brand color here
brightness: Brightness.light,
),
useMaterial3: true,
textTheme: GoogleFonts.figtreeTextTheme(), // ← Change font here
),Environment variables
OPENAI_API_KEYGADApplicationIdentifierFeatures guide
Screen flow
RevenueCat setup
RevenueCat simplifies in-app purchases for both iOS (App Store) and Android (Google Play). It handles receipt validation, subscription status, and cross-platform entitlements.
- 01
Create a RevenueCat account
Go to app.revenuecat.com and sign up for a free account. Create a new Project. - 02
Configure App Store Connect (iOS)
- In App Store Connect, go to Users and Access → Integrations → In-App Purchase
- Generate a Shared Secret (App-Specific)
- Create your subscription products (e.g.,
pro_monthly,pro_yearly) - In RevenueCat dashboard → Project Settings → Apple App Store:
- Paste your App Bundle ID and Shared Secret
- Upload your App Store Connect API Key (P8 file)
- 03
Configure Google Play Console (Android)
- In Google Play Console, go to Monetize → Subscriptions
- Create subscription products matching iOS (e.g.,
pro_monthly,pro_yearly) - Create a Service Account with Financial Data permissions
- Download the JSON key file
- In RevenueCat dashboard → Project Settings → Google Play Store:
- Upload the Service Account JSON key
- Set the Package Name
- 04
Create products and entitlements in RevenueCat
- Go to Products → Add your App Store & Play Store product IDs
- Go to Entitlements → Create an entitlement named
pro - Attach your products to the
proentitlement - Go to Offerings → Create a “Default” offering with your packages
WarningThe entitlement namepromust match exactly — this is what the code checks:entitlements.all['pro']?.isActive - 05
Get your API keys
In the RevenueCat dashboard, go to Project Settings → API Keys. Copy the:
- Apple public API key (starts with
appl_) - Google public API key (starts with
goog_)
- Apple public API key (starts with
- 06
Update the code with your keys
Open
lib/features/subscription/providers/subscription_provider.dartand replace the placeholder keys:subscription_provider.dart// Replace these with your actual RevenueCat publicly viewable API keys const _appleApiKey = 'appl_YOUR_REAL_APPLE_KEY_HERE'; const _googleApiKey = 'goog_YOUR_REAL_GOOGLE_KEY_HERE'; - 07
Disable mock mode
In the same file, set
_useMocktofalseso the app uses real RevenueCat API calls:subscription_provider.dartclass SubscriptionNotifier { // Set this to false when you have real API keys final bool _useMock = false; // ← Change from true to false ... }TipWhen_useMock = true, the app simulates purchases for testing. Switch tofalseonly when your RevenueCat products are fully configured. - 08
Test purchases
- iOS: Use a Sandbox Tester account (App Store Connect → Users → Sandbox Testers)
- Android: Add your Google account as a License Tester (Google Play Console → Settings → License Testing)
- Use RevenueCat’s Debug Logs to verify purchases:
Purchases.setLogLevel(LogLevel.debug)
AdMob setup
- 01
Create an AdMob account
Go to admob.google.com and sign up. Create a new App for both Android and iOS. - 02
Create ad units
For each platform (Android & iOS), create:
Ad typeFormatWhere it’s usedBanner adStandard bannerBottom of Home, Library, Chat screensInterstitial adFull-screenAfter uploading a document - 03
Update Android AdMob App ID
Open
android/app/src/main/AndroidManifest.xmland replace the test App ID:AndroidManifest.xml<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY" /> <!-- Replace with YOUR AdMob Application ID --> - 04
Update iOS AdMob App ID
Open
ios/Runner/Info.plistand replace the test App ID:Info.plist<key>GADApplicationIdentifier</key> <string>ca-app-pub-XXXXXXXXXXXXXXXX~YYYYYYYYYY</string> <!-- Replace with YOUR AdMob Application ID --> - 05
Update ad unit IDs in code
Open
lib/features/ads/ad_provider.dartand replace all test IDs:ad_provider.dartclass AdUnitIds { static String get bannerAdUnitId { if (Platform.isAndroid) { return 'ca-app-pub-XXXXX/YYYYY'; // YOUR Android banner ID } else { return 'ca-app-pub-XXXXX/YYYYY'; // YOUR iOS banner ID } } static String get interstitialAdUnitId { if (Platform.isAndroid) { return 'ca-app-pub-XXXXX/YYYYY'; // YOUR Android interstitial ID } else { return 'ca-app-pub-XXXXX/YYYYY'; // YOUR iOS interstitial ID } } }WarningNever use test ad IDs in production builds. Google will reject your app or suspend your AdMob account. - 06
Test with test ads first
Google provides test ad IDs for development. These are the ones currently in the code. Only replace them when you are ready for production.
Ad typeAndroid test IDiOS test IDBannerca-app-pub-3940256099942544/6300978111ca-app-pub-3940256099942544/2934735716Interstitialca-app-pub-3940256099942544/1033173712ca-app-pub-3940256099942544/4411468910 - 07
Ad behavior
- Pro users automatically skip all ads (checked via
isProflag in user profile) - Banner ads appear for free users on key screens via the
BannerAdWidget - Interstitial ads are shown after user actions (e.g., document uploads) via
InterstitialAdService.recordActionAndShowAdIfReady()
- Pro users automatically skip all ads (checked via
Customization
Changing the app name
Changing the brand color
Edit the seed color in lib/app.dart:
// Current: Teal (#00A6A6)
seedColor: const Color(0xFF00A6A6),
// Example: Deep Purple
seedColor: const Color(0xFF7C3AED),Changing the font
Replace the Google Font in lib/app.dart:
// Current font
textTheme: GoogleFonts.figtreeTextTheme(),
// Alternatives
textTheme: GoogleFonts.interTextTheme(),
textTheme: GoogleFonts.poppinsTextTheme(),
textTheme: GoogleFonts.robotoTextTheme(),Changing the app icon
- Android: Replace files in
android/app/src/main/res/mipmap-*directories - iOS: Replace the asset catalog at
ios/Runner/Assets.xcassets/AppIcon.appiconset/ - Alternatively, use the
flutter_launcher_iconspackage for auto-generation
Changing ad frequency
In lib/features/ads/ad_provider.dart, modify the interstitial ad frequency:
// Show interstitial every N actions (default: 1)
static const int _actionsBetweenAds = 3; // Show every 3 uploadsChanging the AI model
Edit the Cloud Function in functions/index.js to switch OpenAI models:
// Current: GPT-4o
model: "gpt-4o"
// Cheaper alternative
model: "gpt-4o-mini"
// Cheaper still
model: "gpt-3.5-turbo"Admin panel (web)
DocuMind AI includes a built-in admin panel that runs as a Flutter Web app. When you run the project on web (flutter run -d chrome), it automatically loads the admin dashboard instead of the mobile app. The admin panel is deployed to Firebase Hosting at https://documind-ai-8f703.web.app.
Admin panel features
- Dashboard — Overview of total users (Pro, Free, Guest), new signups (today/week/month), document stats (PDF, text, image counts + storage), questions asked today, chat sessions, flashcard decks, and Pro conversion rate.
- User management — Paginated user list with search (email/name) and filter (All/Pro/Free/Guest). Click into any user to see their documents, chat sessions, flashcard decks, and folders. Admin actions: Grant/Revoke Pro, Reset daily questions, Delete user (cascading).
- Document management — Cross-user document listing with type filter (All/PDF/Text/Image). Paginated with 10 items per page.
- Content oversight — Browse all chat sessions across users with a message viewer dialog. Browse all flashcard decks with a card viewer dialog. Useful for monitoring AI response quality.
- Subscriptions — Pro user list with conversion metrics. Manually grant or revoke Pro status.
- Analytics — User growth, document breakdown (type distribution bar), feature usage stats, and user distribution visualization.
- Settings — Configure daily question limit and max AI tokens per response (stored in Firestore
config/app).
Setting up admin access
- 01Go to Firebase Console → Firestore →
userscollection. - 02Find your user document and add a field:
isAdmin: true(boolean). - 03Open the admin panel and sign in with that account’s email/password. Non-admin users are denied access.
Admin deployment and Cloud Functions
Deploying the admin panel
# Build the web release
flutter build web --release
# Deploy to Firebase Hosting
firebase deploy --only hostingThe hosting config in firebase.json points public to build/web with a SPA rewrite rule so all routes resolve to index.html.
Admin Cloud Functions
Five admin-specific Cloud Functions are included in functions/src/index.ts:
All admin functions verify isAdmin: true on the caller before executing. Deploy them with:
cd functions && npm run deployProject structure (admin)
lib/
├── admin_app.dart # Admin GoRouter, theme, transitions
├── main.dart # kIsWeb → AdminApp, else DocuMindApp
└── features/admin/
├── data/
│ └── admin_repository.dart # Firestore queries, pagination, cache
├── providers/
│ ├── admin_auth_provider.dart # Auth state, isAdmin check
│ └── admin_providers.dart # Dashboard stats, config providers
└── presentation/
├── screens/
│ ├── admin_login_screen.dart
│ ├── dashboard_screen.dart
│ ├── users_list_screen.dart
│ ├── user_detail_screen.dart
│ ├── documents_list_screen.dart
│ ├── chat_sessions_screen.dart
│ ├── flashcard_decks_screen.dart
│ ├── subscriptions_screen.dart
│ ├── analytics_screen.dart
│ └── settings_screen.dart
└── widgets/
├── admin_scaffold.dart # Responsive sidebar + layout
├── pagination_controls.dart # Reusable pagination
└── stat_card.dart # Reusable metric cardFirestore indexes
Some admin queries require composite indexes. When you first use a filtered view (e.g., filtering users by Pro status, or documents by type), Firestore will throw an error containing a link to create the required index. Check the browser’s debug console and click the link to create each index automatically.
Troubleshooting
“OPENAI_API_KEY environment variable is missing”
Create a .env file in the functions/ directory:
echo "OPENAI_API_KEY=sk-your-api-key" > functions/.env
firebase deploy --only functionsFirebase Auth: “Sign-In provider is not enabled”
Go to Firebase Console → Authentication → Sign-in method → Enable the provider (Email, Google, Apple).
AdMob: “Failed to load ad”
- Ensure you are using test ad IDs during development
- Real ads may take 24-48 hours to start serving after creating ad units
- Check that the App ID in
AndroidManifest.xml/Info.plistmatches your AdMob dashboard - Ensure the device has internet connectivity
RevenueCat: “No offerings found”
- Verify products are created in both App Store Connect / Google Play Console
- Ensure products are attached to an Offering in RevenueCat dashboard
- Check that your API keys are correct and
_useMock = false - For iOS, subscriptions may take up to 24 hours to propagate in sandbox
Build fails: “SDK version constraint”
Ensure your Flutter SDK version is 3.41.2 or higher:
flutter upgrade
flutter --versioniOS build fails: CocoaPods issues
cd ios
pod deintegrate
pod install --repo-update
cd ..
flutter clean
flutter pub get
flutter runSyncfusion license warning
Syncfusion provides a community license free for individuals and small businesses (<$1M revenue). Register at syncfusion.com/products/communitylicense and add the license key in main.dart:
SyncfusionLicense.registerLicense("YOUR-LICENSE-KEY");Camera / microphone permission denied
iOS: Descriptions are already configured in Info.plist for NSMicrophoneUsageDescription and NSSpeechRecognitionUsageDescription.
Android: Runtime permissions are requested automatically via the plugins. Ensure CAMERA, RECORD_AUDIO permissions are in AndroidManifest.xml if missing.
FAQ
functions/index.js. You can use gpt-4o-mini, gpt-3.5-turbo, or even integrate other AI providers like Claude or Gemini by modifying the API call.flutterfire configure --project=YOUR_NEW_PROJECT_ID to regenerate firebase_options.dart, google-services.json, and GoogleService-Info.plist.BannerAdWidget from your screens and skip InterstitialAdService.recordActionAndShowAdIfReady() calls. You do not need to remove the AdMob SDK.intl package (already included in dependencies). Create ARB files for each locale in lib/l10n/ and configure MaterialApp.localizationsDelegates.Changelog
Every version published so far. Updates are free for the life of the item.
Support and licensing
We provide 6 months of support from the date of purchase.
Our support covers:
- Bug fixes and issues related to the source code
- Installation & configuration assistance
- Firebase, RevenueCat, and AdMob setup guidance
- General questions about features and customization
Support does not include:
- Custom feature development or modification
- Third-party plugin integration beyond what’s included
- App Store / Play Store submission support
What support covers
- Six months of support from purchase, extendable at checkout
- Support covers bugs in the template and questions about how it is put together
- It does not cover custom feature work, third-party API changes or store review outcomes
- The Regular licence covers one free end product. Charging users for the app itself needs the Extended licence