A new Flutter project.
Flutter SDK used: 3.27.4
flutter pub get --no-example
dart run intl_utils:generateadb shell setprop debug.firebase.analytics.app com.fastlab.chatify_ai- Production APK Build:
flutter build apk --release --no-tree-shake-icons
flutter build appbundle --release --no-tree-shake-icons![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Add project into your firebase account and add android, ios and web app with your application id. My appication id is com.fastlab.chatify_ai for adnroid. You also need to change this in current project as well. Here is the step you can follow to change application id:
- Step 1: Search
com.fastlab.chatify_aiin whole project and replace every instance with your application id say itscom.yourcompany.myapp. - Step 2: Rename this folder name android\app\src\main\kotlin\com\
fastlab\chatify_aito android\app\src\main\kotlin\com\yourcompany\myapp
Well done you your android package name(applicaton id) is changed to com.yourcompany.myapp.
Follow this doc - https://firebase.google.com/docs/flutter/setup?platform=android
firebase emulators:start --import ./firebase-export-1738494335036oJP5Y8 --export-on-exit
firebase deploy --only functions:stripeWebhook
firebase functions:delete myFunction
stripe listen --forward-to http://127.0.0.1:5001/chatifyai-7a694/us-central1/stripeWebhook
users Collection
users/{userId}
{
uid: string, // Firebase Auth UID
displayName: string,
email: string,
photoURL: string?,
createdAt: timestamp,
lastActive: timestamp,
settings: {
notifications: boolean,
phoneLanguage: string,
countryCode: string
}
subscriptionId: string,
usage: {
daily: {
[date: string]: { // Format: "YYYY-MM-DD"
messagesCount: number,
imagesCount: number,
audiosCount: number,
lastUpdated: timestamp
}
},
monthly: {
[month: string]: { // Format: "YYYY-MM"
messagesCount: number,
imagesCount: number,
audiosCount: number,
lastUpdated: timestamp
}
}
},
limits: {
messagesPerDay: number,
imagesPerDay: number,
messagesPerMonth: number,
imagesPerMonth: number
}
}subscriptions Collection
subscription/{subscriptionId} {
planId: string,
status: string, // "active", "cancelled", "expired"
userId: string,
startDate: timestamp,
endDate: timestamp,
platform: string, // "google_play"
purchaseToken: string,
orderId: string
}plans Collection
// plans collection for subscription tiers
plans/{planId} {
name: string,
price: number,
currency: string,
interval: string, // "month" or "year"
playStoreProductId: string,
limits: {
messagesPerDay: number,
imagesPerDay: number,
audioPerday: number,
messagesPerMonth: number,
imagesPerMonth: number,
audioPerMonth: number,
}
}chatBots Collection
chatBots/[botId]
{
botName: string,
botAvatar: string,
botRole: string,
botMessage: string,
botPrompt: string,
botStatus: sring, // active, inactive
createdAt: timestamp,
userId: string, // Only meant for admin
}chatRooms Collection
chatRooms/{chatRoomId}
{
userId: string, // Reference to user who owns this chat
botId: string, // Identifier for the AI bot
botName: string,
createdAt: timestamp,
lastMessage: {
content: string,
timestamp: timestamp,
senderId: string // Either userId or botId
},
metadata: {
customInstructions: string?
}
}messages Collection (Subcollection of chatRooms)
chatRooms/{chatRoomId}/messages/{messageId}
{
content: string,
timestamp: timestamp,
senderId: string, // Either userId or botId
senderType: string, // 'user' or 'bot'
status: string, // 'sent', 'delivered', 'error'
type: string, // 'text', 'image', 'system'
metadata: {
tokens: number?, // For tracking token usage
model: string?, // AI model used
error: string? // Error message if status is 'error'
}
}generatedImages Collection
generatedImages/{generatedImageId}
{
userId: string,
imgUrl: string,
createdAt: timestamp,
metadata: {
prompt: string,
model: string,
size: string,
quality: string,
}
}appSetting Collection
{
"settings": {
"version": "1.0",
"apiKeys": {
"openai": "sk-...",
"deepseek": "ds-...",
"gemini": "gem-..."
},
"models": {
"chat": {
"configurations": [
{
"id": "gpt-4",
"name": "GPT-4",
"provider": "openai",
"apiModel": "gpt-4-turbo-preview",
"maxTokens": 128000,
"isDefault": true,
"isActive": true,
"capabilities": {
"streaming": true,
"functionCalling": true,
"imageAnalysis": true
}
}
// More chat models...
],
"defaultModelId": "gpt-4"
},
"voiceAssistant": {
"configurations": [
// Voice assistant models...
],
"defaultModelId": "whisper-1"
},
"imageGeneration": {
"configurations": [
// Image generation models...
],
"defaultModelId": "dall-e-3"
},
"textToVoice": {
"configurations": [
// Text to voice models...
],
"defaultModelId": "elevenlabs-1"
}
},
"rateLimit": {
"requestsPerMinute": 60,
"requestsPerDay": 1000
},
"maintenance": {
"isUnderMaintenance": false
}
}
}











